Let’s say I have 200 different textures that all have the possibility of having translucent pixels in them and I wanted to draw 1000 textures on screen. The way I understand this is: in order for blending to work the textures all need to be sorted and rendered from back-to-front in draw order. Performance-wise, it’s smartest to batch all of the quads that have a texture mapped to them into 1 draw call. The problem I’m having trouble solving is how do you draw all of these textures front-to-back while still batching them together to minimize on draw calls?
With no texture sorting, I’d end up having to make 1000 draw calls, 1 per texture.
With texture sorting, I’d only have 200 draw calls but my blending would be all screwed up.
So what’s the solution here? The only possible thing I can thing of is packing all my textures into a few different texture atlases and hoping some high-level draw calls don’t happen to draw textures from two different atlases repeatedly (because then it’d have to switch atlases every time).