bevy/crates/bevy_sprite/src
IceSentry 9de25ad330
Add AlphaMask2d phase (#14724)
# Objective

- Bevy now supports an opaque phase for mesh2d, but it's very common for
2d textures to have a transparent alpha channel.

## Solution

- Add an alpha mask phase identical to the one in 3d. It will do the
alpha masking in the shader before drawing the mesh.
- Uses the BinnedRenderPhase
- Since it's an opaque draw it also correctly writes to depth

## Testing

- Tested the mes2d_alpha_mode example and the bevymark example with
alpha mask mode enabled

---

## Showcase


![image](https://github.com/user-attachments/assets/9e5e4561-d0a7-4aa3-b049-d4b1247d5ed4)

The white logo on the right is rendered with alpha mask enabled.

Running the bevymark example I can get 65fps for 120k mesh2d all using
alpha mask.

## Notes

This is one more step for mesh2d improvements
https://github.com/bevyengine/bevy/issues/13265

---------

Co-authored-by: Kristoffer Søholm <k.soeholm@gmail.com>
2024-08-15 14:10:37 +00:00
..
mesh2d Add AlphaMask2d phase (#14724) 2024-08-15 14:10:37 +00:00
render Add 2d opaque phase with depth buffer (#13069) 2024-08-07 00:22:09 +00:00
texture_slice fix asymmetrical 9-slicing (#14148) 2024-08-01 20:03:23 +00:00
bundle.rs new example: sprite animation in response to an event (#12996) 2024-04-23 21:44:03 +00:00
dynamic_texture_atlas_builder.rs Uncouple DynamicTextureAtlasBuilder from assets (#13717) 2024-06-08 12:38:03 +00:00
lib.rs Apply Clippy lints regarding lazy evaluation and closures (#14015) 2024-07-01 15:54:40 +00:00
sprite.rs Slicing support for texture atlas (#12059) 2024-03-05 16:05:39 +00:00
texture_atlas_builder.rs More idiomatic texture atlas builder (#13238) 2024-06-03 12:43:50 +00:00
texture_atlas.rs Cosmic text (#10193) 2024-07-04 20:41:08 +00:00