Batching techniques in Unity

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

batchingtechniques

Static BatchingDynamic BatchingGPU InstancingSRP BatcherGPU Resident Drawer
/
BatchRendererGroup
Built-in RP supportYesYesYesNoSame as SRP Batcher
Universal RP (URP) supportYes
(Enable checkbox in Player Settings)
Yes
(Need to disable SPR batcher on pipeline asset, and enable Dynamic Batching checkbox)
Yes
(Need to disable SRP batcher, see here)
YesYes
(Forward+ only)
Works on static objects?
(the “Batching Static” flag on MeshRenderer component)
YesNoNo
(if Static batching is used, instancing will be turned off) (source)
YesSame as SRP Batcher
Works on dynamic objects?NoYesYesYesSame as SRP Batcher
Objects can use different meshes?Yes
(Different meshes are combined into a big mesh)
YesNoYesSame as SRP Batcher
Objects can use different materials?NoNoNoYes
(Be-aware of shader variant)
Same as SRP Batcher
Objects can use different shaders?NoNoNoNoSame as SRP Batcher
Objects can have different property values set by script?
(Per-object / Per-instance properties e.g. color)
NoNoYes
(use MaterialPropertyBlock)
Yes
(setup different materials)
Same as SRP Batcher
Works on SkinnedMeshRendererNoNoNoYesNo
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)
Render a large number of environment objects where using individual GameObjects
would be too resource-intensive. For example, procedurally-placed plants or rocks.
(source)

Reduces the number of draw calls and frees CPU processing time.
(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)
N/A
(This is running by default whenever you use URP/HDRP)
Require platform / graphics API that supports compute.
(source)

Make sure to profile performance as it only benefits if you have enough instances to take advantages from it.

Player build time might be much longer as all DOTS_INSTANCING shader variants will be kept and thus will be compiled into player build.
ResourcesMinimal custom shader exampleMinimal custom shader exampleMinimal custom shader example
Frame Debugger event markerStatic BatchDraw DynamicDraw Mesh (instanced)SRP BatchHybrid Batch Group
NotesKeep dynamic batching checkbox turned off unless you know it will definitely benefit for your project.Confused about how this relates to “hybrid” “dots instancing”?

BatchRendererGroup used to only work for fast rendering of Entities (DOTS / ECS) only, that’s why it’s shader keyword is named “DOTS_INSTANCING”.

Rendering of Entities is supported by the Entities Graphics package.

Entities Graphics used to call “Hybrid Renderer” that’s why the term “hybrid” remains somewhere.

Therefore:

Rendering Entities with BatchRendererGroup = Entities Graphics

Rendering GameObjects with BatchRendererGroup = GPU Resident Drawer

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 comment