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

• 12-31-2017, 11:48 AM
c4ooo123
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:
https://i.imgur.com/58D0evd.png
(Ignore the terrain please :p )

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.)
• 12-31-2017, 05:10 PM
Dark Photon
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.
• 12-31-2017, 05:32 PM
c4ooo123
Quote:

Originally Posted by Dark Photon
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:
https://i.imgur.com/sk4UbsJ.png
And the horizon moves around the skybox:
https://i.imgur.com/qdOMmr7.png
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.