feat(gpu/ambient): bound near-field air cap, scrub per-channel, add probe outlier filter #263

Merged
Androtim merged 1 commit from upstream-pr/263 into main 2026-11-30 22:53:01 +00:00
Androtim commented 2026-11-30 21:51:23 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-30T21:51:23Z.


Summary

  • Mark the t0 depth SRV descriptor range in crates/victory-gpu/src/ambient.rs as DESCRIPTORS_VOLATILE so passes that bind an image UAV handle in that slot (keep and mean) avoid static-descriptor type mismatch validation errors.
  • Bound near-field volumetric air inscattering in clear_air by min(cells_luma, seen_luma) so bright menus, lamps, or outdoor history do not flood dark interiors with milky haze while preserving window-to-exterior interpolation.
  • Scrub NaN/Inf/negative values per channel instead of whole-vector in raise for both found and was.
  • Add opt-in VICTORY_AMBIENT_PROBE_OUTLIERS=1 support (RAISE_OUTLIERS variant) to smoothly attenuate unusually bright dim-floor probe outliers while preserving the bounded radiance estimate when ray-tracing structures are unbuilt.
  • Add unit tests for near-field dark-interior air caps, per-channel NaN/Inf/negative scrubbing, and HLSL compilation of RAISE, RAISE_OUTLIERS, and AIR.

Verification

  • xtask policy: passed (315 files ok)
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu ambient:: -- --test-threads=1: passed (14 passed, 0 failed, 1 ignored)
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings: passed (0 warnings)
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --features diagnostics --all-targets -- -D warnings: passed (0 warnings)
<!-- greyfinch-sync:Androtim/MiniVI:issue:5574410176 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/263). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-30T21:51:23Z. --- ### Summary - Mark the `t0` depth SRV descriptor range in `crates/victory-gpu/src/ambient.rs` as `DESCRIPTORS_VOLATILE` so passes that bind an image UAV handle in that slot (`keep` and `mean`) avoid static-descriptor type mismatch validation errors. - Bound near-field volumetric air inscattering in `clear_air` by `min(cells_luma, seen_luma)` so bright menus, lamps, or outdoor history do not flood dark interiors with milky haze while preserving window-to-exterior interpolation. - Scrub NaN/Inf/negative values per channel instead of whole-vector in `raise` for both `found` and `was`. - Add opt-in `VICTORY_AMBIENT_PROBE_OUTLIERS=1` support (`RAISE_OUTLIERS` variant) to smoothly attenuate unusually bright dim-floor probe outliers while preserving the bounded radiance estimate when ray-tracing structures are unbuilt. - Add unit tests for near-field dark-interior air caps, per-channel NaN/Inf/negative scrubbing, and HLSL compilation of `RAISE`, `RAISE_OUTLIERS`, and `AIR`. ### Verification - `xtask policy`: passed (`315 files ok`) - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu ambient:: -- --test-threads=1`: passed (14 passed, 0 failed, 1 ignored) - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings`: passed (0 warnings) - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --features diagnostics --all-targets -- -D warnings`: passed (0 warnings)
Androtim commented 2026-11-30 22:03:13 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-30T22:03:13Z.


Automated triage for the maintainers (not an approval).

Verdict: needs-gpu-test · CI (check): passing

Review Summary

Changes in crates/victory-gpu/src/ambient.rs are clean, well-scoped, and CI is passing. Because this modifies the embedded HLSL compute shaders (RS, clear_air, raise, RAISE_OUTLIERS) and D3D12 root signature descriptor flags, a local real-GPU smoke test is warranted before merging.

Technical Notes

  • Root signature (RS): Adding flags=DESCRIPTORS_VOLATILE to SRV(t0) is valid for RS 1.1 / cs_5_1 and avoids D3D12 validation mismatches when keep and mean bind the image UAV handle in the depth slot without accessing t0.
  • Near-field air cap (clear_air): Clamping room = min(cells_luma, seen_luma) before lerp(room, seen_luma, far) prevents a bright screen mean (menus/lamps) from washing out dark interiors near the camera while preserving near-to-far interpolation toward bright windows. Division by has remains safe since cap >= 0 and has > cap.
  • Per-channel scrubbing (raise): Switching from any(...) to component-wise ternary scrubbing preserves valid channels if a single channel is NaN/Inf/negative; scrubbing was after unpack(light[p]) is a cheap defensive guard.
  • Opt-in probe outlier filter (RAISE_OUTLIERS / VICTORY_AMBIENT_PROBE_OUTLIERS=1):
    • Compiled only when VICTORY_AMBIENT_PROBE_OUTLIERS=1 and dispatched only when !crate::pipeline::builder_runs(), falling back to &pass.raise on compile failure.
    • Because was is unpacked from RGB9E5 (<= 65408.0) and top >= 1e-6, capScale is strictly positive (>= 1e-6 / 65408.0), so found / capScale cannot divide by zero or overflow f32, and multiplying by capScale yields lerp(was * capScale, min(was * capScale, found), reject).
    • Tracking retained = (was * capScale) * (1.0 - reject) for the once > 0.0 path ensures rejected outliers do not inflate the title's bounce share in cells[SHARES + ...].
  • Tests: diffuse_probe_outlier_and_core_shaders_compile verifies HLSL compilation of RAISE, RAISE_OUTLIERS, and AIR; clear_air_cap_bounds_dark_interiors and scrub_channel_keeps_valid_channels cover the scalar logic.

Verdict

needs-gpu-test — logic looks sound and CI passes; verify on a real GPU (including D3D12 debug layer if available) with both default settings and VICTORY_AMBIENT_PROBE_OUTLIERS=1.


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7293279136 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/263#issuecomment-7293279136). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-30T22:03:13Z. --- <!-- minivi-triage v1 head=3d1a1a35ff8d80f122170919e29eb3ad02bf76dc verdict=needs-gpu-test ci=passing at=2026-11-30T22:03:46Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-gpu-test` · **CI (`check`):** `passing` ### Review Summary Changes in `crates/victory-gpu/src/ambient.rs` are clean, well-scoped, and CI is passing. Because this modifies the embedded HLSL compute shaders (`RS`, `clear_air`, `raise`, `RAISE_OUTLIERS`) and D3D12 root signature descriptor flags, a local real-GPU smoke test is warranted before merging. ### Technical Notes - **Root signature (`RS`)**: Adding `flags=DESCRIPTORS_VOLATILE` to `SRV(t0)` is valid for RS 1.1 / `cs_5_1` and avoids D3D12 validation mismatches when `keep` and `mean` bind the image UAV handle in the depth slot without accessing `t0`. - **Near-field air cap (`clear_air`)**: Clamping `room = min(cells_luma, seen_luma)` before `lerp(room, seen_luma, far)` prevents a bright screen mean (menus/lamps) from washing out dark interiors near the camera while preserving near-to-far interpolation toward bright windows. Division by `has` remains safe since `cap >= 0` and `has > cap`. - **Per-channel scrubbing (`raise`)**: Switching from `any(...)` to component-wise ternary scrubbing preserves valid channels if a single channel is NaN/Inf/negative; scrubbing `was` after `unpack(light[p])` is a cheap defensive guard. - **Opt-in probe outlier filter (`RAISE_OUTLIERS` / `VICTORY_AMBIENT_PROBE_OUTLIERS=1`)**: - Compiled only when `VICTORY_AMBIENT_PROBE_OUTLIERS=1` and dispatched only when `!crate::pipeline::builder_runs()`, falling back to `&pass.raise` on compile failure. - Because `was` is unpacked from RGB9E5 (`<= 65408.0`) and `top >= 1e-6`, `capScale` is strictly positive (`>= 1e-6 / 65408.0`), so `found / capScale` cannot divide by zero or overflow `f32`, and multiplying by `capScale` yields `lerp(was * capScale, min(was * capScale, found), reject)`. - Tracking `retained = (was * capScale) * (1.0 - reject)` for the `once > 0.0` path ensures rejected outliers do not inflate the title's bounce share in `cells[SHARES + ...]`. - **Tests**: `diffuse_probe_outlier_and_core_shaders_compile` verifies HLSL compilation of `RAISE`, `RAISE_OUTLIERS`, and `AIR`; `clear_air_cap_bounds_dark_interiors` and `scrub_channel_keeps_valid_channels` cover the scalar logic. ### Verdict `needs-gpu-test` — logic looks sound and CI passes; verify on a real GPU (including D3D12 debug layer if available) with both default settings and `VICTORY_AMBIENT_PROBE_OUTLIERS=1`. --- _Generated with Antigravity CLI (`agy`)._
Androtim commented 2026-11-30 22:52:57 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-30T22:52:57Z.


Dual Verification Suite hardware check on RTX 4060 Ti (Wave 11 stacked #262 + #263 + #267 on origin/main 85d4f80, 45s in-world per profile):

  • Unit tests: cargo test -p victory (38 passed; 0 failed), mbient:: (14 passed; 0 failed; 1 ignored), list:: (16 passed; 0 failed)
  • goal-1440-dlssq (1440p, DLSS Quality, FG off): 3.9 fps median (min 3.5, max_draws=5420), VRAM 7440/6699 MB, dropped=158.5, akes=16 ( ailed=0),
<!-- greyfinch-sync:Androtim/MiniVI:comment:7294427549 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/263#issuecomment-7294427549). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-30T22:52:57Z. --- Dual Verification Suite hardware check on RTX 4060 Ti (Wave 11 stacked #262 + #263 + #267 on origin/main 85d4f80, 45s in-world per profile): - Unit tests: cargo test -p victory (38 passed; 0 failed), mbient:: (14 passed; 0 failed; 1 ignored), list:: (16 passed; 0 failed) - goal-1440-dlssq (1440p, DLSS Quality, FG off): 3.9 fps median (min 3.5, max_draws=5420), VRAM 7440/6699 MB, dropped=158.5, akes=16 ( ailed=0),
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
Androtim/MiniVI!263
No description provided.