Why Aren't These Two Batches SRP Batched Together?

Why are the two sets of batches in the attached images not batched into a single SRP Batch? Right now I’m seeing about 80+ SRP Batches in Render Opaques → RenderLoopNewBatcher.Draw.

In fact I have a lot of SRP Batches that aren’t batching at all, or are batching just a few, when I expect dozens of batches in them - all things (that I can see) being equal.

Unity 2019.4.11

Image1: 43 batched calls for “banners”

Image2: 45 batched calls for “banners”. Same prefabs as above, same shader, same reflection probe,etc.

This is just one example of many in my scene. I would have expected closer to 20 SRP Batches rather than 80+.

To draw a frame, unity combine all objects in to buckets and send them to GPU. By default, in URP, unity combine objects not only by material, but by distance too(and few other criteria). I.e. if you have a bunch of barrels far away, and bunch of barrels in front of you it’s became 2 draw calls. If you use default URP nothing you can do with it. If you use URP fork or custom SPR - you can just exclude SortingCriteria.QuantizedFrontToBack from your sorting settings.

1 Like

try clear material’s old keyword in debug mode inspector

1 Like

I have a feeling it’s due to distance, but it seems inconsistent. There are objects over 100 units apart that are being batched, and then objects from the same prefabs within those 100 units that end up in a different batch. I just don’t get it. :slight_smile:

How would one go about forking URP to make a custom one, is the source available somewhere? A custom SRP would be pretty unfamiliar territory for me.

I’m not sure I follow. Do you mean bring up the inspector’s debug mode? I thought the debug stuff presented is read-only.

yes, try clear material’s keyword slot in debug mode inspector

I tried this out. Unfortunately, it seems to have had the opposite affect. The number of RenderLoopNewBatcher.Draw instances went from 89 to 97. Additionally, the visuals became somewhat “broken”.

I’m open to any other suggestions.