Graphics Reference
In-Depth Information
lighting for a regular surface, we automatically support all light features we have,
such as shadow mapping, fall-off ranges, textures to define the light's color, etc.
To improve rendering performance, we disabled all shadow filtering features. We
found that taking a simple point sample from the shadow map for each ray-march
step is sucient to create good looking results so we save a lot of GPU cycles by
not doing any advanced shadow filtering.
The lit sample color will be scaled by the ray-march step size and by the
scattering factor, which determines the intensity of the volumetric light. In Sec-
tion 3.2.3 we will describe how the scattering factor is calculated. Finally, all
ray-march samples are added together, and the effect is rendered additively to
the scene.
3.2.1 Omni-lights and Spotlights
In the volumetric light shader for omni- and spotlights, we start by defining a
ray that travels from the camera position to the world position of the pixel on
the screen (Figure 3.2(a)). The world position is calculated by taking the pixel's
depth value from the depth buffer and projecting it back to world space using
the inversed view-projection matrix. The next step is to find the intersection
points of where the ray enters and exists the sphere or cone. Based on these
intersection points a line segment is defined that represents the segment that
travels through the light's volume (Figure 3.2(b)). The volumetric light shader
will take multiple samples across this line segment to render the volumetric light
effect (Figure 3.2(c)). We render the omni- and spotlight shapes with depth-test
enabled to make sure that pixels that are occluded by the scene's geometry will be
discarded. Figure 3.3 shows an example scene of a volumetric point light placed
within a shadow-casting sphere with holes. This example scene will be used as a
reference throughout.
(a)
(b)
(c)
Figure 3.2. (a) Initial rays for omni-light. (b) Line segments after light volume intersection test. (c) Ray-
march samples.
Search WWH ::




Custom Search