|
|
*Philippe kicks himself vigorously*
#macro Cosine_Falloff_Spot(ala1, ala2, Point_At)
#local
al=sqrt(sqrt(((ala1.x+ala1.y+ala1.z)/3)*((ala2.x+ala2.y+ala2.z)/3)));
spotlight radius -90 falloff 90 tightness 1 point_at
vnormalize(Point_At)*al
#end
or
#macro Cosine_Falloff_Spot(al, Point_At)
spotlight radius -90 falloff 90 tightness 1 point_at
vnormalize(Point_At)*al
#end
I am not sure about al : it surely isn't the surface of the area and you
could have problem with square roots of negative numbers (you can fix that
with abs, but there are several different ways to do that and they would
produce quite different results, so...).
If you want the area, you could use :
#local
al=sqrt((pow(ala1.x,2)+pow(ala1.y,2)+pow(ala1.z,2))*(pow(ala2.x,2)+pow(ala2.
y,2)+pow(ala2.z,2));
but
#local al=vlength(ala1)*vlength(ala2);
is much easier and much more readable, and
#local al=vlength(vdot(ala1,ala2));
is even shorter and "more elegant" ;-)
Philippe
Post a reply to this message
|
|