ReSTIR DI: shadowed direct lighting from every local light, projector and emissive surface (RT tier) #869

Open
opened 2026-10-19 14:16:32 +00:00 by sky_line · 0 comments
Owner

Child of the RT GI epic #87. Replaces the per-pixel sum over unshadowed local lights with resampled direct lighting: each pixel picks its most important light sample(s) from all lights via reservoir resampling (RIS), reuses picks temporally and spatially, and traces one visibility ray on the final sample. Cost stays roughly flat in light count (~1-2 shadow rays/pixel), and every light gets a shadow.

Ray-tracing tier only. Cards without ray query keep today's tiled lighting, the projector shadow-map atlas and #439's cube-map fallback.

Pipeline change

Today: clean_deferred_light.comp culls <= 256 lights per 16x16 tile and each pixel sums its tile's lights unshadowed; up to 4 RT projectors per pixel come from the shadow-mask slots (clean_rt_shadow_mask.comp -> uRawProj) and the shadow denoiser.

New chain after the G-buffer (RT tier):

  1. Candidates: RIS over the tile / light-grid list (lights, projectors, later emissive triangles), target = unshadowed contribution incl. BRDF, falloff, projector frustum + gobo.
  2. Temporal reuse with motion vectors (reject on disocclusion, normal/depth change, light moved/changed).
  3. Spatial reuse (a few neighbours, geometry-aware).
  4. Visibility: one ray query on the chosen sample (alpha-tested + translucent casters as the shadow path does; light's own linkset excluded; sample point jittered over the light's size for soft shadows).
  5. Shade + denoise: demodulated diffuse / specular into the diffuse/specular denoiser (#85 phase 2); the lit pass reads the result instead of looping local lights.

The sun stays on its existing RT mask path. The tile lists / froxel grid stay: they are the candidate source here and still serve forward alpha, particles, water, volumetrics and probe captures.

Staging: ship plain RIS + world light grid + denoiser first (published results show ~2x cheaper than full ReSTIR for a small quality loss), then add temporal/spatial reuse.

What it replaces (RT tier)

  • The 4-shadowed-projectors-per-pixel cap and the projector mask slots: projectors become ordinary candidates.
  • #439's ray-traced path (top-N shadowed point lights): all point lights shadowed. #439's cube-map fallback stays for non-RT cards; #439's RT path is the stopgap until this lands.
  • The 256-light / per-cluster caps for shading on this tier.
  • Direct emissive lighting for #91 (emissive triangles join the candidate set; #91 child 3).
  • Hit lighting for RT reflections (#860) and GI rays (#87): the same world light grid + RIS instead of looping all lights at hit points.

Must preserve (SL content)

  • LL light model quirks: projector gobo textures, projector ambiance, legacy shiny projector reflection, falloff curves. Either part of the target function or kept as deterministic terms beside the resampled one -- projector-lit builds must not change look.
  • Lights inside their own object (bulb in a lampshade), attached lights / facelights shadowing their wearer (#439 hazards apply), fill lights placed behind walls (expected to go dark with shadows on; release note + toggle).

Risks

  • Needs the diffuse/specular denoiser (#85 phase 2); without it the result is noisier than today's exact sum.
  • Stochastic, not bit-identical frame to frame; fast-moving or flickering lights need robust temporal rejection to avoid ghosting.

Settings / acceptance

  • RenderVKReSTIRDI (Off / RIS / Full reuse), RT tier only; GPU timers per pass.
  • A club scene with 100+ local lights: every light shadowed, cost within ~1-2 ms at render scale 0.67 on a 4070-class card, no visible ghosting on moving lights.
  • Projector-lit test builds visually match today's look apart from the added shadows.

Depends on: #85 (diffuse/specular denoiser), RT foundation (done), temporal pipeline (#84, done). Size: L (roadmap P7, 4-6 pw).

Child of the RT GI epic #87. Replaces the per-pixel sum over unshadowed local lights with **resampled direct lighting**: each pixel picks its most important light sample(s) from *all* lights via reservoir resampling (RIS), reuses picks temporally and spatially, and traces **one visibility ray** on the final sample. Cost stays roughly flat in light count (~1-2 shadow rays/pixel), and every light gets a shadow. Ray-tracing tier only. Cards without ray query keep today's tiled lighting, the projector shadow-map atlas and #439's cube-map fallback. ## Pipeline change Today: `clean_deferred_light.comp` culls <= 256 lights per 16x16 tile and each pixel sums its tile's lights unshadowed; up to 4 RT projectors per pixel come from the shadow-mask slots (`clean_rt_shadow_mask.comp` -> `uRawProj`) and the shadow denoiser. New chain after the G-buffer (RT tier): 1. **Candidates:** RIS over the tile / light-grid list (lights, projectors, later emissive triangles), target = unshadowed contribution incl. BRDF, falloff, projector frustum + gobo. 2. **Temporal reuse** with motion vectors (reject on disocclusion, normal/depth change, light moved/changed). 3. **Spatial reuse** (a few neighbours, geometry-aware). 4. **Visibility:** one ray query on the chosen sample (alpha-tested + translucent casters as the shadow path does; light's own linkset excluded; sample point jittered over the light's size for soft shadows). 5. **Shade + denoise:** demodulated diffuse / specular into the diffuse/specular denoiser (#85 phase 2); the lit pass reads the result instead of looping local lights. The sun stays on its existing RT mask path. The tile lists / froxel grid stay: they are the candidate source here and still serve forward alpha, particles, water, volumetrics and probe captures. **Staging:** ship plain RIS + world light grid + denoiser first (published results show ~2x cheaper than full ReSTIR for a small quality loss), then add temporal/spatial reuse. ## What it replaces (RT tier) - The 4-shadowed-projectors-per-pixel cap and the projector mask slots: projectors become ordinary candidates. - **#439's ray-traced path** (top-N shadowed point lights): all point lights shadowed. #439's cube-map fallback stays for non-RT cards; #439's RT path is the stopgap until this lands. - The 256-light / per-cluster caps for shading on this tier. - Direct emissive lighting for **#91** (emissive triangles join the candidate set; #91 child 3). - Hit lighting for RT reflections (**#860**) and GI rays (**#87**): the same world light grid + RIS instead of looping all lights at hit points. ## Must preserve (SL content) - LL light model quirks: projector gobo textures, projector ambiance, legacy shiny projector reflection, falloff curves. Either part of the target function or kept as deterministic terms beside the resampled one -- projector-lit builds must not change look. - Lights inside their own object (bulb in a lampshade), attached lights / facelights shadowing their wearer (#439 hazards apply), fill lights placed behind walls (expected to go dark with shadows on; release note + toggle). ## Risks - Needs the diffuse/specular denoiser (#85 phase 2); without it the result is noisier than today's exact sum. - Stochastic, not bit-identical frame to frame; fast-moving or flickering lights need robust temporal rejection to avoid ghosting. ## Settings / acceptance - `RenderVKReSTIRDI` (Off / RIS / Full reuse), RT tier only; GPU timers per pass. - A club scene with 100+ local lights: every light shadowed, cost within ~1-2 ms at render scale 0.67 on a 4070-class card, no visible ghosting on moving lights. - Projector-lit test builds visually match today's look apart from the added shadows. **Depends on:** #85 (diffuse/specular denoiser), RT foundation (done), temporal pipeline (#84, done). **Size:** L (roadmap P7, 4-6 pw).
sky_line added this to the Slipstream project 2026-10-19 14:16:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream#869
No description provided.