Work in progress
Chronological
- First useful output
- White if the ray only hits the atmosphere, blue if it also hits in inner planet sphere
- Atmosphere greyscale intensity is proportional to linear distance ray travels through atmosphere without striking planet, black = little distance, white = furthest distance
- No big change but the Earth and atmosphere are now using real values from Wikipedia. Camera moved back to fit Earth in the image.
- Rotate the Earth around it's vertical axis
- Add directional sunlight (white light)
- Visualize optical length
- Rayleigh extinction term. Note how the extinction is wavelength dependent, red is absorbed the least, then green and finally blue. The absorption amount is proportional to optical length giving the ice cap the red tinge at the edge of the sphere because the light travels further and through thicker atmosphere (greater optical length).
- Fixed a couple of flipped orientation bugs. Camera vertical axis was flipped but this wasn't visible because the UV coordinate system on the sphere was also flipped vertically and the planet was at Y=0. The UV coordinate system was also flipped horizontally which is visible (look at Continental US).
- First plausible pass at Rayleigh in-scattering. It is using the wrong coefficients and has at least one simplification but it looks pretty.
Despite many available sources on simulating atmospheric scattering, one of the challenges I have encountered has been cross referencing sources. Everyone has their own coefficients or alterations to equations.
I derived Rayleigh scattering extinction factors that match Hoffman and Preetham's using their wavelengths for Red, Green and Blue light
R, G, B = [650, 570, 475]nm = [650, 570, 475]*10e-9
R = ((8*pi^3(1.0003^2-1)^2)/(3*2.545e25*(650e-9)^4))*((6+3*0.035)/(6-7*0.035)) = 6.95265 * 10^-6
G = ((8*pi^3(1.0003^2-1)^2)/(3*2.545e25*(570e-9)^4))*((6+3*0.035)/(6-7*0.035)) = 1.17572 * 10^-5
B = ((8*pi^3(1.0003^2-1)^2)/(3*2.545e25*(475e-9)^4))*((6+3*0.035)/(6-7*0.035)) = 2.43797 * 10^-5
Blue wavelength at Wolfram
Nishita and O'Neil both use the Henyey-Greenstein phase function for scattering, equation 5 in the paper. If you set the asymmetry factor, g, to 0 then you get the 3/16π(1 + cos^2(theta))
equation from several papers (some of them did not include the 1/4π
normalization factor).
- O'Neil Accurate Atmospheric Scattering GPU Gems 2
- Preetham A Practical Analytic Model for Daylight
- Nishita Display of The Earth Taking into Account Atmospheric Scattering
- Bruneton Precomputed Atmospheric Scattering
- Bruneton published the source code for an implementation of his paper
- http://glslsandbox.com/diff#40398.1-vs-40429.0