concepts atmosphere - melowntech/vts-browser-unity-plugin GitHub Wiki
Atmosphere
Unity Atmosphere
Default Unity atmosphere works fairly well in the typical usage scenarios, but is unsuitable for planetary scale.
VTS Atmosphere
VTS atmosphere is physically based. It computes actual optical transmittance through the air, considering different densities at different altitudes.
The result is atmosphere that is believable when looked at from space as well as from city streets, and anywhere in between.
Shader
Computing the optical transmittance requires integrating the atmosphere density over the ray, which is very expensive and not well suited for GPUs. Therefore, we use a texture with precomputed values and most of the shader is just mapping the ray coordinates into the texture lookup coordinates.
The shader snippet for the atmosphere is made for easy integration into other shaders.
// define shader keyword to enable/disable the atmosphere
#pragma multi_compile __ VTS_ATMOSPHERE
// include the shader code
#include "../../atmosphere/vtsAtmShader.cginc"
// modify the color of a fragment by the atmosphere
float atmDensity = vtsAtmDensity(i.viewPos); // compute atmosphere density
o.color = vtsAtmColor(atmDensity, o.color); // apply the density to color
// these functions will be defined even if the atmosphere is disabled, and do nothing