Skip to content

Ambient: keep the traced diffuse light in a band while ray tracing runs (VICTORY_AMBIENT_RT, off by default) - #1592

Open
JCreecher wants to merge 3 commits into
trustno1-coder:mainfrom
JCreecher:rt/ambient-band-v2
Open

JCreecher wants to merge 3 commits into
trustno1-coder:mainfrom
JCreecher:rt/ambient-band-v2

Conversation

@JCreecher

@JCreecher JCreecher commented Nov 28, 2026 •

Copy link
Copy Markdown

No issue tracks this. With the title's ray tracing on, the traced diffuse light can go black or swing while the
structures the rays walk are partly wrong (docs/findings.md, RTX 5080: "blown-out light and black patches").

What it changes

With ray tracing on (VICTORY_BVH_BUILDER=1), the stand-in for the indirect light turns itself off
(ambient::on() needs !builder_runs()). VICTORY_AMBIENT_RT=<least>,<most> keeps the diffuse stand-in on with
rays too, after the title's resolve, and keeps what the resolve left between least and most times the estimate:
the traced detail stays, black rooms and swings do not.

  • Only the keep (CS_CacheScreenSpaceRadiance) and the raise (CS_ScreenProbes_TemporalResolve) run with rays;
    reflections (CS_RayMiss) and the air stay the title's. on() takes the program's role for that.
  • The estimate is VICTORY_AMBIENT's share (victory play sets 0.8); with it unset or a constant the band does
    nothing and says so once in the log. With VICTORY_AMBIENT_RT unset nothing changes.
  • It runs main's stand-in passes as they are (the aside thread, the NaN/Inf scrub before max(was, found * least),
    the opt-in chroma scrub, the depth state); VICTORY_PROBE_NEUTRAL steps aside while the builder runs.
  • A 14th root constant carries least. In diagnostics builds VICTORY_AB=<s>,VICTORY_AMBIENT_RT flips it in a run.
  • A port of avatarmanz/VIctory-7900XTX 77137b9 and 126acb3 (GPL-3.0-or-later; that fork ships 0.7,1.5), fitted to
    this tree. Files: crates/victory-gpu/src/ambient.rs, crates/victory-gpu/src/draw.rs (+188/-14), with tests
    the_band_with_rays, what_runs_with_rays, the_constants_agree.

How it was tested

  • GPU and profile: RTX 4060 Ti 16 GB (driver 621.40), Ryzen 9 7950X; Series S 720, DLSS Quality, frame generation
    off, ray tracing on, VICTORY_AMBIENT_RT=0.7,1.5; a diagnostics build with VICTORY_AB=20,VICTORY_AMBIENT_RT, so the
    band flipped every 20 s inside one run.
  • Before (band off), standing in a brightly lit store: 45.4 and 43.4 ms median frame time.
  • After (band on), same place, same run: 42.8 ms, so no cost beyond the 2 ms the two off phases differ by. An 8-minute
    run with the band on throughout: 16.8 fps median, the store evenly lit, no black areas, no crash.
  • Ray tracing off, band flipped every 20 s: no change, as meant (off phases 55.3-58.4 ms, on 56.2-63.0 ms median).
  • These runs are of the first version (0b05b5a on 9ce3cf9). This head is the same change carried onto main 923e38c
    (the 14th constant, main's new stand-in code kept); its own run in the game, with a before/after picture pair in a
    dark room, is still to come.
  • On today's main that run needs VICTORY_LDS_WRITE_ONLY_OK=1: since shader: static Wave32 LDS alias and lane-private hazard analysis #43, three of the structure builder's programs are refused on 32-lane cards and ray tracing stays off without it (#43 (static Wave32 LDS alias): 8 compute shaders no longer translate on 32-lane hosts ("no wave32 lowering for this wave64 program") #1435, Wave64 programs on 32-lane hosts again, the shader cache key's missing switches, a relay remap wait, list-thread sampling #1575).
  • For shader changes, the wave sizes tested: 32 lanes (RTX 4060 Ti); the stand-in passes are this repo's own HLSL,
    not recompiled title programs.
  • cargo test passed for the crates it touches: yes. cargo test --locked -p victory-gpu --lib: 553 passed,
    0 failed, 43 ignored; with --all-features: 607 passed, 0 failed, 43 ignored (Rust 1.98.1). Clippy shows no lints
    in ambient.rs or draw.rs.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: Two-die Ryzens and 8 GB cards: frame threads on one die, target reser… #730, the only
    open PR that also changes ambient.rs (it adds Alpha and reflection roles); the two conflict there, so whichever
    is merged second needs a rebase. draw.rs is changed by 25 open PRs; this one changes only the two calls of
    ambient::on.

AI use: Claude Code (Claude Opus 5.5) found the fork commit, ported and adapted it, carried it onto today's main, wrote
the tests, read the logs of the runs above and wrote this description. The runs were played on the PC named above.

JCreecher and others added 3 commits November 28, 2026 14:29
…ns (VICTORY_AMBIENT_RT, off by default)

With the title's ray tracing on, the stand-in for the indirect light
turned itself off, and the traced diffuse light that replaces it flickers
and goes black indoors while the structures the rays walk are partly
wrong (blown-out light and black patches with the builder on, as
docs/findings.md has it for an RTX 5080).

VICTORY_AMBIENT_RT=<least>,<most> keeps the diffuse stand-in on with rays
too, after the title's resolve, and keeps what the resolve left between
least and most times the estimate, VICTORY_AMBIENT's share (victory play
sets 0.8; unset or a constant, the band does nothing and says so once).
Reflections (CS_RayMiss) and the air stay the title's while rays run, and
VICTORY_PROBE_NEUTRAL does not replace the traced light; ambient::on() now
takes the program's role for that, and as before asks the builder only
when a stand-in is set. Unset, nothing changes: without rays the bounds
are the old ones (least 1 is the old floor), with rays the title's own
light. Frames where the builder rests count as frames without rays, as
for VICTORY_AMBIENT. In diagnostics builds VICTORY_AB=<s>,VICTORY_AMBIENT_RT
flips it while the title runs (at its value, or 0.7,1.5).

The band runs the stand-in's passes as they are: made on a thread of ours
with VICTORY_AMBIENT_ASIDE=1, the raise scrubbing NaN, Inf and negative
channels of what it found and of what the resolve left before it keeps
max(was, found * least), the depth read in a valid state and type. least
is a 14th root constant, after VICTORY_AMBIENT_CHROMA_SCRUB's 13th; the
raise test of that switch writes it (1, as without rays).

Port of avatarmanz/VIctory-7900XTX 77137b9 and 126acb3
(GPL-3.0-or-later), which ships it at 0.7,1.5, fitted to this tree: that
fork had no reflection role, so a plain port would also have overwritten
the traced CS_RayMiss output and run the air bound under ray tracing;
VICTORY_AMBIENT is left as it is (the original made an unset share the
band's third field, which is not taken here); 14 root constants here
(15 to 16 there).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt-band-v2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added lighting Shadows, reflections, light estimate or ray-traced light NVIDIA pr-feature Pull request: adds a feature or setting RAYTRACING labels Nov 28, 2026
@github-actions github-actions Bot changed the title [pr-feature] [lighting] [RAYTRACING] [NVIDIA] Ambient: keep the traced diffuse light in a band while ray tracing runs (VICTORY_AMBIENT_RT, off by default) Ambient: keep the traced diffuse light in a band while ray tracing runs (VICTORY_AMBIENT_RT, off by default) Nov 28, 2026
@JCreecher
JCreecher marked this pull request as ready for review November 28, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lighting Shadows, reflections, light estimate or ray-traced light NVIDIA pr-feature Pull request: adds a feature or setting RAYTRACING

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant