Alex Dunn - Volumetric Lighting

This is something I made during my spare time. A simple demo showcasing a shader based volumetric lighting example with shadowing. The shader uses features from shader model 3.0 and is rendered using a screen aligned, plane volume technique.

The initial geometry is built up of quads stacked inside a unit cube, in the vertex shader the volume is scaled to match the bounds of the spotlight cone and orientated so that each quad in the stack is aligned to the screen. The pixel shader uses projection mapping to texture the quad stack with a light cookie (which can be multi coloured) and the shadow buffer which comes from a second camera rendered from the perspective of the spotlight. The final effect is composited onto the screen using blending and a blur pass to remove any aliasing artifacts.

The advantage of the method I have implemented, over other techniques, screen-space radial blurring and volume shell, is that it can be used with spotlights, and wont produce artifacts when the main camera enters the light volume, respectively.