actually is quite a good guess Seeing clouds from above out to 150 km is a *real* problem. With the current setup, we can do 60-90 km dependent on direction (they're drawn as square tiles) if (and that's a big if) your computer can handle it. Being able to do 150 km would require to restructure the tile management code - but the numbers of objects needed to render is probably going to kill you long before.
One thing to note though is that one of the main effects of this shader is the sunrise/sunset effect near the horison. I'd feel bad to take that away by blending to some constant color...
Blending to constant below the horizon line is also not really what you want. It looks too artificial to be perceived as fog/haze. There needs to be some modulation in the angles. Currently, there's no problem above the horizon (sunrise/set looks nice there), but the region below the horizon gets colors at odds with the terrain.
The original vertex colors, that are used in the non shader version, are available in gl_FrontColor in the vertex shader. Might be possible to use the scattering shader above the horison, and below the cpu calculated old values.
Maybe I'll play with them and mix them in a bit - could work.
This is something I though should happen. I always thought that the coefficients would be calculated depending on the METAR, and the sky would then reflect the real weather, no manual editing of parameters needed.
(...)
I'm not sure if you're talking only about weather conditions, or also changing the parameters depending on altitude etc. I think the former is the correct way, and the latter is not.
That's not what METAR ever gives you. If visibility is bad, METAR reports the actual value on the ground. Say we have 2000 m. In bad visibility, I usually can't see the sky at all, either I see featureless fog above me (which the shader can't do - it doesn't grey out the zenith for any parameter) or I see distinct clouds above me and a dark horizon line reflecting the fact that the clouds filter out lots of light which doesn't reach the horizon line. Visibility will be *way* better than 2000 m once I reach above the fog/cloud layer - but METAR contains zero information how good it actually will be at what altitude. Currently we have to guess that.
If visibility is good, you can see the sky from the ground, but METAR tends to report either 10 km or 10 miles - in this case, you don't even know the real visibility on the ground, you just know that it's larger than the reported value.
I suspect that in the region where the shader is consistently working fine, say above 20.000 ft or so, to a good approximation the real weather conditions on the ground don't really matter so much for the appearance of the sky any more and the density of scatterers is largely given by altitude.
Real weather conditions are largely stuff that makes the shader fail because there's no code to handle it (non-exponential density distribution of scatterers, optically thick limit, light absorption by cloud layers...), so I'm not sure how far you get by trying to tie shader parameters to real weather.
I'd like to see a model which would simulate clear sky, fog, rain and smoke for example, to allow for very different looking skies with just few parameters which are easily figured from METAR. And the same model should be applied to both terrain and sky, and it would give consistent and good looking results... I guess this model with added support for low visibility (and maybe layered fog?) would be a good start.
Agreed - it would be terrific to get it. But... how?
What's missing is:
* scattering equations for optically thick media (light diffusion)
* blending between optically thick and optically thin solution
* cross talk with weather system to get light absorption by cloud layers right
* support for non-exponential distribution of Rayleigh and Mie scatterers independently
and all running at decent framerate... That's a lot of math, but it can be done. But in the general case, that's multiple nested integrals without an analytical approximation, and that's not going to be fast.