PDA

View Full Version : Lighting problem (opengl + shader lighting)



ox1d_47
08-19-2004, 09:51 AM
I have a problem with OpenGL lighting and a GLSL-lighting-shader. If i specify a lightposition (for OpenGL-lighting version + shader version) i get a wrong light-position. The vector-components (x,y,z) of the lightpos have to be multiplied with -1 in order to get a right position in my scene. I have a 3D-Mesh loaded from a file. I calculated the normal-vectors of each vertex. I not moving my camera and just looking down my object but i still have the same problem. Is it important where the normals point to? But when i render my normals they are looking away from my object (most of them).

Anyone ideas?
Thank you.

ox1d_47

Only Sophoo...
08-19-2004, 08:43 PM
Principle - The normals indicate the direction in which the light is reflected.

Note - object normals are towards the light position.
Light direction should be towards the object.

hope this helps
sophia