DistanceFog has no effect on Adreno 830/840 (Vulkan): apply_fog returns the colour unfogged
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- android, rust
- Domain
- computer-graphics
Research direction
Start in crates/bevy_pbr/src/render/pbr_functions.wesl, in main_pass_post_lighting_processing, where apply_fog receives view_bindings::fog directly. The reported workaround copies that uniform into a local variable first, so try it there and check whether the fog behaves the same. Done means the fog renders on the affected Adreno devices without changing results on desktop, which needs an Android device to verify.
Written by the indexing model from the issue text.
Description
Bevy version and features
0.20.1, with the android-native-activity feature. The same call is still in main.
Relevant system information
Two Android phones, both affected:
- Adreno (TM) 840, Vulkan, Android 16 (OnePlus CPH2747).
Driver Build: bd918c8d8b, Id7378d798a, 1781154747, Date: 06/11/26, Compiler Version: E031.50.19.31 - Adreno (TM) 830, Vulkan, Android 17 (OnePlus CPH2671).
Driver Build: 53a40df626, I4a8465d626, 1790589655, Date: 09/28/26, Compiler Version: E031.47.18.56
Desktop (Linux, Vulkan) draws the fog correctly from the same code.
What you did
Added DistanceFog with FogFalloff::Linear { start: 24.0, end: 100.0 } to a
non-HDR Camera3d (with Msaa::Off and NoIndirectDrawing) in a scene with
one shadow-casting DirectionalLight and StandardMaterial meshes.
What went wrong
On both phones no surface is fogged at any distance. Nothing is logged: no
shader, pipeline or validation error. ExponentialSquared falloff behaves the
same way.
Additional information
I narrowed it down with a custom Material whose fragment shader imports
mesh_view_bindings::fog and colours its output by the result of each test.
On the phones:
| Test in the fragment shader | Result |
|---|---|
Read fog.mode, fog.be.xy, fog.base_color directly |
correct values |
fog::linear_fog(fog, color, 200.0, vec3(0.0)) |
fogged (correct) |
pbr_functions::apply_fog(fog, color, far, eye, frag_coord) |
unfogged |
var f = fog; pbr_functions::apply_fog(f, color, far, eye, frag_coord) |
fogged (correct) |
A copy of apply_fog without the scattering block, called with fog |
unfogged |
The same copy ending in a direct linear_fog call instead of the if mode == … chain |
fogged (correct) |
So the uniform data is fine. The call fails only when the uniform struct is
passed directly as the argument of a function that contains the
if fog_params.mode == … chain. Copying the uniform into a local variable
first makes the same call work. This looks like an Adreno driver compiler bug.
All of these tests give the fogged result on desktop.
Workaround
Changing the one call in main_pass_post_lighting_processing
(crates/bevy_pbr/src/render/pbr_functions.wesl) fixes the fog on both phones:
// before
output_color = apply_fog(
view_bindings::fog,
...
// after
var fog_params = view_bindings::fog;
output_color = apply_fog(
fog_params,
...
- Dominant language
- Rust
- Stars
- 49.8k
- Forks
- 5.1k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 136
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
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
bevyengine/bevy#26642 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
bevyengine/bevy#26641 ·
Maintainers usually reply within 2 days
-
A-Animation AI-Assisted C-Bug D-Trivial S-Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bevyengine/bevy#26637 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bevyengine/bevy#26635 ·
Maintainers usually reply within 2 days
-
Feathers checkbox outline should have flex_shrink: 0Possibly taken @Tatsuya0330 claimed this today. OpenC-Bug S-Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
bevyengine/bevy#26630 ·
Maintainers usually reply within 2 days
Similar issues
-
go good first issue test
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
bug triaged tui ux wontfix
Difficulty 2/5 Half a day Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day