Re-land the four ambient PRs reverted in v2026.11.30.01 (#1930 #1995 #2336 #1736), with a WARP test of the air's bound #4535

Open
Lyrnc wants to merge 5 commits from upstream-pr/4535 into main
Lyrnc commented 2026-11-30 22:04:47 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T22:04:47Z.


What this does

v2026.11.30.01 merged four ambient-light PRs and then reverted them while the black indirect light was being chased: #1930 (42c9d828), #1995 (35c0730e), #2336 (311884d0) and #1736 (09a0a14d). That bug turned out to be #2580. The release notes say the four were never retested.

This PR puts them back unchanged on current main (git revert of each revert) and adds one test. They were retested on main (84bd61e2, v2026.11.30.02), in an interior and outdoors, with a warm and a cold shader cache.

What changes by default:

  • #1930 (on whenever VICTORY_AMBIENT_AIR is set; victory play sets 1): near the eye, the air's bound is now the darker of the room's slow mean and the light of the surface seen through that air. Before, it was the room's mean alone.
  • #2336: the gather reuses its weighted terms. The output is the same to ~1e-7 (it has its own WARP test).
  • #1995 (VICTORY_AMBIENT_PROBE_OUTLIERS=1) and #1736 (VICTORY_AMBIENT_TILED=1) are opt-in. Nothing changes unless they are set.

New test: ambient::tests::the_air_is_bound_by_the_darker_of_the_room_and_the_surface_seen runs the real clear_air shader on WARP over a 4x1x4 volume. Cases: a dark wall in a room whose mean is bright, a bright window seen from a dark room, sky-blue air (the tint is kept), and air already under the bound. With main's formula it fails: at the nearest slice in front of the dark wall, 0.5 gets through where the bound is 0.02. #1930's own test only redoes the arithmetic on the CPU.

Measured

RTX 5080 16 GB, 9800X3D, 32 GB, Windows 11. Series X profile, native 2560x1440, DLSS off, frame generation off, ray tracing off. The save attached to #3972, which starts at a house; we measured standing and doing a slow look-around in its living room and kitchen.

main 84bd61e2 main + this PR
Interior, warm cache 28-30 fps, frame median 33-36 ms, card 94-100 % busy, card meter 29-32 ms (diagnostics A/B below)
Outdoor deck 27-28 fps, 35-37 ms, meter 31-33 ms 27-29 fps, 33-38 ms, meter ~29 ms
Cold shader cache, first world frames (not run) normal lighting outdoors and through the open door into the interior, no black indirect light; 0 pipelines refused; air stand-in runs

To compare #1930's formula with main's on the same frames, we used a local diagnostics build that switches the formula while the game runs, a few hundred ms apart. The figures are the mean linear luminance of the frame (x1000):

View main's formula #1930 no bound (title's own air)
Kitchen and deck door 142.6 / 142.7 / 143.6 142.4 141.7
Window and dark wood wall 155.7 / 157.0 / 157.3 / 157.9 155.2 / 158.8 155.8
Glow region around a window 234.1 / 235.4 / 236.8 – 235.0

In this interior the bound never takes hold (even at 0.25x the change stays under 1 %), so #1930 does no harm here. It matters where the room's mean is far above the wall in view: the restaurant and barbershop reported on #1930 itself, and the dark rooms and menus of #1395. The whole stand-in (keep, place, gather, raise, air) costs about 1 ms of card time a frame (meter 27.9-28.1 ms with it, 26.7-27.1 without).

About the interior fog and the 1-7 fps reports (#3972, #3865, #3685, #3835)

These reports are all on v2026.11.29.05. On .30.02 the same interior is not slower than outdoors: it is GPU-bound at the same 33-36 ms. No list in the card meter is over 3.2 ms; the volumetric lists add up to about 4 ms. The 3-9 fps dips on entering are pipelines being made for new views, and they go away on a warm cache. The look indoors is a mild veil plus the glow around windows. The air bound does not change it, and neither does leaving out the volumetric passes. v2026.11.30.01 changed exactly the programs that the .29.05 reports point at: #3871 fixed the lane-mask joins of 18 folded wave64 programs (particle light atlas, scattering gather, particle updates, shadow masks, water volume light), which had loops running to the 4096-iteration guard. #3896 unfolded the light atlas (indoor 4-8 fps -> 26-31 fps).

What is not confirmed here:

  • The bar itself was not reached from the save.
  • .29.05 could not be compared on this PC: with a cold cache it refused 1,275 pipelines with 0x8007000E within four minutes.

So whether the bar is clean on .30.x still needs a reporter with a save there.

Tests

  • cargo test -p victory-gpu --lib --locked ambient: 21 passed (the four PRs' tests and the new one).
  • With main's air formula put back, the new test fails as expected: dark wall, slice 0, got 0.5, want 0.02.
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings, with and without --all-features: the only errors are ones already on main, none in ambient.rs. They are shadow.rs ranged unused, host.rs:5092 manual_is_multiple_of, and with all features copystat.rs mb unused.
  • cargo test -p xtask: only the failure already on main (repository_passes_policy: a 560-character hex run in crates/victory-shader/src/native.rs).

Credit: the four changes are dheerajc8073's (#1930), Yoshi-233's (#1995), yumaste's (#2336) and Gauss999's (#1736).

AI use: this was investigated, measured, and written with Claude Code (Claude Opus 5.5). The runs and numbers above are from our own PC.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5574598098 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4535). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-30T22:04:47Z. --- ## What this does v2026.11.30.01 merged four ambient-light PRs and then reverted them while the black indirect light was being chased: #1930 (42c9d828), #1995 (35c0730e), #2336 (311884d0) and #1736 (09a0a14d). That bug turned out to be #2580. The release notes say the four were never retested. This PR puts them back unchanged on current main (`git revert` of each revert) and adds one test. They were retested on main (84bd61e2, v2026.11.30.02), in an interior and outdoors, with a warm and a cold shader cache. What changes by default: - #1930 (on whenever `VICTORY_AMBIENT_AIR` is set; `victory play` sets 1): near the eye, the air's bound is now the darker of the room's slow mean and the light of the surface seen through that air. Before, it was the room's mean alone. - #2336: the gather reuses its weighted terms. The output is the same to ~1e-7 (it has its own WARP test). - #1995 (`VICTORY_AMBIENT_PROBE_OUTLIERS=1`) and #1736 (`VICTORY_AMBIENT_TILED=1`) are opt-in. Nothing changes unless they are set. New test: `ambient::tests::the_air_is_bound_by_the_darker_of_the_room_and_the_surface_seen` runs the real `clear_air` shader on WARP over a 4x1x4 volume. Cases: a dark wall in a room whose mean is bright, a bright window seen from a dark room, sky-blue air (the tint is kept), and air already under the bound. With main's formula it fails: at the nearest slice in front of the dark wall, 0.5 gets through where the bound is 0.02. #1930's own test only redoes the arithmetic on the CPU. ## Measured RTX 5080 16 GB, 9800X3D, 32 GB, Windows 11. Series X profile, native 2560x1440, DLSS off, frame generation off, ray tracing off. The save attached to #3972, which starts at a house; we measured standing and doing a slow look-around in its living room and kitchen. | | main 84bd61e2 | main + this PR | |---|---|---| | Interior, warm cache | 28-30 fps, frame median 33-36 ms, card 94-100 % busy, card meter 29-32 ms | (diagnostics A/B below) | | Outdoor deck | 27-28 fps, 35-37 ms, meter 31-33 ms | 27-29 fps, 33-38 ms, meter ~29 ms | | Cold shader cache, first world frames | (not run) | normal lighting outdoors and through the open door into the interior, no black indirect light; 0 pipelines refused; air stand-in runs | To compare #1930's formula with main's on the same frames, we used a local diagnostics build that switches the formula while the game runs, a few hundred ms apart. The figures are the mean linear luminance of the frame (x1000): | View | main's formula | #1930 | no bound (title's own air) | |---|---|---|---| | Kitchen and deck door | 142.6 / 142.7 / 143.6 | 142.4 | 141.7 | | Window and dark wood wall | 155.7 / 157.0 / 157.3 / 157.9 | 155.2 / 158.8 | 155.8 | | Glow region around a window | 234.1 / 235.4 / 236.8 | – | 235.0 | In this interior the bound never takes hold (even at 0.25x the change stays under 1 %), so #1930 does no harm here. It matters where the room's mean is far above the wall in view: the restaurant and barbershop reported on #1930 itself, and the dark rooms and menus of #1395. The whole stand-in (keep, place, gather, raise, air) costs about 1 ms of card time a frame (meter 27.9-28.1 ms with it, 26.7-27.1 without). ## About the interior fog and the 1-7 fps reports (#3972, #3865, #3685, #3835) These reports are all on v2026.11.29.05. On .30.02 the same interior is not slower than outdoors: it is GPU-bound at the same 33-36 ms. No list in the card meter is over 3.2 ms; the volumetric lists add up to about 4 ms. The 3-9 fps dips on entering are pipelines being made for new views, and they go away on a warm cache. The look indoors is a mild veil plus the glow around windows. The air bound does not change it, and neither does leaving out the volumetric passes. v2026.11.30.01 changed exactly the programs that the .29.05 reports point at: #3871 fixed the lane-mask joins of 18 folded wave64 programs (particle light atlas, scattering gather, particle updates, shadow masks, water volume light), which had loops running to the 4096-iteration guard. #3896 unfolded the light atlas (indoor 4-8 fps -> 26-31 fps). What is not confirmed here: - The bar itself was not reached from the save. - .29.05 could not be compared on this PC: with a cold cache it refused 1,275 pipelines with 0x8007000E within four minutes. So whether the bar is clean on .30.x still needs a reporter with a save there. ## Tests - `cargo test -p victory-gpu --lib --locked ambient`: 21 passed (the four PRs' tests and the new one). - With main's air formula put back, the new test fails as expected: dark wall, slice 0, got 0.5, want 0.02. - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`, with and without `--all-features`: the only errors are ones already on main, none in `ambient.rs`. They are `shadow.rs` `ranged` unused, `host.rs:5092` `manual_is_multiple_of`, and with all features `copystat.rs` `mb` unused. - `cargo test -p xtask`: only the failure already on main (`repository_passes_policy`: a 560-character hex run in `crates/victory-shader/src/native.rs`). Credit: the four changes are dheerajc8073's (#1930), Yoshi-233's (#1995), yumaste's (#2336) and Gauss999's (#1736). AI use: this was investigated, measured, and written with Claude Code (Claude Opus 5.5). The runs and numbers above are from our own PC. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
IRennie74 commented 2026-11-30 22:39:15 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by IRennie74 on 2026-11-30T22:39:15Z.


One thing to check about #1930's bound, since it is on by default under victory play. Near the eye, the cap was the room's slowly followed mean. Now it is min(room, seen_luma), and seen_luma comes from this frame's (or the last gather's) points, which follow the depth under the camera. While turning, the cap near the eye can therefore change from frame to frame wherever the surface in view switches between dark and bright (a dark wall edge against a window). If the air's own value sits between the two, that could show as the veil pulsing.

Your look-around numbers are frame means, which would not show a local pulse. On a 6-core PC (Ryzen 5 5600X, RTX 3060, Series S) we already count about 59 A-B-A flicker events a minute while walking, with the detector from #4376 (VICTORY_FLICKER_DETECT=1, not merged yet). We can run this branch against main on that route and report whether the count moves, if that is useful.

Also, after() in ambient.rs conflicts with #4347: this PR replaces run(&pass.gather, 20, 45, 1) with gather(), and #4347 changes the constant == 0.0 test around the same call and adds a Role::Reflect arm. The merge should be simple, but whichever lands second needs it.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7294130159 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4535#issuecomment-7294130159). Originally posted by [IRennie74](https://github.com/IRennie74) on 2026-11-30T22:39:15Z. --- One thing to check about #1930's bound, since it is on by default under `victory play`. Near the eye, the cap was the room's slowly followed mean. Now it is `min(room, seen_luma)`, and `seen_luma` comes from this frame's (or the last gather's) `points`, which follow the depth under the camera. While turning, the cap near the eye can therefore change from frame to frame wherever the surface in view switches between dark and bright (a dark wall edge against a window). If the air's own value sits between the two, that could show as the veil pulsing. Your look-around numbers are frame means, which would not show a local pulse. On a 6-core PC (Ryzen 5 5600X, RTX 3060, Series S) we already count about 59 A-B-A flicker events a minute while walking, with the detector from #4376 (`VICTORY_FLICKER_DETECT=1`, not merged yet). We can run this branch against main on that route and report whether the count moves, if that is useful. Also, `after()` in `ambient.rs` conflicts with #4347: this PR replaces `run(&pass.gather, 20, 45, 1)` with `gather()`, and #4347 changes the `constant == 0.0` test around the same call and adds a `Role::Reflect` arm. The merge should be simple, but whichever lands second needs it.
Lyrnc commented 2026-12-01 04:09:09 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-12-01T04:09:09Z.


Thanks @IRennie74. You're right about the mechanism, and the frame means in the description couldn't show it.

Where seen_luma comes from. clear_air maps each air column to one of the 160x90 points (q) and reads points[q].w, the light the last gather left there.

  • Each point is one depth texel at the middle of its cell of the picture (16x16 px at 2560x1440), placed in 3D (seen() in the gather).
  • Its light is the mean of the 64x36 cells' light (the title's screen radiance from the frame before), weighted by distance to that 3D position: c.w / (dd + r2), with r2 = 0.25 + 0.0025 z².
  • So it is the light around the surface that one texel hits, not that surface's own brightness.
  • points has no history. It is whatever the last gather wrote: this frame's, if a gather ran before the air's step, otherwise the frame before's.

What that means for the bound. Where a point's texel sits on a silhouette with a large depth step (a wall edge at 3 m against outside at 40 m), a sub-pixel turn can move it across, and its light jumps between the light at the two places. Before #1930 that already moved the cap of the far slices (lerp(room, seen, far)). With #1930 it moves the near slices' cap too, but only on the dark side. Near the eye the cap is air * min(room, seen), so it changes only while seen is below the room's mean, and it only clamps air brighter than air * seen. If it shows, it would be at silhouettes while turning, one point (16x16 px) at a time, not as the whole veil pulsing. I can't tell from the code whether the air's own value sits in that band in practice.

Measuring it: yes please. On your route, this branch against main with VICTORY_FLICKER_DETECT=1 is close to #1930 alone. Of the other three, #1995 and #1736 are opt-in, and #2336 only reuses terms in the gather's sums. If the count moves, the change I'd make: bound the near slices by the mean of seen over the 3x3 points around q, while the far slices keep the single point. A dark interior is dark at all nine points, so #1395's case stays the same. A silhouette flipping one point would then move the near cap by a ninth of the step instead of all of it. If the count doesn't move, I'd leave the bound as #1930 had it.

#4347: agreed. Whichever lands second takes the merge in after(). If #4347 goes first, I'll rebase this onto it.

I've also rebased this onto current main (now e6938383). Main's history was rewritten after 0c8c2092, which made this PR show as conflicting. The five commits are the same patches. On e6938383 (RTX 5080, Windows 11): cargo test -p victory-gpu --lib -- ambient gives 21 passed, the WARP test of the bound among them. cargo clippy -p victory-gpu --all-targets -- -D warnings reports 5 errors, all in host/font.rs, host/menu.rs and host/panel.rs from main's F1/F3 panel merge, none from this PR.

AI use: Claude Code (Claude Opus 5.5) read the code path, ran the checks and wrote this.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7300432365 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4535#issuecomment-7300432365). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-12-01T04:09:09Z. --- Thanks @IRennie74. You're right about the mechanism, and the frame means in the description couldn't show it. **Where `seen_luma` comes from.** `clear_air` maps each air column to one of the 160x90 points (`q`) and reads `points[q].w`, the light the last gather left there. - Each point is one depth texel at the middle of its cell of the picture (16x16 px at 2560x1440), placed in 3D (`seen()` in the gather). - Its light is the mean of the 64x36 cells' light (the title's screen radiance from the frame before), weighted by distance to that 3D position: `c.w / (dd + r2)`, with `r2 = 0.25 + 0.0025 z²`. - So it is the light around the surface that one texel hits, not that surface's own brightness. - `points` has no history. It is whatever the last gather wrote: this frame's, if a gather ran before the air's step, otherwise the frame before's. **What that means for the bound.** Where a point's texel sits on a silhouette with a large depth step (a wall edge at 3 m against outside at 40 m), a sub-pixel turn can move it across, and its light jumps between the light at the two places. Before #1930 that already moved the cap of the far slices (`lerp(room, seen, far)`). With #1930 it moves the near slices' cap too, but only on the dark side. Near the eye the cap is `air * min(room, seen)`, so it changes only while `seen` is below the room's mean, and it only clamps air brighter than `air * seen`. If it shows, it would be at silhouettes while turning, one point (16x16 px) at a time, not as the whole veil pulsing. I can't tell from the code whether the air's own value sits in that band in practice. **Measuring it:** yes please. On your route, this branch against main with `VICTORY_FLICKER_DETECT=1` is close to #1930 alone. Of the other three, #1995 and #1736 are opt-in, and #2336 only reuses terms in the gather's sums. If the count moves, the change I'd make: bound the near slices by the mean of `seen` over the 3x3 points around `q`, while the far slices keep the single point. A dark interior is dark at all nine points, so #1395's case stays the same. A silhouette flipping one point would then move the near cap by a ninth of the step instead of all of it. If the count doesn't move, I'd leave the bound as #1930 had it. **#4347:** agreed. Whichever lands second takes the merge in `after()`. If #4347 goes first, I'll rebase this onto it. I've also rebased this onto current main (now e6938383). Main's history was rewritten after 0c8c2092, which made this PR show as conflicting. The five commits are the same patches. On e6938383 (RTX 5080, Windows 11): `cargo test -p victory-gpu --lib -- ambient` gives 21 passed, the WARP test of the bound among them. `cargo clippy -p victory-gpu --all-targets -- -D warnings` reports 5 errors, all in `host/font.rs`, `host/menu.rs` and `host/panel.rs` from main's F1/F3 panel merge, none from this PR. AI use: Claude Code (Claude Opus 5.5) read the code path, ran the checks and wrote this.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/4535:upstream-pr/4535'
git switch 'upstream-pr/4535'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/4535'
git switch 'upstream-pr/4535'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/4535'
git switch 'upstream-pr/4535'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/4535'
git switch 'main'
git merge --squash 'upstream-pr/4535'
git switch 'main'
git merge --ff-only 'upstream-pr/4535'
git switch 'main'
git merge 'upstream-pr/4535'
git push origin 'main'
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!4535
No description provided.