I realize that each duplicated spine in scene increases 2 batches, if I turn cast shadows off, drops to 1 for each spine in scene.
I need to change any settings or I'll have 1 batch for each spine in scene?
Spine Batch
- Editado
Please note that Unity's normal batching rules apply, so it will depend e.g. on the vertex count of your Skeleton whether Unity will batch them or not.
Unfortunately even some Unity versions differ in batching behaviour, as can be read in this forum posting:
two texture is batch bug
How many vertices does your Skeleton have?
144 vertices.
They don't batch, so every object in the scene adds 2. With cast shadow off it become 1 for each object.
They have only one atlas and one material.
I uploaded the frame debugger screenshot.
In old smartphones I'm having some bad perfomance.
One thing probably is the drawcalls that are above 70 in some cases.
This is unexpected behaviour. Could you please send us a minimal reproduction Unity project that shows this problem as a zip file to contact@esotericsoftware.com? Then we can have a look.
It's really weird, I create another project to sent to you, when I first used the LWRP Spine Material the problem was there, so I change to a unity lwrp shader and the batch worked, I change back to spine shader and it worked too... but now inside my original project I tried to simulate the same steps, but doesn't work. I don't know, but it seems to be a problem with the LWRP. And I can't send the problem because only happen with my original project.
Alright, after I deep looking, I discovered that the difference between the two projects was the LWRP Settings, so the problem is with the Shadow Cascades, if I turn it off it doesn't batch, I need to put at least Two Cascades, probably a bug?
Well, with some cars it works, with other don't, I am completely lost right now haha.
Thanks for your detailled writeup and sharing all the info.
It indeed sounds strange that 2+ shadow cascades are required for it to be batched. It makes a bit of sense if the total instance count needs to be e.g. 5+, since each shadow cascade will render the scene region once into its shadow map (the vertex copy overhead might be declared as "worth it" then). Nevertheless it should then as well create batches when you simply add a few more instances of the same mesh and have shadow cascades (or shadows in general) disabled.
LWRP and URP are sometimes a bit hard to control, in other projects it has been too agressive with batching, leading to incorrect draw order at 3+ submeshes. This then led to the Advanced - Fix Draw Order
parameter as a workaround for this too agressive batching behaviour. Now it kind of puzzles me that batching is not performed where it should be.
Did you perhaps change anything in regards to Camera projection, depth sorting or the like between the two projects? Is batching affected by the position (overlap) of the objects?
I opened a empty scene, so the light and camera are exactly the same. When I change the LWRP it worked, but some of my Spines aren't batching even with the Two Cascade mode.
Then the camera part is out of the equation.
Does it start batching them when you add more instances of your non-batched skeleton?