I’m in the process of upgrading my Earth / Blue Marble project and want to implement a much more accurate atmospheric scattering model. In my implementation, it’s possible for the Camera to be both above and below the atmosphere (usually though, above).
My current implementation is super-simple, it’s an inverted-poly sphere slightly larger than the Earth, and uses a 1D-Texture to map colours to the atmosphere based on the Dot product of the Sunlight Vector. The effect is then pushed out to the edges and softened at the edges to give the haziness and falloff. It’s fairly cheap (and also has very little overdraw), but it doesn’t hold up at glancing angles in the way that I want it do.
I’m currently working the Rayleigh side of the GPU Gems Implementation and have the ‘Intensity’ worked out (judging by the image below), but now I’m getting lost in a haze of mathematics when it comes to sampling, and also seems to require some kind of look-up texture in order to work properly based on those samples. I know there is an Atmosphere Scattering system that implements both models coming to Marketplace (which I will get regardless of whether I do this or not), but honestly I’d quite like to learn how to do it myself before grabbing that one and having a look at it. Here’s where I’m at with the Rayleigh scattering. (Note: ArcCos is a tiny bit of HLSL). If anybody can help point me in the right direction, feel free