chrisWhite
03-25-2005, 10:13 PM
I'm using Vassg's Expression driven distance shader (http://www.vassg.hu/letoltes_en.htm) on a scene and I've finally got it working great, except that It still has Vassg's original locater's positions effecting the ramp, even though I've deleted the locaters and objects. I've rebuilt his entire network from scratch, except for his expression so I'm guessing the extra information must be housed somewhere in the expression. Unfortunately I've never used Maya's expressions and I don't have a strong programming or math background and quite frankly, I'm lost. Could someone suggest what might be happening and how I could fix it?
Here's the expression:
float $array[]; //here are the distances stored
$array[0]=sqrt((SphereLocater.translateX-distance_samplerInfo.pointWorldX)*(SphereLocater.translateX-distance_samplerInfo.pointWorldX)+(SphereLocater.translateY-distance_samplerInfo.pointWorldY)*(SphereLocater.translateY-distance_samplerInfo.pointWorldY)+(SphereLocater.translateZ-distance_samplerInfo.pointWorldZ)*(SphereLocater.translateZ-distance_samplerInfo.pointWorldZ));
$array[1]=sqrt((.I[6]-distance_samplerInfo.pointWorldX)*(.I[6]-distance_samplerInfo.pointWorldX)+(.I[7]-distance_samplerInfo.pointWorldY)*(.I[7]-distance_samplerInfo.pointWorldY)+(.I[8]-distance_samplerInfo.pointWorldZ)*(.I[8]-distance_samplerInfo.pointWorldZ));
$array[2]=sqrt((.I[9]-distance_samplerInfo.pointWorldX)*(.I[9]-distance_samplerInfo.pointWorldX)+(.I[10]-distance_samplerInfo.pointWorldY)*(.I[10]-distance_samplerInfo.pointWorldY)+(.I[11]-distance_samplerInfo.pointWorldZ)*(.I[11]-distance_samplerInfo.pointWorldZ));
$array[3]=sqrt((.I[12]-distance_samplerInfo.pointWorldX)*(.I[12]-distance_samplerInfo.pointWorldX)+(.I[13]-distance_samplerInfo.pointWorldY)*(.I[13]-distance_samplerInfo.pointWorldY)+(.I[14]-distance_samplerInfo.pointWorldZ)*(.I[14]-distance_samplerInfo.pointWorldZ));
$array[4]=sqrt((.I[15]-distance_samplerInfo.pointWorldX)*(.I[15]-distance_samplerInfo.pointWorldX)+(.I[16]-distance_samplerInfo.pointWorldY)*(.I[16]-distance_samplerInfo.pointWorldY)+(.I[17]-distance_samplerInfo.pointWorldZ)*(.I[17]-distance_samplerInfo.pointWorldZ));
$array[5]=sqrt((.I[18]-distance_samplerInfo.pointWorldX)*(.I[18]-distance_samplerInfo.pointWorldX)+(.I[19]-distance_samplerInfo.pointWorldY)*(.I[19]-distance_samplerInfo.pointWorldY)+(.I[20]-distance_samplerInfo.pointWorldZ)*(.I[20]-distance_samplerInfo.pointWorldZ));
$array[6]=sqrt((.I[21]-distance_samplerInfo.pointWorldX)*(.I[21]-distance_samplerInfo.pointWorldX)+(.I[22]-distance_samplerInfo.pointWorldY)*(.I[22]-distance_samplerInfo.pointWorldY)+(.I[23]-distance_samplerInfo.pointWorldZ)*(.I[23]-distance_samplerInfo.pointWorldZ));
$array[7]=sqrt((.I[24]-distance_samplerInfo.pointWorldX)*(.I[24]-distance_samplerInfo.pointWorldX)+(.I[25]-distance_samplerInfo.pointWorldY)*(.I[25]-distance_samplerInfo.pointWorldY)+(.I[26]-distance_samplerInfo.pointWorldZ)*(.I[26]-distance_samplerInfo.pointWorldZ));
//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];
distance_setRange.valueX=$array[0];
Could anything besides the expression be causing the problem? Thanks!
Here's the expression:
float $array[]; //here are the distances stored
$array[0]=sqrt((SphereLocater.translateX-distance_samplerInfo.pointWorldX)*(SphereLocater.translateX-distance_samplerInfo.pointWorldX)+(SphereLocater.translateY-distance_samplerInfo.pointWorldY)*(SphereLocater.translateY-distance_samplerInfo.pointWorldY)+(SphereLocater.translateZ-distance_samplerInfo.pointWorldZ)*(SphereLocater.translateZ-distance_samplerInfo.pointWorldZ));
$array[1]=sqrt((.I[6]-distance_samplerInfo.pointWorldX)*(.I[6]-distance_samplerInfo.pointWorldX)+(.I[7]-distance_samplerInfo.pointWorldY)*(.I[7]-distance_samplerInfo.pointWorldY)+(.I[8]-distance_samplerInfo.pointWorldZ)*(.I[8]-distance_samplerInfo.pointWorldZ));
$array[2]=sqrt((.I[9]-distance_samplerInfo.pointWorldX)*(.I[9]-distance_samplerInfo.pointWorldX)+(.I[10]-distance_samplerInfo.pointWorldY)*(.I[10]-distance_samplerInfo.pointWorldY)+(.I[11]-distance_samplerInfo.pointWorldZ)*(.I[11]-distance_samplerInfo.pointWorldZ));
$array[3]=sqrt((.I[12]-distance_samplerInfo.pointWorldX)*(.I[12]-distance_samplerInfo.pointWorldX)+(.I[13]-distance_samplerInfo.pointWorldY)*(.I[13]-distance_samplerInfo.pointWorldY)+(.I[14]-distance_samplerInfo.pointWorldZ)*(.I[14]-distance_samplerInfo.pointWorldZ));
$array[4]=sqrt((.I[15]-distance_samplerInfo.pointWorldX)*(.I[15]-distance_samplerInfo.pointWorldX)+(.I[16]-distance_samplerInfo.pointWorldY)*(.I[16]-distance_samplerInfo.pointWorldY)+(.I[17]-distance_samplerInfo.pointWorldZ)*(.I[17]-distance_samplerInfo.pointWorldZ));
$array[5]=sqrt((.I[18]-distance_samplerInfo.pointWorldX)*(.I[18]-distance_samplerInfo.pointWorldX)+(.I[19]-distance_samplerInfo.pointWorldY)*(.I[19]-distance_samplerInfo.pointWorldY)+(.I[20]-distance_samplerInfo.pointWorldZ)*(.I[20]-distance_samplerInfo.pointWorldZ));
$array[6]=sqrt((.I[21]-distance_samplerInfo.pointWorldX)*(.I[21]-distance_samplerInfo.pointWorldX)+(.I[22]-distance_samplerInfo.pointWorldY)*(.I[22]-distance_samplerInfo.pointWorldY)+(.I[23]-distance_samplerInfo.pointWorldZ)*(.I[23]-distance_samplerInfo.pointWorldZ));
$array[7]=sqrt((.I[24]-distance_samplerInfo.pointWorldX)*(.I[24]-distance_samplerInfo.pointWorldX)+(.I[25]-distance_samplerInfo.pointWorldY)*(.I[25]-distance_samplerInfo.pointWorldY)+(.I[26]-distance_samplerInfo.pointWorldZ)*(.I[26]-distance_samplerInfo.pointWorldZ));
//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];
distance_setRange.valueX=$array[0];
Could anything besides the expression be causing the problem? Thanks!
