gagn
02-19-2008, 03:56 PM
Hi all,
I´m trying to achieve the following:
Particles, when in vicinity of a surface, color that surface.
Pretty much what this guy (http://forums.cgsociety.org/showthread.php?f=86&t=133066&highlight=particle+color+proximity) is asking for.
I´m using the Distance Shader from HIghend3d as a starting point.
I understand that I need to modify the distance expression, which looks like this:
float $array[]; //here are the distances stored
$array[0]=sqrt((l1.translateX-si.pointWorldX)*(l1.translateX-si.pointWorldX)+(l1.translateY-si.pointWorldY)*(l1.translateY-si.pointWorldY)+(l1.translateZ-si.pointWorldZ)*(l1.translateZ-si.pointWorldZ));
$array[1]=sqrt((l2.translateX-si.pointWorldX)*(l2.translateX-si.pointWorldX)+(l2.translateY-si.pointWorldY)*(l2.translateY-si.pointWorldY)+(l2.translateZ-si.pointWorldZ)*(l2.translateZ-si.pointWorldZ));
$array[2]=sqrt((l3.translateX-si.pointWorldX)*(l3.translateX-si.pointWorldX)+(l3.translateY-si.pointWorldY)*(l3.translateY-si.pointWorldY)+(l3.translateZ-si.pointWorldZ)*(l3.translateZ-si.pointWorldZ));
etc...
//we should find the minimum distance and store it in the first slot
int $i;
for($i=1;$i<8;$i++) if($array[0]>$array[$i]) $array[0]=$array[$i];
setDistRange.valueX=$array[0];
so that it instead of indicating the position of the locators, uses the particles´.
Has anyone done this?
Any help very appreciated.
Gabriel
I´m trying to achieve the following:
Particles, when in vicinity of a surface, color that surface.
Pretty much what this guy (http://forums.cgsociety.org/showthread.php?f=86&t=133066&highlight=particle+color+proximity) is asking for.
I´m using the Distance Shader from HIghend3d as a starting point.
I understand that I need to modify the distance expression, which looks like this:
float $array[]; //here are the distances stored
$array[0]=sqrt((l1.translateX-si.pointWorldX)*(l1.translateX-si.pointWorldX)+(l1.translateY-si.pointWorldY)*(l1.translateY-si.pointWorldY)+(l1.translateZ-si.pointWorldZ)*(l1.translateZ-si.pointWorldZ));
$array[1]=sqrt((l2.translateX-si.pointWorldX)*(l2.translateX-si.pointWorldX)+(l2.translateY-si.pointWorldY)*(l2.translateY-si.pointWorldY)+(l2.translateZ-si.pointWorldZ)*(l2.translateZ-si.pointWorldZ));
$array[2]=sqrt((l3.translateX-si.pointWorldX)*(l3.translateX-si.pointWorldX)+(l3.translateY-si.pointWorldY)*(l3.translateY-si.pointWorldY)+(l3.translateZ-si.pointWorldZ)*(l3.translateZ-si.pointWorldZ));
etc...
//we should find the minimum distance and store it in the first slot
int $i;
for($i=1;$i<8;$i++) if($array[0]>$array[$i]) $array[0]=$array[$i];
setDistRange.valueX=$array[0];
so that it instead of indicating the position of the locators, uses the particles´.
Has anyone done this?
Any help very appreciated.
Gabriel
