Ambient: bound the sky's light in reflections where the miss program has no depth #63

Closed
wasonidas wants to merge 2 commits from upstream-pr/63 into main
wasonidas commented 2026-11-27 15:39:05 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wasonidas on 2026-11-27T15:39:05Z.


Problem

On an RTX 5080 (Series S and Series X profiles) CS_RayMiss_de6b91a6 has a 1x1 texture at its depth's place in every frame of the world, so the reflections estimate (VICTORY_AMBIENT_SPECULAR) never ran for it: indoors, floors and glass mirrored the sky.

The alpha layer (glass, decals, paper on a wall) takes the sky's light twice when its rays find nothing, from CS_DeferredFallbacksAlpha_SkyProbe and from CS_RayMiss, into the image CS_TemporalResolve1_Alpha reads. Paper on the wall of the first playable room showed the sky at 10 to 30 where the room around sends out 0.01 to 0.1.

Change

  • Where the miss program has no depth of the picture, the opaque layer keeps the title's sky light only up to a multiple (6) of the light around: VICTORY_AMBIENT_SPECULAR_NO_DEPTH=<multiple>, 0 leaves the title's sky light. It acts only with VICTORY_AMBIENT_SPECULAR on.
  • The alpha layer gets the same bound everywhere: VICTORY_AMBIENT_SPECULAR_ALPHA unset or bound[:<multiple>]; 1 takes the estimate as opaque surfaces do, 0 leaves it as the title has it. A bound needs neither the surface's depth nor its normal, so it also works on water, where the estimate cannot be used.
  • "The light around" is the geometric mean of what the picture's cells send out, not the plain mean: a window with the sunset in it is a third of a cell's picture and 200 times the room.
  • The miss program's tables are listed again at its 1024th and 8192nd unmatched dispatch.
  • Two small things that came in the same commit: VICTORY_CAPTURE_WORLD_EVERY=<frames> sets how often a frame of the world is saved in the diagnostics build (8, as before; a saved frame takes 45 to 55 ms more, which was the 95th percentile of every run measured with captures), and VICTORY_AMBIENT_SECOND caps the resolve's second image of light (a probe, off unless asked for).

Outdoors the light around is of the sky's order and the bound does little; indoors it takes the sky away.

Relation to #29

#29 drops violet leftovers in the ambient raise. This bounds the sky's light in reflections, another path; it applies beside #29's lines without touching them.

Measured

RTX 5080, Ryzen 7 9800X3D, 32 GB, Series X profile, 2560x1440, DLSS Quality, diagnostics build, 294 s unattended run of the prologue with this change:

device removed / out-of-memory lines 0 / 0
cell (135-145 s) 22.4 FPS, p50 35.1 ms
route (199-226 s) 27.0 FPS, p50 34.4 ms, p95 54.4 ms
peak commit / dedicated VRAM 30.9 GiB / 13.05 GiB

This is a picture fix and comes with no frame-rate claim: there was no A/B of this change alone, and the cost of the two compute passes it adds (bound, cap) was not isolated. The run above saved every 8th frame, each about 50 ms.

Checks

  • Cherry-picked on main (d12eb1b2) without conflicts.
  • cargo check --workspace --all-targets --locked: passes.
  • cargo test -p victory-gpu --lib -- ambient::tests capture::tests draw::tests (card-free ones, including the three new settings tests) and cargo test -p xtask (asset policy): pass.
  • Not run on this branch: ambient::tests::the_passes_build, which compiles the passes on a card. No GPU run was made on top of current main; the measurements above are from our RTX 5080 branch, whose base is this repository's 9d6300fa.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5529277627 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/63). Originally posted by [wasonidas](https://github.com/wasonidas) on 2026-11-27T15:39:05Z. --- ## Problem On an RTX 5080 (Series S and Series X profiles) `CS_RayMiss_de6b91a6` has a 1x1 texture at its depth's place in every frame of the world, so the reflections estimate (`VICTORY_AMBIENT_SPECULAR`) never ran for it: indoors, floors and glass mirrored the sky. The alpha layer (glass, decals, paper on a wall) takes the sky's light twice when its rays find nothing, from `CS_DeferredFallbacksAlpha_SkyProbe` and from `CS_RayMiss`, into the image `CS_TemporalResolve1_Alpha` reads. Paper on the wall of the first playable room showed the sky at 10 to 30 where the room around sends out 0.01 to 0.1. ## Change - Where the miss program has no depth of the picture, the opaque layer keeps the title's sky light only up to a multiple (6) of the light around: `VICTORY_AMBIENT_SPECULAR_NO_DEPTH=<multiple>`, `0` leaves the title's sky light. It acts only with `VICTORY_AMBIENT_SPECULAR` on. - The alpha layer gets the same bound everywhere: `VICTORY_AMBIENT_SPECULAR_ALPHA` unset or `bound[:<multiple>]`; `1` takes the estimate as opaque surfaces do, `0` leaves it as the title has it. A bound needs neither the surface's depth nor its normal, so it also works on water, where the estimate cannot be used. - "The light around" is the geometric mean of what the picture's cells send out, not the plain mean: a window with the sunset in it is a third of a cell's picture and 200 times the room. - The miss program's tables are listed again at its 1024th and 8192nd unmatched dispatch. - Two small things that came in the same commit: `VICTORY_CAPTURE_WORLD_EVERY=<frames>` sets how often a frame of the world is saved in the diagnostics build (8, as before; a saved frame takes 45 to 55 ms more, which was the 95th percentile of every run measured with captures), and `VICTORY_AMBIENT_SECOND` caps the resolve's second image of light (a probe, off unless asked for). Outdoors the light around is of the sky's order and the bound does little; indoors it takes the sky away. ## Relation to #29 #29 drops violet leftovers in the ambient `raise`. This bounds the sky's light in reflections, another path; it applies beside #29's lines without touching them. ## Measured RTX 5080, Ryzen 7 9800X3D, 32 GB, Series X profile, 2560x1440, DLSS Quality, diagnostics build, 294 s unattended run of the prologue with this change: | | | |---|---| | device removed / out-of-memory lines | 0 / 0 | | cell (135-145 s) | 22.4 FPS, p50 35.1 ms | | route (199-226 s) | 27.0 FPS, p50 34.4 ms, p95 54.4 ms | | peak commit / dedicated VRAM | 30.9 GiB / 13.05 GiB | This is a picture fix and comes with no frame-rate claim: there was no A/B of this change alone, and the cost of the two compute passes it adds (`bound`, `cap`) was not isolated. The run above saved every 8th frame, each about 50 ms. ## Checks - Cherry-picked on `main` (`d12eb1b2`) without conflicts. - `cargo check --workspace --all-targets --locked`: passes. - `cargo test -p victory-gpu --lib -- ambient::tests capture::tests draw::tests` (card-free ones, including the three new settings tests) and `cargo test -p xtask` (asset policy): pass. - Not run on this branch: `ambient::tests::the_passes_build`, which compiles the passes on a card. No GPU run was made on top of current `main`; the measurements above are from our RTX 5080 branch, whose base is this repository's `9d6300fa`.
1tsethan commented 2026-11-27 23:00:44 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 1tsethan on 2026-11-27T23:00:44Z.


Independent Windows validation of PR #63.

Tested commit: f60296e7ef1722c0d624ba7f46b27bf09459ebdd.

cargo test --locked -p victory-gpu ambient::tests:: -- --nocapture --test-threads=1

Exit: 0.

  • test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 446 filtered out; finished in 1.20s

Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7229799304 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/63#issuecomment-7229799304). Originally posted by [1tsethan](https://github.com/1tsethan) on 2026-11-27T23:00:44Z. --- Independent Windows validation of PR #63. Tested commit: `f60296e7ef1722c0d624ba7f46b27bf09459ebdd`. `cargo test --locked -p victory-gpu ambient::tests:: -- --nocapture --test-threads=1` Exit: **0**. - test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 446 filtered out; finished in 1.20s Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result. <!-- victory-native-validation-20261128 -->
wasonidas commented 2026-11-28 08:38:35 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wasonidas on 2026-11-28T08:38:35Z.


Merged main (63b902f) into this branch; it had one conflict, in draw.rs.

What the conflict was. main now gives the alpha layer the estimate by default (VICTORY_AMBIENT_SPECULAR_ALPHA on unless 0): the dark patches on water turned out to be tiles the tile list had dropped, and without the estimate glass in a dark room mirrored the bright sky. This branch does something else with the same layer: it keeps the title's sky light and bounds it by the light around, which needs neither depth nor normal.

How it is resolved. This branch's default is kept (unset: the bound). VICTORY_AMBIENT_SPECULAR_ALPHA=1 gives main's estimate, 0 leaves the layer as the title has it. If you would rather keep the estimate as the default and have the bound as the opt-in, say so and I will turn it round.

Checked. cargo check --workspace --all-targets passes; cargo test -p victory-gpu --lib ambient:: draw:: capture::: 16 passed, 1 ignored. The merged tree has not been run on a card: the figures in the description are from before main's lighting changes of 27 November.

Two things from others that bear on this:

  • #393 (same commit, both bounds at 1 instead of 6) reports on two RTX 5080s that 6 still leaves eyes and glass too bright indoors and 1 does not. I have not measured 1 myself, so the default here stays at 6; #393 will need a rebase onto this merge.
  • #466 reports the whole frame white on an RTX 4060 and an RTX 4050 Laptop from the first bind of the same miss variant (06bb6e728c7c99bf). I cannot tell from here whether the bound clears that case.

Written with AI help (Claude Code).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7236714611 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/63#issuecomment-7236714611). Originally posted by [wasonidas](https://github.com/wasonidas) on 2026-11-28T08:38:35Z. --- Merged `main` (`63b902f`) into this branch; it had one conflict, in `draw.rs`. **What the conflict was.** `main` now gives the alpha layer the estimate by default (`VICTORY_AMBIENT_SPECULAR_ALPHA` on unless `0`): the dark patches on water turned out to be tiles the tile list had dropped, and without the estimate glass in a dark room mirrored the bright sky. This branch does something else with the same layer: it keeps the title's sky light and bounds it by the light around, which needs neither depth nor normal. **How it is resolved.** This branch's default is kept (unset: the bound). `VICTORY_AMBIENT_SPECULAR_ALPHA=1` gives `main`'s estimate, `0` leaves the layer as the title has it. If you would rather keep the estimate as the default and have the bound as the opt-in, say so and I will turn it round. **Checked.** `cargo check --workspace --all-targets` passes; `cargo test -p victory-gpu --lib ambient:: draw:: capture::`: 16 passed, 1 ignored. The merged tree has **not** been run on a card: the figures in the description are from before `main`'s lighting changes of 27 November. Two things from others that bear on this: - #393 (same commit, both bounds at 1 instead of 6) reports on two RTX 5080s that 6 still leaves eyes and glass too bright indoors and 1 does not. I have not measured 1 myself, so the default here stays at 6; #393 will need a rebase onto this merge. - #466 reports the whole frame white on an RTX 4060 and an RTX 4050 Laptop from the first bind of the same miss variant (`06bb6e728c7c99bf`). I cannot tell from here whether the bound clears that case. Written with AI help (Claude Code).
trustno1-coder commented 2026-11-28 19:01:55 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T19:01:55Z.


Thanks for this. I'm closing it without merging: #124, merged now, adds the same bound for the reflections where the miss program has no depth (VICTORY_AMBIENT_SPECULAR_BOUND), and the two conflict. If yours does something #124 doesn't, please rebase it on the current main and open a new pull request with just that part.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7244236661 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/63#issuecomment-7244236661). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-28T19:01:55Z. --- Thanks for this. I'm closing it without merging: #124, merged now, adds the same bound for the reflections where the miss program has no depth (`VICTORY_AMBIENT_SPECULAR_BOUND`), and the two conflict. If yours does something #124 doesn't, please rebase it on the current main and open a new pull request with just that part.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!63
No description provided.