Volumetric fog: light inside a FogVolume is attenuated over the whole volume's bounding radius, so large volumes get almost no light

Open
#26,669 0 comments 0 reactions 0 assignees View on GitHub

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

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

C-Bug S-Needs-Triage

Bevy version and features

  • 0.20.1
  • Default features; the camera has VolumetricFog, the sun is a DirectionalLight with
    shadows and VolumetricLight.

[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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bevyengine/bevy

All issues in bevyengine/bevy

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.