From: Unity - Manual: Static batching
So, which is it? Does static batching reduce the amount of draw calls or not?
From: Unity - Manual: Static batching
So, which is it? Does static batching reduce the amount of draw calls or not?
Hi! Indeed this is a contradictory.
That first paragraph could be:
So it’s the same number of draw calls, but there is no/less state change between them like binding the meshes’ vertex buffers.
I logged a task to improve this page.
So static batching basically:
Is this roughly correct?
If so, there’s a potential performance advantage to merging meshes (that share material, textures, etc) into a single larger mesh and drawing it in one drawcall, compared to statically batching them, right? You lose culling (as the entire combined mesh must be rendered) but reduce the amount of drawcalls.
Almost.
In step 1, it’s not all meshes together. They are merged in groups based on having the same material. More details here: Unity - Manual: Draw call batching
There’s also a limit on how large a statically batched mesh can be (something around 60k vertices, but don’t quote me on the number).
So your step 3 isn’t quite what happens because statically batched meshes are already grouped by their same material. In other words, sorting doesn’t start from scratch with the rest of the scene.
I’ll add though that if you’re using URP or HDRP (or a custom SRP), you most often won’t get a performance gain from static batching because the SRP batcher already saves a lot of state changes. So be sure to profile to validate that the extra memory costs for read/write meshes are worth it.