Builtin Library
README.md
sssDiffusion
The render pass behind the SubsurfaceScattering component and the subsurface
module.
The transport it draws is a spread of exitant light across a surface, so it runs
on the frame that was just drawn. Each marked mesh is drawn into a mask carrying
its tint and radius — one draw per group of meshes sharing both. Two passes then
spread the lit colour along that mask, once across and once down; two lines
rather than a disc is what makes the reach cost twice the taps instead of their
square. A final pass mixes the result back by strength.
Weights are a Gaussian in units of each channel's own reach, and the reach is the tint: a channel the surface passes freely is the one that travels furthest, which is what carries red past the terminator while green and blue stop at it.
Taps are confined to the mask and to a depth tolerance, so light spreads across one surface and stops at its silhouette rather than dragging the background into it. The radius is world-space, converted to a pixel span from each pixel's own depth, so a surface keeps the same softness as the camera moves toward it.
Depth and camera come from the render target being drawn, so the pass is correct in offscreen captures and RTT cameras at their own resolutions.