Hi all,
I wrote a lib that takes a lot of static sprites and merge them into a grid of render targets, then draw only the visible textures using a simple grid-based culling.
Here’s a screenshot to illustrate what I mean:
In the pic above instead of drawing all those skeletons, trees and tiles separately, they were merged into a grid of textures (marked with white lines) during initialization, so now we only need to draw 9 textures to show them all. It reduced ~1500 draw calls to 9.
For more info / get the lib:
https://github.com/RonenNess/MonoGame.StaticBatch
From a test scene I made with +180K sprites, I got the following results:
- Using static batch: 6400 FPS.
- Drawing everything: 9 FPS.
- Drawing only visible sprites (bounding-box culling): 300 FPS.
I think its pretty nice
But ofc the price is in RAM, the bigger your scene the more textures it creates, so watch out for that.
Have fun, and let me know if you have any questions.