PDA

View Full Version : Wierd Diffuse Light with Vertex Shader



orbano
01-11-2004, 02:07 AM
My vertex shader code for simple diffuse light is the following:

vfconn OUT;
OUT.HPos = mul(ModelViewProj, IN.position);
OUT.Col0=IN.position*saturate( dot(IN.norm, normalize(litepos-IN.position)) );
OUT.texcoord=IN.texcoord;
return OUT;

And the results:
pic (http://people.inf.elte.hu/orbanv/lite.gif)

The radius of the lit area both increases with increasing x,y or z (a plane object on the x/y plane is lit)

I checked my vertices, normals and light position to be correct. Any idea whats wrong?

thank you in advance!

[This message has been edited by orbano (edited 01-11-2004).]

Nutty
01-12-2004, 09:19 AM
Why are you multiplying the IN.position with the dot product of the normal and surface to light vector?

orbano
01-12-2004, 03:14 PM
i wanted to see if the vertex coordinates are valid, and to see the orientation of the coordinates (so i know that the transformations are right).
btw i found the problem, my nomrlas were set up improperly.
thanx anyway