Skip to content

Indirect drawing causes AlphaMode::Blend meshes to flicker #21739

@beicause

Description

@beicause

Bevy version and features

0.17.2

Relevant system information

2025-11-04T12:50:12.387804Z  INFO plugin build{plugin="bevy_render::RenderPlugin"}: bevy_render::renderer: AdapterInfo { name: "AMD Radeon Graphics (RADV RENOIR)", vendor: 4098, device: 5686, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 25.2.5-arch1.2", backend: Vulkan }

What you did

fn setup(
    mut commands: Commands,
    mut meshes: ResMut<Assets<Mesh>>,
    mut materials: ResMut<Assets<StandardMaterial>>,
) {
    // Camera
    commands.spawn((
        Camera3d::default(),
        Transform::from_xyz(10.0, 10.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
        // OrderIndependentTransparencySettings {
        //     layer_count: 8,
        //     alpha_threshold: 0.0,
        // },
        Msaa::Off,
        // NoIndirectDrawing,
    ));

    // Directional light
    commands.spawn((
        DirectionalLight::default(),
        Transform::from_xyz(0.0, 0.0, 0.0).looking_at(Vec3::new(-0.15, -0.1, 0.15), Vec3::Y),
    ));

    // Ambient light
    commands.insert_resource(AmbientLight {
        brightness: 800.0,
        ..Default::default()
    });

    let cube = meshes.add(bevy::math::primitives::Cuboid::new(0.5, 0.5, 0.5));
    let material_handle = materials.add(StandardMaterial {
        alpha_mode: AlphaMode::Blend,
        ..Default::default()
    });
    let mut bundles = Vec::with_capacity(8 * 8 * 8);

    for z in -4..4 {
        for y in -4..4 {
            for x in -4..4 {
                bundles.push((
                    Mesh3d(cube.clone()),
                    MeshMaterial3d(material_handle.clone()),
                    Transform::from_xyz(x as f32, y as f32, z as f32),
                ));
            }
        }
    }
    commands.spawn_batch(bundles);
}

What went wrong

_20251104_210908.webm

Additional information

This doesn't happend with AlphaMode::Opaque/Mask/Add/Multiply or with NoIndirectDrawing. Enabling OIT can mitigate this issue but flickering still occurs if the overlapping meshes exceed the OIT layers.
I also tried #21475 but it doesn't fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-BugAn unexpected or incorrect behaviorS-Needs-TriageThis issue needs to be labelled

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions