RenderMan & RISpec >> Dot products...< 0

by Manuel » Sat, 25 Jun 2005 15:47:13 GMT

Hi.
I need a litle help.
I know the dot product between 2 vectors A and B
is |A|*|B|*cos alpha
So, if the angle is (in istance) 110the dot prod is negative.

I'm written a simple exercise shader:

surface foo (float Ka = 1, Kd = 1) {
//normal Nf = faceforward (normalize(N),I);
normal Nf = Ng;
float ill;
color C = 0;
illuminance (P, Nf, PI/2){
ill = (normalize (L). normalize(Nf));
if (ill<< 0){
printf("%f\n", ill);}
C += Cl * ill;
}
Ci = Cs * C;
Oi = Os; Ci *= Oi;
}

And test it into a simple scene, on a sphere.
The strange is the 'ill' is always>> 0. I don't understand why...

Can you help me?
Thanks,

Manuel Bastioni

RenderMan & RISpec >> Dot products...< 0

by Tonci Nemes » Sat, 25 Jun 2005 18:34:11 GMT


If you look at the shader's illuminance statement, you'll see that it
picks up lights that can only contribute in the hemisphere surrounding
the normal of the surface. In that hemishpere, the cosine of the angle
between L and normal is by definition a positive value. Increase the
angle in illuminance to, say, PI and you ought to see negative values
being printed. I have tried this on Aqsis 1.0. It prints negative values
with your unmodified shader in BMRT 2.6, though.

Regards,

Tonci

RenderMan & RISpec >> Dot products...< 0

by Manuel » Sat, 25 Jun 2005 22:23:44 GMT


Thanks. It work perfectly.
I hope to make something useful to share...I'm a newbie in renderman,
and my first goal is write a renderman version of 'quick sss' I've
developed for Blender some time ago:

http://www.dedalo-3d.com/public/forum/index.php?a=topic&topic=1111837542.23&page=1

Thanks again, and sorry for my poor english...

Manuel Bastioni

Similar Threads

1. The dot product and cross product