I’m currently working on a rather large top down scene for a personal project of mine, and I’ve decided to try out HDRP for the first time. I’m using realtime lighting with almost exclusively static objects, using very few materials so far. Despite this, I’m getting a ton of batches.
There are 2 factors I don’t understand. One is why unity doesn’t seem to batch static objects using the same material, another is that the camera seems to render way more objects than are actually in view.
For an example, here is my entire scene seen from above
We’re at 5,7k batches… that’s half despite the fact that we’re looking at nowhere near half the scene here.
So that’s the camera issue I’m wondering about… With regards to the bathcing static objects question; I was under the impression that if i marked objects static and they use the same material unity will batch them together… Each building in the scene is built frmo wall parts, explaining the high number of objects, but the vastly majority of them are using the same 8-9 materials.
“why my objects aren’t static batched together because they use the same material”. I think they are probably static batched. “static batching” in unity doesn’t reduce the number of drawcalls, it just avoid some GPU setup between drawcalls ( set new vertex buffer, set new material, set viewworld matrice etc).
“why is there still so many drawcalls when the camera is really close”. I can’t tell for sure but my guess is probably a culling issue.
If your scene contains many similar static houses, better create a merged house mesh and do a test, it should improve the rendering time.
Btw if you need better rendering profiling metrics, use SRPBatcherBenchmark/Assets/Scripts/SRPBatcherProfiler.cs at master · Unity-Technologies/SRPBatcherBenchmark · GitHub script in your scene and press PLAY.