Skip to content

Prepass fragment shader does not influence opaque material shadows on 0.16 #19151

Open
@hansler

Description

@hansler

Bevy version

0.16 & main

Relevant system information

`AdapterInfo { name: "AMD Radeon RX 7900 XTX (RADV NAVI31)", vendor: 4098, device: 29772, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 24.2.6", backend: Vulkan }`

What you did

I modified the shader_prepass example to show the issue. See the code here: https://github.com/hansler/bevy/tree/feature/prepass_shader_alpha_example

If you grab that branch and run cargo run --example shader_prepass, you can reproduce the issue.

What went wrong

On 0.15, if I create an ExtendedMaterial as I did in the example with AlphaMode::Opaque and use discard in the prepass fragment shader, the mesh's shadow respects the discarded fragments. (Note: The opacity value in my example influences a Bayer matrix, so it's discarding fragments, not influencing the alpha color value.)

When I upgraded to 0.16, this is no longer the case. Shadows seem to ignore the prepass fragment shader.

Screenshot

Image

In this screenshot, there are three cubes: One with Opaque, one with AlphaMask(1.0), and one with Blend. All three cubes have most of their fragments discarded, in both the standard and the prepass fragment shader. The AlphaMask and Blend cubes are casting shadows according to the prepass fragment shader, but the opaque cube's shadow seems to be ignoring the discarded fragments in the prepass shader.

I couldn't find anything related to this in the 0.16 release notes or migration guide, so since this behaved differently in 0.15, I think this is a regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorP-RegressionFunctionality that used to work but no longer does. Add a test for this!

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions