Clustered Forward Shading and Multi-Light Atlasing in WebGPU
Overcoming traditional forward rendering limits to illuminate complex architectural interiors with hundreds of dynamic point and spot lights simultaneously.
Standard forward rendering struggles when scaling beyond a handful of dynamic light sources due to combinatorial fragment shader loops. Clustered forward shading subdivides camera frustums into a 3D grid, assigning intersecting lights efficiently via compute shaders.
1. 3D Frustum Grid Discretization
Subdividing camera view frustums into logarithmic slices along depth axes creates a 3D grid of spatial clusters that store light indices affecting specific volumetric regions.
2. Light Culling via Compute Workgroups
WGSL compute shaders test bounding spheres of hundreds of dynamic lights against frustum cluster bounds in parallel, populating global light index lists per cluster.
3. Dynamic Multi-Light Shadow Atlasing
Packing shadow map textures from multiple active light sources into a single large 2D texture atlas enables real-time shadow casting across hundreds of interior lamps without context switching overhead.