Graphics Reference
In-Depth Information
Rayleigh and Mie particle densities up to the top of the atmosphere. With the
help of this lookup table, optical depth to the top of the atmosphere T ( A
P )
can be computed as follows:
T A→P = β R .xyz
D [ h, cos( ϕ )].x + β e M .xyz
D [ h, cos( ϕ )].y .
If the ray hits the Earth, the corresponding table entry should contain a large
number to account for occlusion. To eliminate interpolation artifacts, in our
practical implementation we avoid discontinuities in the table by allowing the
altitude to become negative. This provides fast but continuous growth of the
total particle density.
We also tried using the analytical expression based on an approximation to
the Chapman function as proposed by Schuler [Schuler 12]. However, we found
that it is quite complex and the lookup table works significantly faster.
Optical depth T ( P
C ) is computed by maintaining net particle densities
from the camera to the current point during the numerical integration process.
Finally, we can observe that angle θ does not vary across the ray, and both
phase functions p R ( θ )and p M ( θ ) can be evaluated outside the integral. To im-
plement this, we integrate Rayleigh and Mie in-scattering separately and apply
corresponding phase functions at the end. Pseudo-shader for the numerical inte-
gration procedure is given in Listing 2.1.
// Compute integration step
dP . xyz =( O . xyz C . xyz )/ N Steps ;
ds = || dP|| ;
// Initialize integration variables
D P C . xy =0; // Net density from camera to integration point
L Rlgh . rgb =0; // Rayleigh in scattering
L Mie . rgb =0; // Mie in scattering
for ( float s =0.5 f ; s<N Steps ; s += 1 . f )
{
// Compute position of the current point
P . xyz = C . xyz + dP . xyz ￿ s ;
// Compute altitude and normal to the Earth surface
h =
R Earth ;
N Earth . xyz =( P .xyz C Earth .xyz) /|| P .xyz C Earth .xyz || ;
// Compute Rayleigh and Mie particle density scale at P
ρ RM . xy = e h/H RM .xy ;
// Compute cos( ϕ ) and look up for the net particle
// density from P to the top of the atmosphere
cosϕ =( N Earth , −
|| P C Earth || −
l ); // l is the light direction
D A P . xy = D [ h, cosϕ ];
// Accumulate net particle density from the camera
D P C . xy += ρ RM . xy ￿ ds ;
// Compute total particle density from the top of the
// atmosphere through the integration point to camera
Search WWH ::




Custom Search