Volumetric fog: ambient light is added once per ray and ignores density
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- computer-graphics, game-dev
Direzione di ricerca
Read bevy_pbr/src/volumetric_fog/volumetric_fog.wesl, especially the ambient initialization before the ray march and the directional light accumulation inside it. Compare the ambient term with the march's density and background_alpha handling. Done when ambient glow follows fog density and empty areas no longer show a veil; check the result with a density texture that has both dense and zero-density regions.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bevy version and features
- 0.20.1
- Default features; the camera has
VolumetricFogwith a non-zeroambient_intensity.
[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
A FogVolume with a 3D density texture (patchy ground fog: dense in some places, zero in
others) and VolumetricFog::ambient_intensity > 0.
What went wrong
- Expected: ambient light scattered by the fog, so more fog → more ambient glow, and no glow
where the density is zero. - Actual: the ambient term doesn't depend on density at all. Pixels with short rays through
the volume (objects close to the camera) get the fullambient_color * ambient_intensity,
including where the density texture is zero: a uniform veil. Long rays through a large volume
get almost none, so large volumes look dark.
Additional information
bevy_pbr/src/volumetric_fog/volumetric_fog.wesl, before the ray march:
// Use Beer's law again to accumulate the ambient light all along the path.
var accumulated_color = exp(-ray_length_view * (absorption + scattering)) * ambient_color *
ambient_intensity;
The comment says the ambient light is accumulated along the path, but it is added once, before
the march. It isn't multiplied by density, fog_color or scattering, and the
exp(-ray_length_view * ...) term uses the full ray length without density, so it doesn't
match the background_alpha that the march computes.
Workaround / proposed fix: start from zero and accumulate the ambient light inside the march
loop, the same way as the directional light:
var accumulated_color = vec3(0.0);
...
background_alpha *= sample_attenuation;
accumulated_color += ambient_color * ambient_intensity * fog_color * scattering * density *
step_size_world * exposure * background_alpha;
With this change the ambient glow follows the fog density and the veil over empty areas is
gone. Note that it changes how bright a given ambient_intensity looks.
Related: #26669 (direct light in large volumes).
Tested on one machine.
- Lingua principale
- Rust
- Stelle
- 50k
- Fork
- 5.1k
- Merge medio
- 2g 20h
- PR unite (30g)
- 129
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bevyengine/bevy
-
C-Bug S-Needs-Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
bevyengine/bevy#26718 ·
I maintainer di solito rispondono entro 2 giorni
-
C-Bug S-Needs-Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bevyengine/bevy#26689 ·
I maintainer di solito rispondono entro 2 giorni
-
Volumetric fog: a `FogVolume` with `Visibility::Hidden` is still renderedForse già presa @adityawrk l’ha presa 2 giorni fa. ApertaC-Bug S-Needs-Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
bevyengine/bevy#26688 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
bevyengine/bevy#26684 ·
I maintainer di solito rispondono entro 2 giorni
-
Create a bevy_fuzzy exampleForse già presa @Tatsuya0330 l’ha presa 1 giorno fa. ApertaA-UI C-Examples C-Feature D-Straightforward S-Needs-Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bevyengine/bevy#26676 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di bevyengine/bevy
Issue simili
-
area:ui effort:medium enhancement P7 source:agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
marketing
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
machine rename accepts a label already used by another machine, making --machine <label> ambiguousApertamaintainer-needed p2 remote triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
userFRM/egui-charts#4605 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno