Lighting Problem

Hi
I am rendering a terrain in the normal view lighting works fine but when i change the view to top view & see it from the top(far away from the top) the lighting becomes horrible as no light.
Help me out . Thanks in advance
bye

check the faq (www.opengl.org right side of page)

Originally posted by immy:
Hi
I am rendering a terrain in the normal view lighting works fine but when i change the view to top view & see it from the top(far away from the top) the lighting becomes horrible as no light.
Help me out . Thanks in advance
bye

Maybe you’re setting the camera in the wrong matrix (GL_PROJECTION). See http://www.sjbaker.org/steve/omniv/projection_abuse.html

I’m nore sure what the problem is (perhaps can you give us some more info). I agree though it sounds like it might be a matrix issue. In the top view there is no light. But if you move closer to the terrain does the light come back ? Sounds like the light position might be getting multiplied by the wrong matrix. Check to see where you actually call glLightfv(GL_LIGHTX, GL_POSITION,…) or however it goes exactly. That position will be multiplied by the current worldview matrix.

Hope this helps give you some ideas on where to look.

Happy Coding.

Devulon

Originally posted by Devulon:
[b]I’m nore sure what the problem is (perhaps can you give us some more info). I agree though it sounds like it might be a matrix issue. In the top view there is no light. But if you move closer to the terrain does the light come back ? Sounds like the light position might be getting multiplied by the wrong matrix. Check to see where you actually call glLightfv(GL_LIGHTX, GL_POSITION,…) or however it goes exactly. That position will be multiplied by the current worldview matrix.

Hope this helps give you some ideas on where to look.

Happy Coding.

Devulon[/b]

I am not disturbing light’s position when switch to top view. The matric modes are all fine. On top view activation i only change the camera position, look point & up vector nothing else is changed. thats it

Just guessing but maybe a problem with your normals?

What Devulon is saying is that depending on where you set the light position it will be transformed by the current modelview matrix. If you’re changing view youre definitely changing the modelview matrix.

Originally posted by harsman:
What Devulon is saying is that depending on where you set the light position it will be transformed by the current modelview matrix. If you’re changing view youre definitely changing the modelview matrix.

yep but am calling
glLightfv(GL_POSTION,…);

when the model view matrix is identity. After that i can the model view matrix. The problem is there is some light in the scene when i change my view to top but the light is not very good. I want the terrain to look like as if viewed from an aircraft or like that.
Thanks for replies