Graphics Reference
In-Depth Information
the next coarser level l + 1 can be performed when the sample index is divisible
by 2 l +1 . Transitions to the finer levels are done when a section is neither fully lit
nor shadowed. We incorporate min/max tree traversal into the base procedure
(presented in Listing 2.1). The optimized algorithm keeps track of the current
min/max level l , increasing or decreasing it as necessary. When Rayleigh and
Mie in-scattering integrals are updated, current section length ds is scaled by a
factor of 2 l . Section 2.8 shows the shader code for the optimized algorithm.
Strictly speaking, computing the scattering contribution from a single ray
section having a length of 2 l
ds samples does not yield the same result as stepping
through all the samples because the integral is nonlinear. For a point light source,
we solved this problem by pre-computing the in-scattering integral and storing it
in a 2D lookup table [Yusov 13]. An air-light integral for outdoor light scattering
requires a 4D lookup table as shown in [Bruneton and Neyret 08] to be pre-
computed. Performing lookups into this table at each step would be prohibitively
expensive as the table has nonlinear parameterization. The manual interpolation
for the fourth coordinate is necessary (in their work, the authors estimate the
total lit length and then only perform two lookups in the table assuming lit
section starts at the camera). Fortunately, integrand function varies slowly, thus
even stair-step integration yields quite accurate results. We also attempted to
use trapezoidal integration, but did not observe any notable quality improvement
while performance plummeted. Note that in contrast to computation of the coarse
in-scattering integral, which is done using only seven steps, many more steps are
performed during the actual ray marching.
·
2.8 Implementation
We used DirectX 11 to implement our algorithm. The full source code can
be found in the topic's supplemental materials. It is also available on Intel
Developer Zone (http://software.intel.com/en-us/blogs/2013/09/19/otdoor-light
-scattering-sample-update) and GitHub (https://github.com/GameTechDev/
OutdoorLightScattering). Some important implementation details follow.
2.8.1 Algorithm Workflow
The algorithm goes through the following steps:
1. Render the camera-space z coordinate to a screen-size texture tex2DCam
SpaceZ ( W Scr ×
H Scr ,R 32 F ) by inverting the depths from the depth buffer
tex2DDepthBuffer ( W Scr ×
H Scr ,D 32 F ).
2. Compute the screen-space coordinates of the end points of each epipo-
lar line (Section 2.6) and render them to a N Slices ×
1 auxiliary texture
tex2DSliceEndPoints ( RGBA 32 F ).
Search WWH ::




Custom Search