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

[3D] Particles render through PBR objects with AlphaMode::Blend #320

Closed
Katsutoshii opened this issue May 6, 2024 · 1 comment
Closed

Comments

@Katsutoshii
Copy link
Contributor

Crate versions
bevy version: 0.13.2
bevy_hanabi version: 0.10.0

Describe the bug
In 3d scenes, particles render behind PBR objects with AlphaMode::Blend but Color.alpha = 1.0. Note that the particles do get occluded when AlphaMode::Opaque.
My use case is spawning particles in a world where I have a fog of war layer between the world and the camera, but the particles render through the fog.

Expected behavior
I expect particles to be occluded by objects that are between them and the camera, even if AlphaMode is not AlphaMode::Opaque

To Reproduce
I have a minimal reproduction in this repo: https://github.com/Katsutoshii/hanabi_blend.

Screenshots
Mp4 attached. The blue and green squares are both closest to the camera and the red square is behind the fireworks. This shows that with AlphaMode::Opaque (green), the particles are correctly occluded, but for AlphaMode::Blend (blue) the particles are not.

hanabi_blend_capture.mp4
djeedai added a commit that referenced this issue May 18, 2024
Order particle effects based on the distance of the emitter to the camera. This ensures they're sorted during the `Transparent3d` render phase relative to other transparent objects.

---------

Co-authored-by: Jerome Humbert <djeedai@gmail.com>
@djeedai
Copy link
Owner

djeedai commented May 19, 2024

Fixed.

@djeedai djeedai closed this as completed May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants