POV-Ray : Newsgroups : povray.text.scene-files : fast_prox02.inc Server Time
28 Mar 2024 07:53:06 EDT (-0400)
  fast_prox02.inc (Message 1 to 1 of 1)  
From: stbenge
Subject: fast_prox02.inc
Date: 24 Aug 2009 02:59:25
Message: <4a923a4d@news.povray.org>
My fast_prox include file, updated to version 02. It contains a few 
proximity patterns and a few undocumented subsurface scattering macros.

To recap:

Subsurface scattering is light entering an object and scattering below 
the surface in all directions, thus exiting in an unfocused fashion. My 
macros fake that effect. They will work with meshes as well as any other 
object POV supports.

Proximity patterns attempt to approximate the distance from the surface 
of an object to any given point in space. We need these for rubbing dirt 
into crevices or scuffing outer edges. My macros fake that as well, but 
they do it by averaging the number of times a point is found outside an 
object as opposed to inside it. Thus, no normal vector is produced, only 
a blurry representation of the object being tested.

Useful for some things!

Not useful for objects you can't find the inside() of (like meshes). For 
that you must determine the inside of an object using trace(). I did 
this once with Edouard Poor's help. Here's what he showed me:

#macro inside_m( obj, pos ) // Edouard Poor Dec. 2008
  #local current = pos;
  #local dir = x;
  #local done = 0;
  #local num = 0;
  #while ( done != 1 )
   #local norm = <0,0,0>;
   #local inter = trace( obj, current, dir, norm );
   #if ( vlength( norm ) != 0 )
    #local num = num + 1;
    #local current = inter + <0.0001,0,0>;
   #else
    #local done = 1;
   #end
  #end
  (mod( num, 2 ) = 1)
#end

Sorry for the lack of examples. If needed, I can produce a couple :)

Sam


Post a reply to this message


Attachments:
Download 'fast_prox02.inc.txt' (14 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.