Chapter 13. Volumetric Light Scattering as a Post-Process — Kenny Mitchell
- Source: https://developer.nvidia.com/gpugems/gpugems3/part-ii-light-and-shadows/chapter-13-volumetric-light-scattering-post-process
- Volume: GPU Gems 3
- Note: add-only excerpt for wiki ingest; images omitted; prose and key listings kept.
Summary of full chapter read
Crepuscular rays / god rays as screen-space post-process. Extends Hoffman & Preetham analytic daylight scattering by attenuating sun illumination with estimated occlusion D(θ).
Core idea
Estimate occlusion by sampling along screen-space ray toward light: proportion of samples hitting emissive vs occluders. Additive radial blur of frame toward ScreenLightPos, with Weight, Decay, Density, Exposure controls. SM3 loop; older HW: multipass additive blend + stencil.
Occlusion quality
Occlusion pre-pass (black untextured occluders) → process → composite. Or stencil/alpha sky bit. Or reduce texture contrast via fog/aerial perspective.
Caveats
Shafts can appear in front of near geometry; boundary flicker when occluders exit screen (render overscan); perpendicular sun → infinite screen pos (clamp/fade). Works with translucent sources; multiple lights = successive passes.