Volumetric fog: light inside a FogVolume is attenuated over the whole volume's bounding radius, so large volumes get almost no light
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- computer-graphics, game-dev, performance
Research direction
Start with bevy_pbr/src/volumetric_fog/volumetric_fog.wesl and trace how render.rs computes bounding_radius. Compare the directional, point, and spot light attenuation paths, then inspect the relevant volumetric fog tests or examples. Done means light attenuation reflects the path through the volume toward each light and large sparse volumes no longer lose nearly all direct light.
Written by the indexing model from the issue text.
Description
Bevy version and features
- 0.20.1
- Default features; the camera has
VolumetricFog, the sun is aDirectionalLightwith
shadows andVolumetricLight.
[Optional] Relevant system information
cargo 1.99.1 (5f94df478 2026-08-27)- Windows 11
AdapterInfo { name: "NVIDIA GeForce RTX 5080", vendor: 4318, device: 11266, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "616.92", backend: Vulkan }
What you did
Ground fog over a large open area: one FogVolume around the camera, scaled to a box of
2400 m × 300 m × 2400 m, with a 3D density texture that is mostly empty above the ground
layer.
What went wrong
- Expected: thin fog lit by the sun, brighter where it is thin.
- Actual: the fog gets almost no direct light and looks dark. Making the volume bigger makes it
darker, even when the fog itself (density × thickness) does not change.
Additional information
bevy_pbr/src/volumetric_fog/volumetric_fog.wesl, directional lights (and the same line in the
point/spot light loop):
let light_attenuation = exp(-density * bounding_radius * (absorption + scattering));
bounding_radius is the radius of the sphere around the whole volume (render.rs:
view_from_local.transform_vector3a(Vec3A::splat(0.5)).length()). So every sample is
attenuated as if the light travelled through a full bounding radius of fog at the local
density, no matter where the sample is or how much fog really lies toward the light. For the
2400 × 300 × 2400 m box bounding_radius is ~1.7 km. With density = 0.05,
scattering = 0.35, absorption = 0: exp(-0.05 * 1704 * 0.35) = exp(-30) ≈ 0, so the volume
receives no direct light at all. A small volume with the same density looks fine.
Expected behavior: attenuate over the path from the sample to where the light enters the
volume (distance to the volume boundary along L, from a ray-box intersection in the volume's
local space), or march toward the light through the density texture. For point and spot lights,
over the distance to the light inside the volume.
Workaround we use (a hack, for our case only): replace bounding_radius in that line with a
fixed path length (the thickness of our fog layer), plus a precomputed "sun visibility" channel
in our density texture.
Tested on one machine.
- Dominant language
- Rust
- Stars
- 50k
- Forks
- 5.1k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 129
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bevyengine/bevy
-
C-Bug S-Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bevyengine/bevy#26718 ·
Maintainers usually reply within 2 days
-
C-Bug S-Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bevyengine/bevy#26689 ·
Maintainers usually reply within 2 days
-
Volumetric fog: a `FogVolume` with `Visibility::Hidden` is still renderedPossibly taken @adityawrk claimed this 2 days ago. OpenC-Bug S-Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
bevyengine/bevy#26688 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
bevyengine/bevy#26684 ·
Maintainers usually reply within 2 days
-
Create a bevy_fuzzy examplePossibly taken @Tatsuya0330 claimed this 1 day ago. OpenA-UI C-Examples C-Feature D-Straightforward S-Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bevyengine/bevy#26676 ·
Maintainers usually reply within 2 days
Similar issues
-
area:ui effort:medium enhancement P7 source:agent
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
marketing
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
documentation priority: low tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
nledford/Ladderback#1823 ·
Maintainers usually reply within 1 day
-
psmux-resurrect: restoring a session with a numeric name puts its windows into the wrong session (`new-window -t 4` is read as window 4)Possibly taken @ealwanlee claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
psmux/psmux-plugins#47 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
Maintainers usually reply within 1 day