SRP Batch and HybridBatchGroup are frequently interrupted by SkinnedMeshRenderer during batch merging

Hi! Is your project using the GPU Resident Drawer, Entities Graphics or maybe some custom Batch Renderer Groups?

no,i only ues Lit and GPU Resident Drawer , is Mono Project,never use Batch Renderer Groups

So what you’re seeing could be the expected behaviour. The GPU Resident Drawer (GRD) groups each instances using the same material into a single DrawInstanced call. This draw call, before being issued to the GPU in a shadow map pass (which is I assume what we see in your Frame Debugger capture), is sorted with all the others, including the skinned mesh renderer draw call, using among other things depth so we have a front to back ordering to optimize rasterization speeds on the GPU. Unfortunately, if you have a lot of objects that don’t get rendered through the GRD in you scene, such as skinned mesh renderer, they will potentially break the GRD batches after sorting, based on where they are positioned in depth in the current shadow map view. I assume this is the scenario we are seeing here.
It is potentially detrimental on the CPU performance wise, I admit that and we are thinking of how to improve that. But as of right now, this is to be expected.

That being said, the results you have are really very fragmented. It would be interesting if you could send us your scene / project for investigation. For instance how many different materials do you have in your scene?

It doesn’t look like that many objects but it can all come down possibly to material configuration, although we may have identified a potential improvement in shadow caster culling after investigating the code.
Do you think it would it be possible to send us a zip file of that Unity scene so we can look into your material configuration, etc.? Having it would be precious to test this potential improvement.

The number of alternating occurrences of SRPBatch and HybridBatch is positively correlated with the number of different meshes in my project

And in this demonstration project, I found that there was an error in rendering the normal map, which was not present in my Unity 6.1 project upgraded to 6.2 project



TestHybridBatch.rar (16.6 MB)

Thanks for the project, this confirms our suspicion that we could do better to sort the batches to prevent this chopping. In the mean time, you can have better batching by using as few materials as possible. If all your models are using HDRP/Lit you might want to merge materials by atlasing your textures for example.

But in the example I gave, there were only two sets of textures, which are actually positively correlated with the mesh type. If there is only one set of textures, different meshes will still cause this phenomenon

We will have to investigate this a bit more. I might have been too quick to suggest a temporary workaround. For sure we need to improve the way we sort things in shadow map passes.

Allow me to introduce our sample project game: [flash doll]! Check it out on Steam now: Flash Doll on Steam