TransWikia.com

Unity - Understanding the SRP batcher

Game Development Asked by Majs on November 12, 2021

Im trying to understand the SRP batcher. I have a scene with 300 fairly low-poly models.

These are my rendering stats with SRP Batcher:

enter image description here

And this is without SRP Batcher:
enter image description here

Some observations (This is all with dynamic batching enabled, models share a GPU instanced material):

  1. With SRP Batcher the Tris and Verts seem to lower almost impossibly low, sitting at the low thousands, while without the SRP Batcher they are almost 5 million.
  2. With SRP Batcher the draw calls are at almost 3000, with none being batched. On the other hand, without SRP Batcher the draw calls are at 103, with almost 2500 being batched.

I cannot really make sense of this. I see no noticable effect on the FPS. I have no idea which is actually better for performance. The stats above make no real sense to me, seems strange that enabling SRP batcher removes all batched calls… Can someone help me understand which is better and when to use what?

Everything is tested on latest unity and URP versions.

2 Answers

What you need to understand regarding the SRP Batcher is, that it is not batching your draw calls like the static or dynamic batching system. Instead, it reduces the overhead of each draw call by making part or all of the material data persistent in the GPU memory. That way, the CPU doesn't need to set up and upload the buffer to the GPU each time, effectively reducing bandwidth and time to render a drawcall.

This blogpost explains it in greater detail:

Don't forget, that GPU instancing won't work if the SRP Batcher is enabled.

And as explained in another answer here, it's more important that your meshed share the same shader rather than the same material. Traditional batching only works with the same material.

Answered by Acimaz on November 12, 2021

Maybe this link could help: https://catlikecoding.com/unity/tutorials/basics/measuring-performance/

The idea on Unity is to use SRP Batcher for URP instead of GPU Instancing. The idea is: if you use URP shader compatible, it will batch directly, you only need to share the shader. You can use different meshes, different materials, etc. But if they share the same shader and keywords, they will batch.

enter image description here

Answered by Marc Alloza Ayxendri on November 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP