RT sun shadows: cache static shadow results, re-trace only where something changed #771

Open
opened 2026-10-15 01:09:38 +00:00 by sky_line · 0 comments
Owner

RT sun/moon shadows (RenderVKSunShadows 2) trace every mask pixel every frame (rtMaskStage: trace c_rtmask + temporal + spatial denoise, full-screen dispatch). The denoiser history is accumulation (1 spp + temporal), not caching: nothing is skipped when receivers, casters and the sun are unchanged. RT shadows measured ~2.7 ms of frame time at a busy spot (4K, RTX 5090).

Today the only ray-saving option is RenderVKRTShadowHint (default off): it stops early where history is uniformly lit/blocked, but locks stale values at moving penumbra edges and biases the denoiser clamp.

Goal: only re-trace where something changed

  • Static/dynamic caster split for the mask: pixels whose shadow can only be affected by static geometry, with an unchanged sun, keep their accumulated value; re-trace where a dynamic caster (avatars, animesh, movers, particles; existing moving-caster flag clean_rt_moving_caster.glsl, rt_block_dyn) could shadow them, where the instance store reports static changes (gVKChangedSpheres / overflow), and on disocclusion / reprojection failure.
  • Sun drift: progressive refresh (a budgeted slice of cached pixels/tiles per frame) instead of a full re-trace, gated by the existing sun-move signal (rtMaskPushFill sun_move bits) and a texel/angle threshold.
  • Tile granularity (e.g. 8x8/16x16 mask tiles) with GPU-built work lists and indirect dispatch (no CPU readback).
  • Safety refresh (periodic full re-trace of every tile over N frames).
  • Keep the denoiser correct (history validity per pixel), contact shadows, projector RT shadows (same treatment or explicitly excluded first), and #768 edge refinement compatibility.
  • Live setting(s) to A/B; log traced vs reused tiles/pixels and GPU ms.
RT sun/moon shadows (`RenderVKSunShadows` 2) trace every mask pixel every frame (`rtMaskStage`: trace `c_rtmask` + temporal + spatial denoise, full-screen dispatch). The denoiser history is accumulation (1 spp + temporal), not caching: nothing is skipped when receivers, casters and the sun are unchanged. RT shadows measured ~2.7 ms of frame time at a busy spot (4K, RTX 5090). Today the only ray-saving option is `RenderVKRTShadowHint` (default off): it stops early where history is uniformly lit/blocked, but locks stale values at moving penumbra edges and biases the denoiser clamp. ## Goal: only re-trace where something changed - Static/dynamic caster split for the mask: pixels whose shadow can only be affected by static geometry, with an unchanged sun, keep their accumulated value; re-trace where a dynamic caster (avatars, animesh, movers, particles; existing moving-caster flag `clean_rt_moving_caster.glsl`, `rt_block_dyn`) could shadow them, where the instance store reports static changes (`gVKChangedSpheres` / overflow), and on disocclusion / reprojection failure. - Sun drift: progressive refresh (a budgeted slice of cached pixels/tiles per frame) instead of a full re-trace, gated by the existing sun-move signal (`rtMaskPushFill` sun_move bits) and a texel/angle threshold. - Tile granularity (e.g. 8x8/16x16 mask tiles) with GPU-built work lists and indirect dispatch (no CPU readback). - Safety refresh (periodic full re-trace of every tile over N frames). - Keep the denoiser correct (history validity per pixel), contact shadows, projector RT shadows (same treatment or explicitly excluded first), and #768 edge refinement compatibility. - Live setting(s) to A/B; log traced vs reused tiles/pixels and GPU ms.
sky_line added this to the Slipstream project 2026-10-15 01:09:38 +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#771
No description provided.