fix(volumetrics): distribute froxel slices by view depth #976

Merged
SakulFlee merged 1 commit from fix/volumetric-linear-depth into main 2026-10-29 21:08:22 +00:00
Owner

Summary

Fixes the froxel depth distribution.

The volumetric grid was addressing slices directly with NDC depth. With a typical near plane of 0.1 and a far plane of 10000, almost every slice ended up in the first few centimetres/metres of the view, so room-distance fog and spot cones were severely undersampled. That explains why cones appeared only at specific camera angles, why quality changes looked so different, and why low quality produced isolated blobs.

Changes:

  • Froxel slices now represent linear view-space distance from the camera.
  • Injection reconstructs the view ray from the projection inverse and places each froxel at the linear slice depth.
  • Composite converts the scene depth to view-space depth and samples the froxel grid with the same linear mapping.
  • Works for both perspective and orthographic cameras via the near/far ray difference.
  • Added a short anisotropy explanation to the Rendering panel.

Validation

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

Related: #975, #971.

## Summary Fixes the froxel depth distribution. The volumetric grid was addressing slices directly with NDC depth. With a typical near plane of `0.1` and a far plane of `10000`, almost every slice ended up in the first few centimetres/metres of the view, so room-distance fog and spot cones were severely undersampled. That explains why cones appeared only at specific camera angles, why quality changes looked so different, and why low quality produced isolated blobs. Changes: - Froxel slices now represent **linear view-space distance** from the camera. - Injection reconstructs the view ray from the projection inverse and places each froxel at the linear slice depth. - Composite converts the scene depth to view-space depth and samples the froxel grid with the same linear mapping. - Works for both perspective and orthographic cameras via the near/far ray difference. - Added a short anisotropy explanation to the Rendering panel. ## Validation - `cargo test -p orbital_renderer -p orbital_debug_ui --all-targets` passes, including the noop volumetric pipelines. - `cargo check --workspace` with the workspace clippy driver and `-D warnings` passes. - `rustfmt --check` passes. - No GPU visual validation was possible locally. Related: #975, #971.
fix(volumetrics): distribute froxel slices by view depth
All checks were successful
Lint / lint (pull_request) Successful in 1m33s
PR / test (pull_request) Successful in 3m53s
f8bd72e4ec

Smart test results

Result: PASS

Scope: orbital_debug_ui, orbital_renderer

Reason: directly changed crates

Elapsed: 3m 19s

Workflow run

Overall: 66 tests, 65 passed, 0 failed, 1 skipped

Nextest: 65 tests, 65 passed, 0 failed, 0 skipped
Doctests: 1 tests, 0 passed, 0 failed, 1 skipped

Outcome charts are split between nextest and doctests. The timing chart covers nextest only.

Crate Nextest Passed Failed Skipped Doctests Time
orbital_debug_ui 48 48 0 0 0/1 0.25s
orbital_renderer 17 17 0 0 - 0.16s
pie showData
    title Nextest outcomes
    "Passed" : 65
pie showData
    title Doctest outcomes
    "Skipped" : 1
xychart-beta
    title "Slowest crates (nextest seconds)"
    x-axis ["orbital_debug_ui", "orbital_renderer"]
    y-axis "Seconds" 0 --> 1
    bar [0.25, 0.16]
<!-- orbital-ci-test-results --> ## Smart test results **Result:** PASS **Scope:** orbital_debug_ui, orbital_renderer **Reason:** directly changed crates **Elapsed:** 3m 19s [Workflow run](https://forgejo.sakul-flee.de/SakulFlee/Orbital/actions/runs/861) **Overall:** 66 tests, 65 passed, 0 failed, 1 skipped **Nextest:** 65 tests, 65 passed, 0 failed, 0 skipped **Doctests:** 1 tests, 0 passed, 0 failed, 1 skipped _Outcome charts are split between nextest and doctests. The timing chart covers nextest only._ | Crate | Nextest | Passed | Failed | Skipped | Doctests | Time | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | orbital_debug_ui | 48 | 48 | 0 | 0 | 0/1 | 0.25s | | orbital_renderer | 17 | 17 | 0 | 0 | - | 0.16s | ```mermaid pie showData title Nextest outcomes "Passed" : 65 ``` ```mermaid pie showData title Doctest outcomes "Skipped" : 1 ``` ```mermaid xychart-beta title "Slowest crates (nextest seconds)" x-axis ["orbital_debug_ui", "orbital_renderer"] y-axis "Seconds" 0 --> 1 bar [0.25, 0.16] ```
Sign in to join this conversation.
No description provided.