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

Thread: orthogonal fog ?

  1. #1
    Guest

    orthogonal fog ?

    I rendered a rotating transparent sphere that
    is sprenckled with points. When I tried to
    add some fog for depth-cueing, the colors
    of both, the front and the back side become
    fainter while the sides of the object stay
    bright. It therefore seems like the fogging
    does not start from my viewing position, but
    rather strangely from the two orthogonally
    oriented sides.
    I don't use gluLookAt and already checked for
    correct use of GL_PROJECTION - what else
    could i have made wrong ?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: orthogonal fog ?

    Since there is no "correct" way to setup matrices in OpenGL (and the projection matrix is no exception), all ways are correct. It's just a matter of what you are trying to achieve.

    So please describe what you mean by "correct use of GL_PROJECTION". It may be correct as seen from how you try to simulate a camera, but OpenGL's fog equations may not like it.

  3. #3
    Guest

    Re: orthogonal fog ?

    Dear Bob,

    thank you very much for your reply.
    With "correct' use of GL_PROJECTION is was refering to what I heard to be a "misuse" of it for setting up the camera position and such that is often pointed out as being a problem for correct fogging. However, I don't use gluLookAt and rotating the object works fine. It is just that the fog starts from the middle plane that is cross-secting the object and then spreads towards both ends - the one that faces to you as the one that faces away.
    (sorry for my ignorant way of describing -
    I feel very stupid about all that).
    I am using glOrtho - could that be a problem - somewhere I have heard about that ?

    Thanks again !

    Alex

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: orthogonal fog ?

    Ok, but what you describe still makes me belive you use the projection matrix in the way you said you didn't use it. The abuse of the projection matrix have nothing to do with gluLookAt, but with the fact that you use ANY kind of transformation other than a projection on the projection matrix. You said you didn't use gluLookAt, but you use some kind of rotation. Are you sure this rotation isn't done in the projection matrix?

    Post some code, it usually helps alot.

    And the type of projection used doesn't matter, since fogging is calculated before the projection matrix. glOrtho shouldn't affect fogging at all.

  5. #5
    Guest

    Re: orthogonal fog ?

    I figured out now that fogging itself works
    fine. However, my object protrudes from the
    viewpoint in positive and negative z-
    direction and fogging doesn't care about the
    sign.
    So it's all about a mere translation (what
    screws up the object rotation - but I guess
    that is a different part of story now...)
    Anyway, thanks for trying to help me Bob !

    Alex

Posting Permissions

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