How Luminance Works #
Luminance is a single ScriptableRendererFeature that injects several render passes.
By default it runs after the skybox so it can reflect opaque geometry and the
rendered sky. The passes, in order:
- Smoothness prepass - writes each pixel's metallic and smoothness into a small buffer the trace and composite read for roughness-based blur and Fresnel.
- Hi-Z depth pyramid - copies scene depth into mip 0 (as forward depth, 0 = near), then builds a min-reduction mip chain. Rays read coarse mips to leap over empty space and refine as they approach a surface, turning a linear march into a logarithmic one.
- Back-face depth prepass(optional) - renders front-face-culled geometry to
capture the nearest back-face depth. Combined with camera depth this gives true per-pixel object
thickness, so a ray that passes behind a thin object is rejected instead of
falsely hitting its front. When disabled, a constant
Thicknessis used instead. - SSR trace - for each reflective pixel, reflects the view ray about the surface normal and marches it through the Hi-Z pyramid in screen space. On a hit it writes the reflected scene color premultiplied by a confidence value (confidence in alpha) into a reflection buffer, then builds a mip chain of that buffer.
- Composite & gap fill - walks the reflection mip pyramid from fine to coarse, taking confidence-weighted reflection to fill occlusion gaps, keeps the sharp full-res reflection where the ray hit directly, applies Fresnel/roughness weighting, and blends the result onto the scene color.
Reversed-Z & coordinate handling
All depth is normalized to a forward convention (0 = near, 1 = far) internally, with
UNITY_REVERSED_Z handled in the copy and back-face passes, so the asset behaves
consistently across graphics APIs. The trace works in view space using the camera's GPU projection
matrix.
Why "premultiplied confidence"?
Writing reflection.rgb × confidence with confidence in alpha lets the gap-fill
pass average reflections correctly across mip levels: a simple weighted sum divided by accumulated
confidence reconstructs clean color while ignoring empty (zero-confidence) pixels.