mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
9de25ad330
# 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> |
||
---|---|---|
.. | ||
2d_shapes.rs | ||
2d_viewport_to_world.rs | ||
bloom_2d.rs | ||
bounding_2d.rs | ||
custom_gltf_vertex_attribute.rs | ||
mesh2d.rs | ||
mesh2d_alpha_mode.rs | ||
mesh2d_arcs.rs | ||
mesh2d_manual.rs | ||
mesh2d_vertex_color_texture.rs | ||
move_sprite.rs | ||
pixel_grid_snap.rs | ||
rotation.rs | ||
sprite.rs | ||
sprite_animation.rs | ||
sprite_flipping.rs | ||
sprite_sheet.rs | ||
sprite_slice.rs | ||
sprite_tile.rs | ||
text2d.rs | ||
texture_atlas.rs | ||
transparency_2d.rs | ||
wireframe_2d.rs |