Batching techniques in Unity

Last update: Sept 2020
Update: This image is too old so please look at the comparison table below instead

batchingtechniques

Static BatchingDynamic BatchingGPU InstancingSRP Batcher
Built-in RP supportYesYesYesNo
Universal RP (URP) supportYesYesYes
(Need to disable SRP batcher, see here)
Yes
Universal RP (URP) + Hybrid Renderer supportNoNoReplaced by DOTS Instancing in Hybrid Renderer V2Yes
Works on static objects?
(the “Batching Static” flag on MeshRenderer component)
YesNoNo
(if Static batching is used, instancing will be turned off) (source)
Yes
Works on dynamic objects?NoYesYesYes
Objects can use different meshes?Yes
(Different meshes are combined into a big mesh)
YesNoYes
Objects can use different materials?NoNoNoYes
(Be-aware of shader variant)
Objects can use different shaders?NoNoNoNo
Objects can have different property values set by script?
(Per-object / Per-instance properties e.g. color)
NoNoYes
(use MaterialPropertyBlock)
Yes
(setup different materials)
Works on SkinnedMeshRendererNoNoNoYes
Typical use caseUseful for larger unique meshes that will share the same material.
Reduce draw calls (increase CPU performance).
(source)
For very low-poly dynamic objects that share the same material, e.g. a quad mesh.
Reduce draw calls.
Useful for platforms and graphics APIs that do not support GPU instancing, e.g. very low-end devices
(source)

Useful for drawing objects that appear repeatedly (same mesh).
Reduce draw calls (increase CPU performance).
(source)
Useful if you have many different Materials that use the same Shader.
Speeds up CPU rendering without affecting GPU performance.
(source)
Good things don’t come for freeIncrease memory / storage usage
(source)
Has CPU overhead (decrease CPU performance if only small amount of objects are batched)
(source,source)
Has overhead on both CPU & GPU
(source)
A bit slower on GPU
(source)

More nice information :
The Ultimate Guide to Draw Call Batching in Unity 2020+ by Ruben Torres Bonet
https://forum.unity.com/threads/srp-batcher-and-gpu-instancing.833362/#post-5521216

6 thoughts on “Batching techniques in Unity

  1. Hello, so I can use SRP batching on a realtime lit scene, but is there a way to use SRP batcher with a baked lit scene? I need srp batcher’s different material and mesh batching features but its still slow on dynamically lit scenes on low end devices. I’d love to know what are your suggestions on that.

    Like

      1. I’m using a slightly modified version of simple lit shader and I can’t see srp batches on frame debugger when I use a baked scene. No problem when using realtime data.
        Do you mean the static batcher works with the SRP batcher on baked scenes and handle those baked lit meshes? or am I doing something wrong with my custom implementation so that I can not get SRP batches?

        Like

      2. Hello, oh! Thank you for the valuable information. I was doing sanity checks to understand the problem but couldn’t figure it out. I’m using URP 7.3.1 with Unity 2019.4.19f1. But I’ll give it a go with the latest version of URP too. Thanks.

        Like

      3. Sorry for not being clear.
        Just checked that the bug happens on URP 10.x.x, but URP 8.1.0,8.2.0,7.3.1 are fine.

        To know whether a shader is SRP batcher compatible, you can select the shader on ProjectView, and look at the inspector.

        Since on my Win laptop SimpleLit is SRP batcher compatible on Unity 2019.4+URP 7.3.1, does it behaves the same on your machine? If SimpleLit is fine but the custom shader isn’t then we can tell something is wrong on the custom shader.

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s