Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: Lighting Problem

  1. #1
    Intern Newbie
    Join Date
    Mar 2002
    Posts
    42

    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

  2. #2
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Jul 2000
    Location
    S41.16.25 E173.16.21
    Posts
    2,609

    Re: Lighting Problem

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

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2002
    Location
    Buenos Aires, Argentina
    Posts
    5

    Re: Lighting Problem

    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/p...ion_abuse.html

  4. #4
    Junior Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    124

    Re: Lighting Problem

    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

  5. #5
    Intern Newbie
    Join Date
    Mar 2002
    Posts
    42

    Re: Lighting Problem

    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

  6. #6
    Intern Contributor
    Join Date
    Apr 2002
    Posts
    87

    Re: Lighting Problem

    Just guessing but maybe a problem with your normals?

  7. #7
    Advanced Member Frequent Contributor
    Join Date
    Sep 2000
    Location
    SWEDEN
    Posts
    718

    Re: Lighting Problem

    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.

  8. #8
    Intern Newbie
    Join Date
    Mar 2002
    Posts
    42

    Re: Lighting Problem

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •