Precomputed Atmospheric Scattering
2.1. Physical model
The physical model commonly used in CG is a clear sky model based on two constituents, air molecules and aerosol particles, in a thin spherical layer of decreasing density between $R_g = 6360 km$ and $R_t = 6420 km$
At each point, the proportion of light that is scattered $\theta$ degrees away from its incident direction is given by the product of a scattering coefficient $\beta^s$ and of a phase function $P$. $\beta^s$ depends on the particle density and P describes the angular dependency. For air molecules $\beta^s$ and $P$ are given by the Rayleigh theory.
${\large{\displaystyle \beta^s_R(h, \lambda) = \frac{8\pi(n^2 - 1)^2}{3N\lambda^4}e^{-\frac{h}{H_R}}}}$ (1)
${\large{\displaystyle P_R(\mu) = \frac{3}{16\pi}(1 + \mu^2)}}$where $\mu = cos\theta$(2)
- where $h = r - R_g$ is altitude
- $\lambda$ the wavelength
- $n$ is index of refraction of air
- $N$ the molecular density at sea level $R_g$
- and $H_R = 8km$ is the thickness of the atmopshere if its density where uniform.
we use $\beta^s_R = (5.8, 13.5, 33.1) * 10^{-6}m^{-1}$ for $\lambda = (680, 550, 440) nm$
Aerosols also have an exponentially decreasing density with a smaller heigth scale $H_M \backsimeq 1.2km$. There phase function is giving by the Mie theory, approximated with the Cornette Shank phase function:
${\large{\displaystyle \beta^s_M(h, \lambda) = \beta^s_M(0, \lambda)e^{-\frac{h}{H_M}}}}$ (3)
${\large{\displaystyle P_M(\mu) = \frac{3}{8\pi}\frac{(1 - g^2)(1 + \mu^2)}{2+g^2(1 + g^2 - 2g\mu)^{3/2}}}}$ (4)
Unline air molecules, aerosols absorb a fraction of the incident light. It is measured with an absorption coefficient $\beta^a_M$ which gives the extinction coefficient $\beta^e_R = \beta^s_M + \beta^a_M$
2.2. Rendering equation
We recall here the rendering equation in a participating medium, applied to the atmosphere. We note $L(x, v, s)$ the radiance of light reaching $x$ from direction $v$ when the sun is in the direction $s$, and $\mathbf{x}_o(\mathbf{x}, \mathbf{v})$ the extremity of the ray $\mathbf{x} + t\mathbf{v}$. Note that $\mathbf{x}_o$ is either on the ground or on the top of the atmosphere boundary $r = R_t$. The transmitttance $T$ between $\mathbf{x}_o$ and $\mathbf{x}$, the radiance $\mathcal{I}$ of the reflected light at $\mathbf{x}_o$, and the radiance $\mathcal{J}$ of the light scattered at $\mathbf{y}$ in the direction $-\mathbf{v}$ are defined as follows:
${\large{\displaystyle T(\mathbf{x}, \mathbf{x}_o) = \exp(-\int^{x_o}_{x} \sum \beta^e_i(\mathbf{y})dy)}}$where ${i \in\{R,M\}}$ (5)
${\large{\displaystyle \mathcal{I}[L](\mathbf{x}_o), s) = \frac{\alpha(\mathbf{x}_o, \mathbf{s})}{\pi} \int_{2\pi} L(\mathbf{x}_o, \omega, \mathbf{s})\omega\cdot\mathbf{n}(\mathbf{x}_o)d\omega}}$, of $0$(6)
${\large{\displaystyle \mathcal{J}[L](\mathbf{y}, \mathbf{v}, \mathbf{s}) = \int_{4\pi} \sum \beta^s_i(\mathbf{y})P_i(\mathbf{v}\cdot\omega)L(\mathbf{y}, \mathbf{\omega}, \mathbf{s})d\omega}}$ (7)
Not that $\mathcal{I}$ is null on the top atmosphere boundary. With these notations the rendering equation is:
${\large{\displaystyle L(\mathbf{x}, \mathbf{v}, \mathbf{s}) = (L_0 + \mathcal{R}[L] + \mathcal{S}[L])(\mathbf{x}, \mathbf{v}, \mathbf{s}) }}$ (8)
${\large{\displaystyle L_0(\mathbf{x}, \mathbf{v}, \mathbf{s}) = T(\mathbf{x}, \mathbf{x}_o)L_{sum} }}$, or $0$ (9)
${\large{\displaystyle \mathcal{R}[L] = T(\mathbf{x}, \mathbf{x}_o)\mathcal{I}[L](\mathbf{x}_o, \mathbf{s}) }}$ (10)
${\large{\displaystyle \mathcal{S}[L] = \int^{\mathbf{x}_0}_x T(\mathbf{x}, \mathbf{y})\mathcal{J}[L](\mathbf{y}, \mathbf{v}, \mathbf{s})dy }}$ (11)
- Where $L_0$ is the direct sunlight $L_{sun}$ attenuated before reaching $\mathbf{x}$ by $T(\mathbf{x} \mathbf{x}_o)$
- $L_0$ is null if $\mathbf{v} \neq \mathbf{s}$, or if the sun occluded by the terrain i.e., if $\mathbf{x}_o$ is on the ground.
- $\mathcal{R}[L]$ is the light reflected at $\mathbf{x}_o$ and also attenuated before reaching $\mathbf{x}$
- $\mathcal{S}[L]$ is the inscattered light, i.e., the light scattered towards $\mathbf{x}$ bewtween $\mathbf{x}$ and $\mathbf{x}_o$
Full rendering equation:
${\displaystyle T(\mathbf{x}, \mathbf{x}_o)L_{sum} + T(\mathbf{x}, \mathbf{x}_o)\frac{\alpha(\mathbf{x}_o, \mathbf{s})}{\pi} \int_{2\pi} L(\mathbf{x}_o, \omega, \mathbf{s})\omega\cdot\mathbf{n}(\mathbf{x}_o)d\omega + T(\mathbf{x}, \mathbf{x}_o)\int_{4\pi} \sum \beta^s_i(\mathbf{y})P_i(\mathbf{v}\cdot\omega)L(\mathbf{y}, \mathbf{\omega}, \mathbf{s})d\omega }$