PDA

View Full Version : Lighting Problem



immy
04-02-2002, 02:55 AM
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

zed
04-02-2002, 10:09 AM
check the faq (www.opengl.org right side of page)

seu
04-03-2002, 04:08 AM
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

Devulon
04-03-2002, 08:23 AM
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

immy
04-03-2002, 11:06 PM
Originally posted by Devulon:
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

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

kansler
04-04-2002, 02:39 AM
Just guessing but maybe a problem with your normals?

harsman
04-04-2002, 04:00 AM
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.

immy
04-04-2002, 10:43 PM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif