Shader bugs out and becomes black
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version
Bevy 0.12.1
## Relevant system information
If your bug is rendering-related, copy the adapter info that appears when you run Bevy.
```ignore
AdapterInfo { name: "AMD Radeon RX 6700 XT (RADV NAVI22)", vendor: 4098, device: 29663, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 23.2.1-1ubuntu3.1", backend: Vulkan }
```
## What you did
```rust
const BLUE_COLOR: Color = Color::rgb(0.01, 0.03, 0.39);
commands.spawn((
PbrBundle {
mesh: meshes.add(Mesh::from(shape::Plane::from_size(1000.))),
material: materials.add(StandardMaterial {
base_color: {
let mut color = BLUE_COLOR;
color.set_a(0.4);
color
},
emissive: {
let mut color = BLUE_COLOR;
color.set_a(0.5);
color
},
double_sided: true,
cull_mode: None,
alpha_mode: AlphaMode::Add,
..default()
}),
transform: Transform {
translation: Vec3::new(0., 321.3875, -5120.),
rotation: Quat::from_rotation_x(FRAC_PI_2),
scale: Vec3::new(0.89 * 2., 0., 0.32 * 2.),
},
..default()
},
NotShadowCaster,
NotShadowReceiver,
));
```
## What went wrong
Sometimes the plane bugs out and parts or even the whole thing goes black. Example:


This is the only object type that I've seen this bug on. I have a different copy of this plane with a different color at a different location and it has this same behavior.
As I move the camera around, the black area grows/shrinks randomly (if there is any black part of it.)
## Additional information
This issue randomly appears and disappears, I tested on both `rustc 1.75` and the `rustc 1.76.0-beta.1` compilers and both have this issue.
This is what the plane looks like most of the time, it's supposed to be a basic light blue energy field of sorts:

If I turn on shadows and remove `NotShadowCaster` and `NotShadowReceiver`, then the plane is _always_ completely black. Not sure if that's related but this leads me to think that it's some problem in a shader somewhere.
I tried removing the emissive, but the bug still happened.
Contributor guide
Research direction
Start by reproducing the provided Rust plane setup on Bevy 0.12.1 with the AMD RADV Vulkan adapter, then check whether camera movement or the shadow and emissive settings affect the black regions. Done means the plane renders consistently without black areas, including when moving the camera and testing the reported shadow settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, ubuntu
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100