Babylon’s SpriteManager draws sprites in wrong way: it first calcs depth, and than draws all pixels. It produces result like this:
Top sprite was added before white one and whole alpha was overlapped.
- First feature request: adjust draw algorithm.
- Second feature request: my solution only fixes draw into one draw call (or update() of one SpriteManager). For work it in all draws we need to call all draw operations for opaque pixels first, then for transparent. It requires changes in SpriteManagerComponent or something, don’t sure.
- Third feature request: remove all cycles in render() loop. It’s possible to draw thousands of sprites without any performance issues.
Don’t sure i’m in right to share my code, but solution is simple - instead of storing all values in Sprite object and copy it into array, it stores values in vertex buffer directly, so you need only to bindBuffer. Sprite values link example
I also posted detailed info about my research. This post on russian, but has some detailed pictures