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

Manually merged
github merged 3 commits from github-bot/gh-1592 into main 2026-11-29 08:21:56 +00:00 AGit
Owner

@⁠JCreecher on GitHub · 2026-11-28 22:04 UTC · original
JCreecher:rt/ambient-band-v2 → main · +188 −14 · 2 files · 3 commits · merged 2026-11-29 08:16 UTC

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 #43, three of the structure builder's programs are refused on 32-lane cards and ray tracing stays off without it (#1435, #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: #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** on GitHub · 2026-11-28 22:04 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1592) `JCreecher:rt/ambient-band-v2` → `main` · +188 −14 · 2 files · 3 commits · merged 2026-11-29 08:16 UTC 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 #43, three of the structure builder's programs are refused on 32-lane cards and ray tracing stays off without it (#1435, #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 - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #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](https://claude.com/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.
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 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 22:06:52 +00:00
github manually merged commit 1ffcc57119 into main 2026-11-29 08:21:56 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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
github/trustno1-coder--VIctory-NVIDIA!1592
No description provided.