bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
32.96k stars 3.2k forks source link

`Text2dBundle` is not frustum culled #13391

Open rparrett opened 2 weeks ago

rparrett commented 2 weeks ago

Bevy version

0.13

What you did

Modify the many_sprites example so that Text2dBundle is used instead of SpriteBundle.

https://gist.github.com/rparrett/9cd3b145def1855f1baf87822e6a5f7a

What went wrong

Logging shows that without manual intervention by the update_text_aabb system, all of the texts are considered "visible" and the framerate is poor.

With the update_text_aabb running, the off-camera text is culled and the framerate is good. It seems that adding an Aabb to the texts is enough to make frustum culling work.

Additional information

See also this related discussion: https://github.com/bevyengine/bevy/discussions/13367

There may be a better in-system solution than adding a separate update_text_aabb system, but I haven't looked into this.