hi. i know this question belongs to the cg forums, but they are dead, no one looks at them, at least yet. so i post it here -
i wrote a simple diffuse lighting shader, but it doesnt work. here is the important part that doesnt work -
float4 T = float4(In.Pos.x, In.Pos.y, In.Pos.z, 1);
float4 N = float4(In.Normal.x, In.Normal.y, In.Normal.z, 1);
float4 l = float4(LightPos.x, LightPos.y, LightPos.z, 0);
N = normalize(mul(matWVIT, N).xyzz);
float4 V = mul(matWV, T);
float4 L = mul(matWV, l);
L = normalize(L-V);
float Diffuse = dot(N, L);
i guess the problem is here, but i dont know what it is. i pass the lightpos in world space and transform it to eye space along with the vertex pos to compute eye-space light direction. isnt it right?
well, i must admit im using direct3d now, and im not sure the D3DMATRIX can be used for 3x3 matrices instead of 4x4 matrices.
thnx anyway, ill try what you said.