fix(ambient): add opt-in chromatic probe-garbage scrub (VICTORY_AMBIENT_CHROMA_SCRUB=1) #280

Closed
Vladimir-Human wants to merge 563 commits from upstream-pr/280 into main
Vladimir-Human commented 2026-11-27 13:32:38 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Vladimir-Human on 2026-11-27T13:32:38Z.


Summary

Split out from #255 per review feedback so chromatic probe-garbage filtering can be evaluated independently and stays strictly opt-in (OFF by default).

When VICTORY_AMBIENT_CHROMA_SCRUB=1 is set alongside VICTORY_AMBIENT, ambient.rs's raise pass drops three additional chromatic probe-garbage signatures left by unbuilt/stale screen probes (related to #168):

  • Bluer violet probe leftovers (was.b > 2.5 * was.g && was.b > was.r && was.b > 0.02, ported from VIctory-NVIDIA 826ba15) which otherwise bypass the luminance cap (LUMA.b = 0.0722).
  • Acid-green spikes (was.g > 2.5 * max(was.r, was.b) && was.g > 0.02).
  • Electric-cyan spikes (was.r < 0.35 * min(was.g, was.b) && max(was.g, was.b) > 0.02).

When VICTORY_AMBIENT_CHROMA_SCRUB is unset or not 1 (the default), bit 1 of the existing probe root constant (words[11]) is 0, preserving exact upstream ambient.rs behavior with zero root-signature or PSO changes (existing lightprobe stats check (probe & 1u) != 0).

Changed Files

  • crates/victory-gpu/src/ambient.rs: opt-in VICTORY_AMBIENT_CHROMA_SCRUB=1 switch, guarded chroma-spike checks in RAISE, unit test (chroma_scrub_is_opt_in), and a 12-tone D3D12 hardware + WARP test (raise_opt_in_chroma_scrub_filters_spikes_and_preserves_scene_tones_on_hardware_and_warp).
  • crates/victory-gpu/src/indirect.rs: #[cfg(test)] pub(crate) visibility on WarpHarness::on for test reuse.

Verification

Verified on local D3D12 hardware (NVIDIA GeForce RTX 4070 SUPER) and WARP (VICTORY_D3D12_DEBUG=1, --test-threads=1, 0 D3D12 debug layer errors):

  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default & --features diagnostics): 0 warnings.
  • cargo test -p victory-gpu --locked ambient::tests -- --test-threads=1 (default & --features diagnostics): 9/9 passed on both hardware and WARP, confirming in both scrub_on=false (default) and scrub_on=true (VICTORY_AMBIENT_CHROMA_SCRUB=1):
    • Default mode preserves exact upstream behavior (only existing magenta filter runs).
    • Opt-in mode scrubs violet, acid-green, and electric-cyan spikes to the spatial estimate.
    • Neutral daylight, blue sky, coastal water, deep water, warm sunset, warm lamp lighting, natural foliage bounce, and deep foliage bounce are preserved in both modes.
  • cargo run -p xtask --locked -- policy & cargo test -p xtask --locked: 11/11 passed.
<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5527501344 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/280). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-27T13:32:38Z. --- ## Summary Split out from #255 per review feedback so chromatic probe-garbage filtering can be evaluated independently and stays strictly opt-in (**OFF by default**). When `VICTORY_AMBIENT_CHROMA_SCRUB=1` is set alongside `VICTORY_AMBIENT`, `ambient.rs`'s `raise` pass drops three additional chromatic probe-garbage signatures left by unbuilt/stale screen probes (related to #168): - Bluer violet probe leftovers (`was.b > 2.5 * was.g && was.b > was.r && was.b > 0.02`, ported from `VIctory-NVIDIA` `826ba15`) which otherwise bypass the luminance cap (`LUMA.b = 0.0722`). - Acid-green spikes (`was.g > 2.5 * max(was.r, was.b) && was.g > 0.02`). - Electric-cyan spikes (`was.r < 0.35 * min(was.g, was.b) && max(was.g, was.b) > 0.02`). When `VICTORY_AMBIENT_CHROMA_SCRUB` is unset or not `1` (the default), bit 1 of the existing `probe` root constant (`words[11]`) is `0`, preserving exact upstream `ambient.rs` behavior with zero root-signature or PSO changes (existing lightprobe stats check `(probe & 1u) != 0`). ## Changed Files - `crates/victory-gpu/src/ambient.rs`: opt-in `VICTORY_AMBIENT_CHROMA_SCRUB=1` switch, guarded chroma-spike checks in `RAISE`, unit test (`chroma_scrub_is_opt_in`), and a 12-tone D3D12 hardware + WARP test (`raise_opt_in_chroma_scrub_filters_spikes_and_preserves_scene_tones_on_hardware_and_warp`). - `crates/victory-gpu/src/indirect.rs`: `#[cfg(test)]` `pub(crate)` visibility on `WarpHarness::on` for test reuse. ## Verification Verified on local D3D12 hardware (NVIDIA GeForce RTX 4070 SUPER) and WARP (`VICTORY_D3D12_DEBUG=1`, `--test-threads=1`, `0` D3D12 debug layer errors): - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` (default & `--features diagnostics`): **0 warnings**. - `cargo test -p victory-gpu --locked ambient::tests -- --test-threads=1` (default & `--features diagnostics`): **9/9 passed** on both hardware and WARP, confirming in both `scrub_on=false` (default) and `scrub_on=true` (`VICTORY_AMBIENT_CHROMA_SCRUB=1`): - Default mode preserves exact upstream behavior (only existing magenta filter runs). - Opt-in mode scrubs violet, acid-green, and electric-cyan spikes to the spatial estimate. - Neutral daylight, blue sky, coastal water, deep water, warm sunset, warm lamp lighting, natural foliage bounce, and deep foliage bounce are preserved in both modes. - `cargo run -p xtask --locked -- policy` & `cargo test -p xtask --locked`: **11/11 passed**.
TaynanGT commented 2026-11-27 13:37:42 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T13:37:42Z.


@Vladimir-Human This is the right scope for a separate image test. Use the same foliage move with the flag off and on, plus a shot containing deliberate violet or cyan light. The 12-tone test gives us a synthetic reference for what the filter is supposed to preserve.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7219733542 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/280#issuecomment-7219733542). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T13:37:42Z. --- @Vladimir-Human This is the right scope for a separate image test. Use the same foliage move with the flag off and on, plus a shot containing deliberate violet or cyan light. The 12-tone test gives us a synthetic reference for what the filter is supposed to preserve.
TaynanGT commented 2026-11-30 17:13:29 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:13:29Z.


main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7285917321 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/280#issuecomment-7285917321). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-30T17:13:29Z. --- `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

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
TaynanGT/Vice-Tay!280
No description provided.