all the white stuff should be part of the cliffs
frame debugger sez “can’t batch coz lightmapped” and I say yes they’re lightmapped, they’re static batched meshes too…
all the white stuff should be part of the cliffs
frame debugger sez “can’t batch coz lightmapped” and I say yes they’re lightmapped, they’re static batched meshes too…
Unity’s static batching is a bit confusing, because each object is indeed rendered separately still. They are technically separate draw calls. However a “draw call” isn’t actually the thing that’s expensive about rendering. It’s the setup for the draw call. So static batching allows most of the setup to happen once, and then the individual draw calls of that static batch from that point on are significantly cheaper.
However, that’s not the issue here. The issue you’re probably seeing is your scene probably has multiple light maps.
The system Unity uses to decide which order to draw stuff in isn’t as straight forward as it might appear. It seems to be some weighted list based on batching, bounds, distance, and several other factors. For example a scene with several opaque meshes will usually draw front to back, using the renderers’ spherical bounds to sort (distance from camera to bounds center - spherical bounds radius). However it may choose to render some objects in a different order if doing so would avoid state changes (one of the expensive parts of setting up a draw call). There are also objects that due to their bounds will get sorted very close even if they’re “far away”, like long thin objects. Changing a texture or material property are generally less expensive parts of the draw call setup, so Unity will sometimes choose to “break” batching in favor of drawing some objects earlier if its system decides that might be faster.
So, my guess is your scene has more than one lightmap. Unity’s light mapping tends to not be super great about locality when it comes to choosing which objects get put into one light map, so while rendering it might end up drawing things “out of order” in terms of which would be the most efficient from a pure batching perspective. But it’s doing that in an attempt to make other situations faster. It’s not perfect by any means, but it probably gets it right more of the time than not.
Very interesting.
Is there anything I can do to make static mesh perform better?
I turned off direction and lowered the baking density to one map @anon_98849602
Not really anything static mesh specific. Just less objects, lower vertex counts, lower res textures, etc. The usual stuff.