Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AlphaMode::Blend not depth testing #13835

Open
bananaturtlesandwich opened this issue Jun 13, 2024 · 2 comments
Open

AlphaMode::Blend not depth testing #13835

bananaturtlesandwich opened this issue Jun 13, 2024 · 2 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@bananaturtlesandwich
Copy link

bevy 0.13.2 on windows 10

`AdapterInfo { name: "Radeon RX550/550 Series", vendor: 4098, device: 27039, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "24.3.1 (AMD proprietary shader compiler)", backend: Vulkan }`

What you did

set the blend mode on a material on a mesh rendered in bevy to blend

What went wrong

as i understand from the bevy docs, blend should only differ from opaque in that it allows mixing with fragments behind according to alpha value. if alpha value is 1 like here, then the behaviour should be exactly the same

in these tests, there doesn't seem to be any depth testing going on - please say if i misunderstand anything :)

the mesh i used in the video (from the celeste64 repo) but it's the same with all other meshes i've tried including skeletal meshes

biosphere.2024-06-13.22-35-18.mp4

same with geometry produced by bevy_trenchbroom

biosphere.2024-06-13.22-47-51.mp4
@bananaturtlesandwich bananaturtlesandwich added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jun 13, 2024
@IceSentry
Copy link
Contributor

Alpha blended meshes only get sorted based on the distance between the camera and the center of the mesh. So it doesn't sort every fragment in the material. this means that sometimes, a mesh is in front of another because the center is closer to the camera even if a lot of the mesh should be hidden. There are various solutions to this, one of them is order independent transparency which sorts each fragments. I'm working on it, but it's not currently supported. Generally you should avoid alpha blending if you don't need it, especially when the alpha is 1. And if you need an alpha of 1, maybe consider working with multiple smaller meshes

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Jun 13, 2024
@bananaturtlesandwich
Copy link
Author

Thanks for the response! I originally noticed this when making a material for the player character which became more transparent when the camera got too close so most of the time alpha is 1. I'll leave that as is for now then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

3 participants