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

Thread: Horizon rotates around skybox, while sun halo stay in place.

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2017
    Posts
    10

    Horizon rotates around skybox, while sun halo stay in place.

    I am trying to render a skybox in openGL using the code found here: http://csc.lsu.edu/~kooima/misc/cs594/final/part2.html
    However, the "horizon" color moves around, while the halo around the sun stays in place, as illustrated in this picture:

    (Ignore the terrain please )

    I have copied the code exactly, except replaced the vertex shader code to use more modern openGL. How could i solve this problem?

    (So the actual fragment colors are correct relative to the time of day, just the places they are wrong.)
    Last edited by c4ooo123; 12-31-2017 at 10:54 AM.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,327
    Read up on Viewing Transformations in the OpenGL Programming Guide (or other source). In particular, get to know what OBJECT SPACE, WORLD SPACE, and EYE SPACE are, and the role of the MODELING and VIEWING transformations in moving between these spaces.

    Short answer: you want to position your skybox in WORLD space, not EYE SPACE.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2017
    Posts
    10
    Quote Originally Posted by Dark Photon View Post
    Read up on Viewing Transformations in the OpenGL Programming Guide (or other source). In particular, get to know what OBJECT SPACE, WORLD SPACE, and EYE SPACE are, and the role of the MODELING and VIEWING transformations in moving between these spaces.

    Short answer: you want to position your skybox in WORLD space, not EYE SPACE.
    Thats not the problem, i specifically sent the view matrix to the shader so i could fly around and take pictures from different angles.
    The problem is that the sun halo always renders at the top of top of the skybox, regardless of sun position, as seen here:

    And the horizon moves around the skybox:

    In the above image the sun is setting, so the red glow is correct, but it should not be in the middle of the sky, but on the horizon.

Posting Permissions

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