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 2 of 2

Thread: Linear Fog and glFrustum

Hybrid View

  1. #1
    Newbie Newbie
    Join Date
    Oct 2012
    Posts
    1

    Linear Fog and glFrustum

    I am using fixed function pipeline and linear fog (and for compatibility reasons I cannot changed this now).

    I am rendering couple of viewpoints with off-axis glFustrum, and with different near plane distance.

    The problem I am seeing is that far away object (my "skydome") gets different amount of fog on the
    different frustums.

    I first thought that the reason was my different near plane, but when I scaled my frustum, so that the near planes matched the difference is still there. (I did the scaling by scaling all the frustum parameters except the far plane, at this point I was afraid that I would introduce bad far plane clipping)

    I have checked that If I copy my projection matrix from the first view to the second view before sky dome rendering, then the fog seems to match, so the issue appears to be really projection matrix related.

    (Yes, I am pretty sure I am not doing projection matrix abuse)

    Any hints and pointers either solving this problem or describing the interaction between projection matrix and (linear) fog would be appreciated.

    Eero

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,213
    Make sure you are are using radial fog coord mode, not eye-plane or eye-plane absolute.

    You can get alot of fogging strangeness with eye-plane and eye-plane absolute fog coord mode, especially with very wide or very off-axis frustums. The fog coord ends up changing alot even when you are just rotating the eyepoint, which is of course not realistic.

    Then just ensure that your MODELVIEW transforms for the different frusta are using the exact same eyepoint and only vary in the look direction (no scales allowed), then you're gold. Use the same fog params between frusta of course.
    Last edited by Dark Photon; 10-14-2012 at 10:26 AM.

Posting Permissions

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