|
|
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)
|
|