Requirements for batching
Texture Atlasing
-
Material
- The shaders:
Standard (Decalable), Standard (Specular setup) (Decalable), Custom/Card, Custom/Foliage
- Filtering mode must be:
Point if Standard (Decalable) orStandard (Specular setup) (Decalable)
Trilinear if Custom/Foliage
- Any if
Custom/Card
- Cannot use (most?) PBR: specular, metallic, smoothness, glossiness, normal map, emission, parallax mapping.
- Height or width cannot be more than 128 pixels.
- Wrap mode must be
Clamp
- Mode has to be
Opaque
-
Mesh
- UVs must not be out-of-bounds.
General batching details
- Unity batches draw calls of GameObjects that use the same material. This means to get the best results from draw call batching, share materials among as many GameObjects as possible. If you have two material assets that are identical apart from their textures, you can combine the textures into a texture atlas. Unturned already does this automatically for the most part.
Mesh static batching
- Unturned does automatic runtime static batching see the detailed requirements for eligibility here.
- Mesh needs to be cpu-readable(this is only for mesh batching, not atlasing)
- Not recommended to enable on models that will take up a lot of memory(lots of cumulative geometry data) as cpu-readable generally increases cpu memory usage.
- If you want to still batch on lots of geometry, GPU instancing is a good alternative.
- Material needs to be the same.
- Static batching will create a copy of the mesh. If there are a lot of the target mesh it may be copied multiple times, using more memory. GPU Instancing may be a better option for meshes with multiple instances.
Conclusion:
- GPU instancing for meshes that will have a lot of instances and geometry(like foliage, traffic objects, etc).
- Static batching for meshes that does not have a lot of instances, static batching does not require the identical meshes.
Sources