I have a problem with the preetham sky model and putting it to good use on a fixed pipeline rendering system.
As most of you probably know, the model will also render the sun in a more or less blurred fashion, depending on turbidity and it covers the entire sky for the entire day (+ a bit into the evening).
As I am rendering this with the fixed pipeline (please don’t admonish me for that), I’d like to have a sky gradient with the sun blended in after that as a kind-of billboard (not oriented towards the camera, but perpendicular to the skydome) and the clouds projective textured onto the skydome.
To do this, I’ve made a texture with the sun position (theta_s) from the zenith(0) to beyond the horizon(pi/2 + a bit beyond) indexing the rows and the skydome vertex theta indexing the columns (from 0 at zenith to pi/2 at the horizon).
To make the sun not show I place calculate the angle gamma like this.
gamma = M_HALFPI + theta_s;
so that gamma is away from the sun. That is, the whole sky takes up gammas from 0 to pi, but I sample from a point away from the great circle crossing the sun, hopefully far enough from the sun.
Do you think this sky gradient is good enough? Is there a better way to generate one? I know I should have written either a fragment or vertex shader and it would be done sooner than a blink of the eye. But it is old school for now.