NVIDIA: rays miss unbuilt structures (purple plants) + NaN scrub #82

Manually merged
github merged 2 commits from github-bot/gh-82 into main 2026-11-28 19:02:54 +00:00 AGit
Owner

@⁠vvzxcvv on GitHub · 2026-11-27 17:22 UTC · original
vvzxcvv:nvidia-bvh-miss-nan-scrub → main · +76 −3 · 4 files · 2 commits · merged 2026-11-28 19:01 UTC

Problem

On NVIDIA, vegetation outdoors renders purple, magenta or violet instead of green, identically every run in the same spot. Separately, NaN or infinity values written by shaders can spread into black blobs (faces, sky) or white flashes through bloom, blur and the temporal upscaler.

1. Rays miss every node while the structure builder is off (VICTORY_BVH_MISS)

With the title's structure builder off (its wave64 programs don't run on NVIDIA), the ray-tracing structures are never built, but the node test in emit/intersect.rs still walked whatever lay in their memory. The screen-probe traces turned those false hits into violet and magenta light (the leftovers 826ba15 partly filters), which shows most on vegetation. With the switch on, every node test is a miss without reading the node, so each walk ends at its first node. It stays off while VICTORY_BVH_BUILDER=1.

This is a stopgap until the structure builder runs on NVIDIA; it switches itself off when VICTORY_BVH_BUILDER=1.

2. NaN scrub (VICTORY_NAN_SCRUB)

Pixel-shader colour exports and float image stores become 0 where |x| >= inf (NaN included), so one bad value can't spread through the title's blur and temporal passes.

Both are part of the shader cache key and on in the play settings. Both are ported from rorodev6's victory-nvidia-megafork.

Tested

RTX 4070 Ti SUPER (610.88), Ryzen 7 7800X3D, 32 GB, Windows 10 22H2 (Agility SDK 1.620), release build, Series S, DLSS Quality:

  • Vegetation: green again (was purple and magenta); the megafork renders the same spot green.
  • Frame rate: unchanged (18.0 versus 18.2 fps average in the open world).
  • Trade-off: light bounced off nearby surfaces is lost, so some dim rooms may be slightly darker.
**@⁠vvzxcvv** on GitHub · 2026-11-27 17:22 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/82) `vvzxcvv:nvidia-bvh-miss-nan-scrub` → `main` · +76 −3 · 4 files · 2 commits · merged 2026-11-28 19:01 UTC Problem On NVIDIA, vegetation outdoors renders purple, magenta or violet instead of green, identically every run in the same spot. Separately, NaN or infinity values written by shaders can spread into black blobs (faces, sky) or white flashes through bloom, blur and the temporal upscaler. ### 1. Rays miss every node while the structure builder is off (VICTORY_BVH_MISS) With the title's structure builder off (its wave64 programs don't run on NVIDIA), the ray-tracing structures are never built, but the node test in emit/intersect.rs still walked whatever lay in their memory. The screen-probe traces turned those false hits into violet and magenta light (the leftovers 826ba15 partly filters), which shows most on vegetation. With the switch on, every node test is a miss without reading the node, so each walk ends at its first node. It stays off while VICTORY_BVH_BUILDER=1. This is a stopgap until the structure builder runs on NVIDIA; it switches itself off when VICTORY_BVH_BUILDER=1. ### 2. NaN scrub (VICTORY_NAN_SCRUB) Pixel-shader colour exports and float image stores become 0 where |x| >= inf (NaN included), so one bad value can't spread through the title's blur and temporal passes. Both are part of the shader cache key and on in the play settings. Both are ported from rorodev6's victory-nvidia-megafork. Tested RTX 4070 Ti SUPER (610.88), Ryzen 7 7800X3D, 32 GB, Windows 10 22H2 (Agility SDK 1.620), release build, Series S, DLSS Quality: - Vegetation: green again (was purple and magenta); the megafork renders the same spot green. - Frame rate: unchanged (18.0 versus 18.2 fps average in the open world). - Trade-off: light bounced off nearby surfaces is lost, so some dim rooms may be slightly darker.
With the title's structure builder off (its wave64 programs do not run on
NVIDIA), the ray-tracing structures are never built, but the node test in
emit/intersect.rs still walked whatever lay in their memory. The screen-probe
traces turned those false hits into light: violet/magenta leftovers (see
826ba15) that show most on vegetation, which turned purple/magenta outdoors.

VICTORY_BVH_MISS=1 makes every node test a miss without reading the node: a
box returns no child (bvh::NONE), a triangle bvh::MISS, so a walk ends at its
first node. It stays off while VICTORY_BVH_BUILDER=1 (F1 ray tracing), when
the structures are real. Part of the shader cache key; on in the play
settings. Ported from rorodev6's victory-nvidia-megafork.

Tested: RTX 4070 Ti SUPER, Windows 10 22H2 (Agility SDK 1.620), release build,
Series S, DLSS Quality: vegetation green again (was purple/magenta), frame
rate unchanged (18.0 vs 18.2 fps average in the open world). Trade-off: light
bounced off nearby surfaces is lost, some dim rooms may be a little darker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A NaN that a pixel shader writes, or a float image store, reaches the title's
bloom, blur and temporal upscaler and spreads into black patches that stay in
its history (black blobs on faces and in the air on NVIDIA); an infinity
through bloom or the exposure turns the picture white.

VICTORY_NAN_SCRUB=1 (Lower::scrub_nan in emit/lower.rs): a colour a pixel
shader exports, and each float component of an image store, is 0 where
|x| >= inf (unordered compare, so NaN too). Not what the console does, so it
is a switch; part of the shader cache key; on in the play settings. Ported
from rorodev6's victory-nvidia-megafork.

Tested: RTX 4070 Ti SUPER, Windows 10 22H2, release build, Series S, DLSS
Quality: runs, no visible change in frame rate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 17:31:23 +00:00
Author
Owner

@⁠eleboucher on GitHub · 2026-11-28 10:19 UTC · original

Two problems I found testing this on an RTX 4070 Ti SUPER (Windows 11, ray tracing on with VICTORY_RT_NATIVE=1):

  1. bvh_miss() only turns itself off for VICTORY_BVH_BUILDER=1, but builder_asked() in pipeline/make.rs treats VICTORY_RT_NATIVE=1 as the builder running too. With RT_NATIVE and VICTORY_BVH_MISS=1 every ray missed (violet eyes in a close-up; brown irises after the fix).
  2. The shader cache hashed the raw VICTORY_BVH_MISS value, so a run with the builder on could be served always-miss translations cached by a run without it. The key should be the effective bvh_miss() result.

The fix is one commit on top of this PR's head: github.com/eleboucher/VIctory-NVIDIA@fb765c7c (branch up-bvh-miss-fix on eleboucher/VIctory-NVIDIA). It makes bvh_miss() public, also checks VICTORY_RT_NATIVE, and pushes its result into the cache key instead of the env var. Windows type-check and cargo test -p victory-shader --lib pass on it.

**@⁠eleboucher** on GitHub · 2026-11-28 10:19 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/82#issuecomment-7237818464) Two problems I found testing this on an RTX 4070 Ti SUPER (Windows 11, ray tracing on with VICTORY_RT_NATIVE=1): 1. `bvh_miss()` only turns itself off for VICTORY_BVH_BUILDER=1, but `builder_asked()` in pipeline/make.rs treats VICTORY_RT_NATIVE=1 as the builder running too. With RT_NATIVE and VICTORY_BVH_MISS=1 every ray missed (violet eyes in a close-up; brown irises after the fix). 2. The shader cache hashed the raw VICTORY_BVH_MISS value, so a run with the builder on could be served always-miss translations cached by a run without it. The key should be the effective `bvh_miss()` result. The fix is one commit on top of this PR's head: https://github.com/eleboucher/VIctory-NVIDIA/commit/fb765c7c (branch `up-bvh-miss-fix` on eleboucher/VIctory-NVIDIA). It makes `bvh_miss()` public, also checks VICTORY_RT_NATIVE, and pushes its result into the cache key instead of the env var. Windows type-check and `cargo test -p victory-shader --lib` pass on it.
github-bot referenced this pull request from a commit 2026-11-28 19:02:00 +00:00
github manually merged commit e73ae09d8f into main 2026-11-28 19:02:54 +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!82
No description provided.