View Full Version : Small question about lightning

11-05-2001, 11:37 PM

I'm using omnidirectional lights, spot-light and directional lights in my scene. I have many windows with different view onto the scene.
I'm wondering why my objects are lit in the same way in all my views evenso the lighting seems realistic.

Imagine this scene: you have a simple plane. On its right there is a directional light (sun), on the left there is my first camera. When I look through the camera I can see a very bright light (like when the sun reflects on the see). But why does my second camera which has a totally different position/orientation see exactly the same colors?? Or why does the lighting not change when I move the camera?? Only moving the light or the scene will change the lighting.
When using other types of light (directional, omnidirectional) I have the same effect. Is this normal?? I thought the lighting is computed by OpenGL by taking the view position into account...

Thanks for your advice http://www.opengl.org/discussion_boards/ubb/smile.gif

11-05-2001, 11:41 PM
Two things that I can think about.

1: You are doing your viewport transformations in the projection matrix.
2: You don't specify any normals.

11-06-2001, 03:32 PM
Thanks Bob http://www.opengl.org/discussion_boards/ubb/smile.gif

I was using gluLookAt on the GL_PROJECTION matrix instead on the GL_MODELVIEW matrix, like you said.
Now everything looks realistic!

Here an interesting article about GL_PROJECTION abuse:

Spiral Man
11-06-2001, 04:27 PM
just to clarify something:

the lighting component GL_DIFFUSE is not affected by the viewpoint. GL_SPECULAR is affected by the viewport. so, if you only specify the values for GL_DIFFUSE, moving the camera will not change how the model is lit...