feat(renderer): add froxel volumetric lighting and height fog #956

Merged
SakulFlee merged 1 commit from feat/renderer-volumetrics into main 2026-10-27 22:04:25 +00:00
Owner

Summary

Adds opt-in froxel volumetric lighting and height fog to the 3D renderer.

  • New VolumetricSettings ECS resource with density, scattering, extinction, Henyey-Greenstein anisotropy, height fog, ambient color, maximum distance, and Low/Medium/High/Custom quality tiers. Volumetrics remain disabled unless the resource is present and enabled is true.
  • A compute pass injects height fog and shadowed directional/punctual light scattering into a 3D rgba16float froxel grid (4x4x4 workgroups).
  • A fullscreen composite pass integrates the froxel grid in view distance, applies transmittance to the scene color, and adds accumulated in-scattering before tonemapping.
  • The render graph gains volumetric-inject and volumetric-composite passes after transparency and before tonemap. When volumetrics are disabled, the previous graph and cost are unchanged.
  • New Examples/volumetrics scene with two shadow-casting spotlights and a height fog layer.
  • Shadow PCF sampling now uses textureSampleCompareLevel so shadow lookups are legal in compute; shadow maps are single-mip, so fragment behavior is unchanged.

Usage

world.insert_resource(VolumetricSettings {
    enabled: true,
    density: 0.008,
    height_density: 0.06,
    quality: VolumetricQuality::Medium,
    ..Default::default()
});

Validation

  • cargo test --workspace --no-fail-fast passes.
  • All 26 WGSL validation tests pass, including node-assembled volumetric inject and composite shaders.
  • cargo check --workspace passes with the workspace clippy driver and -D warnings.
  • Rust formatting checks pass across Crates/ and Examples/.
  • The new example is compiled but not visually verified locally because no display/GPU is available in this environment.

Part of the v1.6.0 renderer overhaul (#877).

## Summary Adds opt-in froxel volumetric lighting and height fog to the 3D renderer. - New `VolumetricSettings` ECS resource with density, scattering, extinction, Henyey-Greenstein anisotropy, height fog, ambient color, maximum distance, and Low/Medium/High/Custom quality tiers. Volumetrics remain disabled unless the resource is present and `enabled` is true. - A compute pass injects height fog and shadowed directional/punctual light scattering into a 3D `rgba16float` froxel grid (`4x4x4` workgroups). - A fullscreen composite pass integrates the froxel grid in view distance, applies transmittance to the scene color, and adds accumulated in-scattering before tonemapping. - The render graph gains `volumetric-inject` and `volumetric-composite` passes after transparency and before tonemap. When volumetrics are disabled, the previous graph and cost are unchanged. - New `Examples/volumetrics` scene with two shadow-casting spotlights and a height fog layer. - Shadow PCF sampling now uses `textureSampleCompareLevel` so shadow lookups are legal in compute; shadow maps are single-mip, so fragment behavior is unchanged. ## Usage ```rust world.insert_resource(VolumetricSettings { enabled: true, density: 0.008, height_density: 0.06, quality: VolumetricQuality::Medium, ..Default::default() }); ``` ## Validation - `cargo test --workspace --no-fail-fast` passes. - All 26 WGSL validation tests pass, including node-assembled volumetric inject and composite shaders. - `cargo check --workspace` passes with the workspace clippy driver and `-D warnings`. - Rust formatting checks pass across `Crates/` and `Examples/`. - The new example is compiled but not visually verified locally because no display/GPU is available in this environment. Part of the v1.6.0 renderer overhaul (#877).
feat(renderer): add froxel volumetric lighting and height fog
Some checks failed
Templates / templates (pull_request) Has been cancelled
PR / test (pull_request) Has been cancelled
Lint / lint (pull_request) Has been cancelled
88ee8b88de
SakulFlee force-pushed feat/renderer-volumetrics from 88ee8b88de
Some checks failed
Templates / templates (pull_request) Has been cancelled
PR / test (pull_request) Has been cancelled
Lint / lint (pull_request) Has been cancelled
to 9f3e1b6fee
Some checks failed
Lint / lint (pull_request) Successful in 1m46s
PR / test (pull_request) Has been cancelled
Templates / templates (pull_request) Has been cancelled
2026-10-27 20:53:49 +00:00
Compare
SakulFlee force-pushed feat/renderer-volumetrics from 9f3e1b6fee
Some checks failed
Lint / lint (pull_request) Successful in 1m46s
PR / test (pull_request) Has been cancelled
Templates / templates (pull_request) Has been cancelled
to 03148a476c
All checks were successful
Lint / lint (pull_request) Successful in 3m30s
Templates / templates (pull_request) Successful in 11m44s
PR / test (pull_request) Successful in 17m7s
2026-10-27 20:58:40 +00:00
Compare

Smart test results

Result: PASS

Scope: full workspace

Reason: workspace-level change: Cargo.lock

Elapsed: 12m 17s

Workflow run

Overall: 462 tests, 452 passed, 0 failed, 10 skipped

Nextest: 451 tests, 451 passed, 0 failed, 0 skipped
Doctests: 11 tests, 1 passed, 0 failed, 10 skipped

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

Crate Nextest Passed Failed Skipped Doctests Time
orbital 1 1 0 0 - 8.99s
orbital_2d 29 29 0 0 0/1 0.66s
orbital_app 10 10 0 0 0/1 0.18s
orbital_camera 8 8 0 0 - 0.16s
orbital_core 2 2 0 0 - 0.04s
orbital_debug_render 0 0 0 0 0/1 0.00s
orbital_debug_ui 45 45 0 0 0/1 0.91s
orbital_ecs 114 114 0 0 0/2 2.54s
orbital_ecs_bridge 42 42 0 0 - 0.81s
orbital_file_manager 5 5 0 0 - 0.57s
orbital_iced 25 25 0 0 - 0.52s
orbital_importer_gltf 14 14 0 0 - 0.38s
orbital_input 11 11 0 0 - 0.18s
orbital_light 6 6 0 0 - 0.12s
orbital_macros 0 0 0 0 0/1 0.00s
orbital_material_shader 2 2 0 0 - 0.04s
orbital_math 4 4 0 0 - 0.08s
orbital_procgeo 2 2 0 0 - 0.04s
orbital_render_graph 6 6 0 0 - 0.12s
orbital_renderer 9 9 0 0 - 0.18s
orbital_resources 26 26 0 0 - 1.38s
orbital_shader_core 0 0 0 0 1/1 0.00s
orbital_shader_pbr 4 4 0 0 - 0.09s
orbital_shader_preprocessor 12 12 0 0 - 0.25s
orbital_shadow 3 3 0 0 - 0.08s
orbital_text 14 14 0 0 0/1 1.29s
orbital_texture 11 11 0 0 - 0.21s
orbital_touch_ui 1 1 0 0 0/1 0.04s
orbital_ui 32 32 0 0 0/1 0.86s
orbital_world_environment 13 13 0 0 - 0.28s
pie showData
    title Nextest outcomes
    "Passed" : 451
pie showData
    title Doctest outcomes
    "Passed" : 1
    "Skipped" : 10
xychart-beta
    title "Slowest crates (nextest seconds)"
    x-axis ["orbital", "orbital_ecs", "orbital_resources", "orbital_text", "orbital_debug_ui", "orbital_ui", "orbital_ecs_bridge", "orbital_2d"]
    y-axis "Seconds" 0 --> 9
    bar [8.99, 2.54, 1.38, 1.29, 0.91, 0.86, 0.81, 0.66]
<!-- orbital-ci-test-results --> ## Smart test results **Result:** PASS **Scope:** full workspace **Reason:** workspace-level change: Cargo.lock **Elapsed:** 12m 17s [Workflow run](https://forgejo.sakul-flee.de/SakulFlee/Orbital/actions/runs/750) **Overall:** 462 tests, 452 passed, 0 failed, 10 skipped **Nextest:** 451 tests, 451 passed, 0 failed, 0 skipped **Doctests:** 11 tests, 1 passed, 0 failed, 10 skipped _Outcome charts are split between nextest and doctests. The timing chart covers nextest only._ | Crate | Nextest | Passed | Failed | Skipped | Doctests | Time | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | orbital | 1 | 1 | 0 | 0 | - | 8.99s | | orbital_2d | 29 | 29 | 0 | 0 | 0/1 | 0.66s | | orbital_app | 10 | 10 | 0 | 0 | 0/1 | 0.18s | | orbital_camera | 8 | 8 | 0 | 0 | - | 0.16s | | orbital_core | 2 | 2 | 0 | 0 | - | 0.04s | | orbital_debug_render | 0 | 0 | 0 | 0 | 0/1 | 0.00s | | orbital_debug_ui | 45 | 45 | 0 | 0 | 0/1 | 0.91s | | orbital_ecs | 114 | 114 | 0 | 0 | 0/2 | 2.54s | | orbital_ecs_bridge | 42 | 42 | 0 | 0 | - | 0.81s | | orbital_file_manager | 5 | 5 | 0 | 0 | - | 0.57s | | orbital_iced | 25 | 25 | 0 | 0 | - | 0.52s | | orbital_importer_gltf | 14 | 14 | 0 | 0 | - | 0.38s | | orbital_input | 11 | 11 | 0 | 0 | - | 0.18s | | orbital_light | 6 | 6 | 0 | 0 | - | 0.12s | | orbital_macros | 0 | 0 | 0 | 0 | 0/1 | 0.00s | | orbital_material_shader | 2 | 2 | 0 | 0 | - | 0.04s | | orbital_math | 4 | 4 | 0 | 0 | - | 0.08s | | orbital_procgeo | 2 | 2 | 0 | 0 | - | 0.04s | | orbital_render_graph | 6 | 6 | 0 | 0 | - | 0.12s | | orbital_renderer | 9 | 9 | 0 | 0 | - | 0.18s | | orbital_resources | 26 | 26 | 0 | 0 | - | 1.38s | | orbital_shader_core | 0 | 0 | 0 | 0 | 1/1 | 0.00s | | orbital_shader_pbr | 4 | 4 | 0 | 0 | - | 0.09s | | orbital_shader_preprocessor | 12 | 12 | 0 | 0 | - | 0.25s | | orbital_shadow | 3 | 3 | 0 | 0 | - | 0.08s | | orbital_text | 14 | 14 | 0 | 0 | 0/1 | 1.29s | | orbital_texture | 11 | 11 | 0 | 0 | - | 0.21s | | orbital_touch_ui | 1 | 1 | 0 | 0 | 0/1 | 0.04s | | orbital_ui | 32 | 32 | 0 | 0 | 0/1 | 0.86s | | orbital_world_environment | 13 | 13 | 0 | 0 | - | 0.28s | ```mermaid pie showData title Nextest outcomes "Passed" : 451 ``` ```mermaid pie showData title Doctest outcomes "Passed" : 1 "Skipped" : 10 ``` ```mermaid xychart-beta title "Slowest crates (nextest seconds)" x-axis ["orbital", "orbital_ecs", "orbital_resources", "orbital_text", "orbital_debug_ui", "orbital_ui", "orbital_ecs_bridge", "orbital_2d"] y-axis "Seconds" 0 --> 9 bar [8.99, 2.54, 1.38, 1.29, 0.91, 0.86, 0.81, 0.66] ```
SakulFlee deleted branch feat/renderer-volumetrics 2026-10-27 22:04:25 +00:00
Sign in to join this conversation.
No description provided.