Real-Time Global Illumination with LPV in DirectX 11

Light Propagation Volumes (LPV) approximate real-time global illumination by simulating the behavior of indirect light transfer on a discrete 3D spatial grid. Introduced by Crytek and optimized for modern graphics pipelines like DirectX 11, the technique bypasses expensive ray tracing by converting surface reflections into virtual point lights, injecting them into a volumetric grid, propagating the radiance to neighboring cells using spherical harmonics, and finally sampling the grid during scene shading. This enables dynamic indirect lighting effects, such as color bleeding, with fixed memory overhead and predictable runtime performance.

1. Generating Secondary Light Sources via Reflective Shadow Maps

The pipeline begins with the generation of Virtual Point Lights (VPLs). Instead of tracing secondary rays through the scene, the direct light sources render standard Reflective Shadow Maps (RSMs). In DirectX 11, this is achieved by writing out multiple render targets from the light's point of view:

  • Depth/World Position: The spatial location where the direct light hits.
  • Surface Normals: The orientation of the illuminated surfaces.
  • Flux (Color and Intensity): The reflected direct irradiance, determined by the material's albedo and incoming light intensity.

Each pixel in the RSM represents a VPL capable of bouncing secondary light back into the surrounding environment.

2. VPL Injection into the 3D Grid

The scene is enclosed in a low-resolution regular 3D texture grid (often \(32^3\) or \(64^3\) cells). The VPLs extracted from the RSM are mapped into corresponding voxel cells within this volume.

Because light radiates in specific directions rather than uniformly in all directions, directional radiance must be stored compactly within each voxel. LPV achieves this using low-order Spherical Harmonics (typically 2-band, utilizing 4 coefficients per RGB channel). In DirectX 11, this data is packed into multiple 3D textures (Texture3D or RWTexture3D with four channels per texture, such as DXGI_FORMAT_R16G16B16A16_FLOAT).

During injection, compute shaders read the VPL data, calculate the spherical harmonic projection based on the VPL's normal and flux, and accumulate the result into the corresponding cell's SH coefficients.

3. Iterative Radiance Propagation

Once injected, light must travel throughout the grid to illuminate neighboring space. This is executed through an iterative propagation algorithm using DirectX 11 Compute Shaders:

  1. Ping-Pong Texturing: Two sets of 3D textures alternate between reading and writing to maintain thread safety during dispatch.
  2. Neighbor Transfer: For each cell, the compute shader gathers radiance from adjacent neighbors (usually 6 face-adjacent or 26 fully adjacent cells).
  3. Solid Angle Projection: The radiance moving from cell \(A\) to cell \(B\) is calculated based on the solid angle subtended by the target cell face. The incoming directional distribution is re-projected onto the spherical harmonics basis and accumulated.
  4. Iterations: This propagation step is executed iteratively (typically 4 to 8 times). Each iteration spreads the light one voxel unit further, simulating the scattering of indirect light over distance.

4. Geometry Volumes for Light Bleeding Prevention

A common limitation of grid-based radiance transfer is "light bleeding," where light passes through thin geometry. To mitigate this, a secondary Geometry Volume (GV) is injected with blocking surfaces, typically derived from depth maps or voxelized meshes.

The GV stores normal vectors and surface blocking factors. During the propagation compute pass, the shader checks the GV between adjacent cells. If an opposing surface normal exists, the propagation of light in that direction is attenuated or completely blocked.

5. Final Sampling and Shading

During the final rendering pass (either forward or deferred), the main camera renders the scene. When evaluating the lighting equation in the pixel shader:

  1. The pixel's world-space position is converted into the LPV's normalized 3D texture coordinates.
  2. The 3D texture is sampled using hardware-accelerated trilinear interpolation, producing smoothly blended spherical harmonic coefficients for that point in space.
  3. The pixel's surface normal is projected onto the spherical harmonics basis.
  4. A dot product between the sampled radiance coefficients and the normal's projection produces the final indirect irradiance value.
  5. This value is multiplied by the material’s diffuse albedo and added to the direct illumination term.

By executing these phases entirely on the GPU using Compute Shaders and 3D textures, DirectX 11 handles fully dynamic geometry and lights without requiring precomputed lightmaps or complex data structures.