Implementing Ray-Traced Soft Shadows (RTSS) in WebGPU Viewports
Simulating physically accurate area light penumbras and soft contact shadows using ray intersection queries and Monte Carlo sampling in WGSL.
Traditional shadow maps suffer from pixelation and fixed filter widths. WebGPU ray tracing enables true Ray-Traced Soft Shadows (RTSS) that expand penumbra widths realistically as the distance between occluders and shadow receivers increases.
1. Area Light Sampling & Shadow Ray Dispatches
Evaluating rectangular or spherical area lights requires casting stochastic shadow rays toward random points distributed across light source surfaces, accumulating visibility factors per pixel.
2. BLAS / TLAS Acceleration for Fast Intersection
Traversing Bottom-Level and Top-Level Acceleration Structures in WGSL compute shaders allows ray queries to test scene geometry boundaries instantly without evaluating every polygon manually.
3. Spatial Denoising & Temporal Accumulation
Low sample-count Monte Carlo shadow rays introduce grain noise. Applying spatial-temporal filter passes smooths soft shadows across frames while preserving sharp contact boundaries near occluders.