Ray-traced sun and moon shadows (RenderVKSunShadows 2) #185
Labels
No labels
amd
avatars
bug
builder
cannot-reproduce
crash
epic
feature
from-viewer
gl-removal
known-limitation
monitoring
parity
perf
platform
priority
critical
priority
high
priority
low
priority
medium
provenance
rendering
rt
status
in-progress
status
testing
status
up-next
triage
ui
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sky_line/Slipstream#185
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Ray-traced sun and moon shadows, as a third technique beside the cascaded shadow maps, the same way projector shadows got one (RenderVKProjectorShadows 2).
Why
Design (reuses the projector RT path)
traceShadowRay,RT_MASK_SHADOW, the shared candidate alpha test for mask/blend casters). Directional: target direction jittered inside a cone of the sun's angular radius (default ~0.27 deg, setting).RenderVKRTShadowSamples) + IGN noise that varies per TAA phase (asprojNoisePx); proper temporal/spatial filtering later via the RT denoiser (#85).RenderVKRTShadowBias).RenderVKSunShadows0 off / 1 cascades / 2 ray traced, switchable live; falls back to cascades without ray queries, over the RT budget (#164), or with no valid TLAS this frame. Still gated by RenderShadowDetail >= 1.Key open question: TLAS coverage
The TLAS is built from this frame's MAIN cull (candidates inside the view frustum). Sun shadows need casters OUTSIDE the frustum toward the sun (a tree behind the camera shading the ground in view). Options: extend the RT instance selection with a sun-direction swept volume (frustum extruded toward the light, like cascade caster culling), or a distance ring around the camera. Must stay inside the RT memory budget (#164) and the BLAS build budget (#157 perf).
Other passes
Done when
Sun/moon shadows with RT match cascade coverage (no missing off-screen casters), are free of acne and seams, soft edges are clean under TAA, and the frame is faster than or equal to cascades on RT hardware.
Related: #85 (denoiser), #104 (projector grain), #157 / #93 (RT build cost), #164 (RT VRAM budget).
First version pushed (96be80b097..75ca3a315c): RenderVKSunShadows 2 = ray-traced sun/moon, soft (RenderVKRTSunSoftness), 1 ray/pixel + TAA, leaf-accurate alpha test, cascades skipped. Cost vs cascades on a 5090: +2.4 ms (14.8 -> 17.2 ms). Opt-in for now. Follow-ups: #195 (optimization), #194 (opacity micromaps). Still to do here: Preferences UI option, water / probe / mirror ray-query variants (they currently take the sun unshadowed in mode 2).
Shipped: RenderVKSunShadows 2 (ray-traced sun/moon shadows) is in 96be80b097..75ca3a315c. Further optimization is tracked in #195, opacity micromaps in #194.
Reopening: closed by mistake. The technique shipped (96be80b097..75ca3a315c, in 0.12.0 Beta 10), but two items are still open and not tracked elsewhere: (1) a Preferences control, since it is only reachable via the RenderVKSunShadows debug setting today; (2) ray-traced variants for water / probe / mirror captures, which currently fall back to unshadowed or cascades. Optimization is in #195, opacity micromaps in #194.
Status check (verification sweep):
8b43904fdd, Graphics prefs: Sun/moon shadows shadow maps / ray traced) landed at 06:32Z on 09-30, after the reopen. Shipped in v0.12.0-beta.10.shadow_params.w > 1.5 ? 1.0 : sunShadow(...)). Probe and mirror captures use cascades or are unshadowed (cfef35fcc8,b1cae70f1e; rtMaskUsable() excludes probeCapture/mirrorPass).Status 2026-10-05: shipped, with a Preferences control. Left open for the remaining scope: ray-traced shadows in water glints and probe / mirror captures (currently cascades or unshadowed).
Done: ray-traced sun and moon shadows ship as RenderVKSunShadows = 2 (Preferences > Graphics > Advanced). Follow-ups live in #572 and #567.