MichelVictor

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?
MichelVictor
  • Posts: 56

Harald

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?
User avatar
Harald

Harri
  • Posts: 1485

MichelVictor

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.
You do not have the required permissions to view the files attached to this post.
MichelVictor
  • Posts: 56

Harald

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.
User avatar
Harald

Harri
  • Posts: 1485

MichelVictor

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.
You do not have the required permissions to view the files attached to this post.
MichelVictor
  • Posts: 56

Harald

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?
User avatar
Harald

Harri
  • Posts: 1485

MichelVictor

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.
MichelVictor
  • Posts: 56

Harald

Then the camera part is out of the equation.

Does it start batching them when you add more instances of your non-batched skeleton?
User avatar
Harald

Harri
  • Posts: 1485


Return to Unity