Graphics Reference
In-Depth Information
D A P C . xy = D A P . xy + D P C . xy ;
// Compute optical depth for Rayleigh and Mie particles
T R . xyz = D A P C . x ￿ β R . xyz ;
T M . xyz = D A P C . y ￿ β e M . xyz ;
// Compute extinction for the current integration point
E R + M . rgb = e ( T R .xyz+ T M .xyz) ;
// Compute d i f f e re n t i a l amounts of in scattering
dL Rlgh . rgb = ρ RM . x ￿ β R . rgb ￿ E R + M . rgb ￿ ds ;
dL Mie . rgb = ρ RM . y ￿ β s M . rgb ￿ E R + M . rgb ￿ ds ;
// Compute visibility V
// Update Rayleigh and Mie integrals
L Rlgh . rgb += dL Rlgh . rgb ￿ V ;
L Mie . rgb += dL Mie . rgb
V ;
}
// Apply Rayleigh and Mie phase functions
cosθ =(
v,l ); // v is the view direction
ApplyPhaseFunctions ( L Rlgh . xyz , L Mie . xyz , cosθ );
// Compute in
scattering and extinction from the camera
L In . rgb =( L Rlgh . rgb + L Mie . rgb ) ￿ L Sun ;
Ext . rgb = e ( D P C .x β R .xyz + D P C .y β e M .xyz) ;
Listing 2.1. Numerical integration of the in-scattering integral.
2.6 Epipolar Sampling
Although the integration procedure presented in Section 2.5 is much faster than
the straightforward numerical integration of equation (2.2), it is still too expensive
to perform it for every screen pixel at real-time frame rates. The number of
computations can be dramatically reduced with epipolar sampling, which smartly
distributes expensive ray marching samples along the epipolar lines on the screen.
We perform sample generation using the method described in Engelhardt and
Dachsbacher's paper [Engelhardt and Dachsbacher 10] with some improvements.
Epipolar lines are obtained by connecting the light source projected position with
a user-defined number of points equidistantly placed along the border of the screen
(Figure 2.3). Note that border coordinates should correspond to the centers of the
outermost pixels, which are biased by 0.5 pixel size inward. In projection space,
this defines the following rectangle: [
1+1 /W, 1
1 /W ]
×
[
1+1 /H, 1
1 /H ],
where W and H are width and height of the viewport.
If the sun is on the screen, the entry point for each line is its position (Fig-
ure 2.3, left). If the sun is outside the screen, the entry point for each line
is placed at the intersection of the line with the screen boundary (Figure 2.3,
right). Lines that are completely behind the screen (shown in gray in Figure 2.3,
right) are invalid and discarded from further processing. Then, a predefined num-
Search WWH ::




Custom Search