AlphaToCoverage can't be used with base_color_texture
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
0.14.1
## Relevant system information
```ignore
AdapterInfo { name: "NVIDIA GeForce GTX 1660", vendor: 4318, device: 8580, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "550.67", backend: Vulkan }
```
## What you did
Trying to use both `alpha_mode: AlphaMode::AlphaToCoverage` and `base_color_texture: Some(..)` in `StandardMaterial`.
## What went wrong
`AlphaToCoverage` just doesn't seem to work, as if MSAA is disabled:
> if MSAA isn’t on, this is identical to [AlphaMode::Mask](https://docs.rs/bevy/latest/bevy/render/prelude/enum.AlphaMode.html#variant.Mask) with a value of 0.5.
In my tests, it seems exactly like `AlphaMode::Mask` cutoff at 0.5.
## Additional information
I'm not sure if that's how `AlphaToCoverage` should work, or if there is something else I'm doing wrong ? I tried different materials, but it always fails to render properly with a texture.
Here is slightly modified **transparency_3d** example:
https://github.com/user-attachments/assets/c85f9b14-5f97-44c6-b49d-28ed87b74a9e
Diff
```diff
--- a/examples/3d/transparency_3d.rs
+++ b/examples/3d/transparency_3d.rs
@@ -14,6 +14,7 @@ fn main() {
fn setup(
mut commands: Commands,
+ asset_server: Res,
mut meshes: ResMut>,
mut materials: ResMut>,
) {
@@ -78,6 +79,18 @@ fn setup(
..default()
});
+ commands.spawn(PbrBundle {
+ mesh: meshes.add(Cuboid::default()),
+ material: materials.add(StandardMaterial {
+ base_color: Color::srgba(1.0, 1.0, 1.0, 0.0),
+ base_color_texture: asset_server.load("textures/slice_square.png").into(),
+ alpha_mode: AlphaMode::AlphaToCoverage,
+ ..default()
+ }),
+ transform: Transform::from_xyz(1.5, 0.5, 0.0),
+ ..default()
+ });
+
// Opaque sphere
commands.spawn(PbrBundle {
mesh: meshes.add(Sphere::new(0.5).mesh().ico(3).unwrap()),
```
Contributor guide
Assessment
This issue has not been assessed yet.