fix(volumetrics): prevent zero-depth NaN flashes #990

Merged
SakulFlee merged 1 commit from fix/volumetric-zero-depth into main 2026-10-30 18:32:42 +00:00
Owner

Summary

Fixes the periodic white flashes in volumetrics and restores the AiO spotlight animation.

Root cause

The first froxel slice can be jittered to exactly zero view depth. That makes the reconstructed world position equal the camera position, so:

normalize(world_position - camera.position)

normalizes a zero vector and writes NaNs into the froxel texture. Depending on temporal history, the NaNs appear either as local bright model fragments or as a whole-screen flash after filtering/tonemapping.

Fix

  • Clamp the froxel sample depth to at least 0.01.
  • Guard the view-direction normalization with a fallback direction.
  • Restore the temporary animated spotlight in AiO now that the actual cause is fixed.

Validation

  • cargo test -p orbital_renderer --all-targets passes.
  • cargo check --workspace with the workspace clippy driver and -D warnings passes.
  • rustfmt --check passes.
  • No GPU visual validation was possible locally.

Related: #986, #989.

## Summary Fixes the periodic white flashes in volumetrics and restores the AiO spotlight animation. ## Root cause The first froxel slice can be jittered to exactly zero view depth. That makes the reconstructed world position equal the camera position, so: ```wgsl normalize(world_position - camera.position) ``` normalizes a zero vector and writes NaNs into the froxel texture. Depending on temporal history, the NaNs appear either as local bright model fragments or as a whole-screen flash after filtering/tonemapping. ## Fix - Clamp the froxel sample depth to at least `0.01`. - Guard the view-direction normalization with a fallback direction. - Restore the temporary animated spotlight in AiO now that the actual cause is fixed. ## Validation - `cargo test -p orbital_renderer --all-targets` passes. - `cargo check --workspace` with the workspace clippy driver and `-D warnings` passes. - `rustfmt --check` passes. - No GPU visual validation was possible locally. Related: #986, #989.
fix(volumetrics): prevent zero-depth NaN flashes
All checks were successful
Lint / lint (pull_request) Successful in 1m36s
PR / test (pull_request) Successful in 4m28s
Templates / templates (pull_request) Successful in 3m33s
855cc82d32

Smart test results

Result: PASS

Scope: orbital_renderer

Reason: directly changed crates

Elapsed: 3m 51s

Workflow run

Overall: 18 tests, 18 passed, 0 failed, 0 skipped

Nextest: 18 tests, 18 passed, 0 failed, 0 skipped
Doctests: no tests reported

Crate Nextest Passed Failed Skipped Doctests Time
orbital_renderer 18 18 0 0 - 0.38s
pie showData
    title Nextest outcomes
    "Passed" : 18
<!-- orbital-ci-test-results --> ## Smart test results **Result:** PASS **Scope:** orbital_renderer **Reason:** directly changed crates **Elapsed:** 3m 51s [Workflow run](https://forgejo.sakul-flee.de/SakulFlee/Orbital/actions/runs/903) **Overall:** 18 tests, 18 passed, 0 failed, 0 skipped **Nextest:** 18 tests, 18 passed, 0 failed, 0 skipped **Doctests:** no tests reported | Crate | Nextest | Passed | Failed | Skipped | Doctests | Time | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | orbital_renderer | 18 | 18 | 0 | 0 | - | 0.38s | ```mermaid pie showData title Nextest outcomes "Passed" : 18 ```
Sign in to join this conversation.
No description provided.