Hello openGL friends,
I am currently implementing directional lights in GLSL (actually deferred but that should not matter) and I am confused about something.- The light works fine but right now the light direction is in viewspace so that it works kind of like a camera light (e.g: when i move the camera using glRotate or gluLookAt it stays in place relative to the camera, not the scene/world). That makes sense since I just have a constant (normalized) direction vector in my shader which does not get multiplied by any matrix.
However I was thinking that I could simply multiply the direction vector by gl_ModelViewMatrix in the vertex shader and normalize it in the fragment shader (how you would do it for point lights in world space, even though there its a position rather than a direction).- Unfortunatelly the results i get look a little bit weird so I was wondering if that is the correct approach. Any ideas on that?
If my idea is correct its propably something about my shader, I will post it then, if the way I had in mind is wrong anyways please correct me!