Interleaving an object with different Z breaks batching
First, not sure if it is a bug or not, but let me elaborate.
Debugging a UI, I have a very strange batch brake.
After doing several tests, I realized that the sibling order is key. If I group one after the other the objects that should be batch together, they do. However, if I spread them, they don’t.
But, and here is the nuance, this is only true if the z of the object in the middle of the objects that should be group together is different. If z of the object in the middle is the same, they batch together the way is should be.
Let’s see an example.
6 objects interleaved, 3 with material A and 3 with material B, the 6 of them with z = 0. Expected batches = 2. Actual batches = 2
Material A Z 0 //Batch 1
Material B Z 0 //Batch 2
Material A Z 0 //Batch 1
Material B Z 0 //Batch 2
Material A Z 0 //Batch 1
Material B Z 0 //Batch 2
6 objects interleaved, 3 with material A Z = 0 and 3 with material B Z = 1. Expected batches = 2. Actual batches = 6
Material A Z 0 //Batch 1
Material B Z 1 //Batch 2
Material A Z 0 //Batch 3
Material B Z 1 //Batch 4
Material A Z 0 //Batch 5
Material B Z 1 //Batch 6
6 objects not interleaved, 3 with material A Z = 0 and 3 with material B Z = 1. Expected batches = 2. Actual batches = 2
Material A Z 0 //Batch 1
Material A Z 0 //Batch 1
Material A Z 0 //Batch 1
Material B Z 1 //Batch 2
Material B Z 1 //Batch 2
Material B Z 1 //Batch 2
So, is this normal? interleaving an object with other z breaking the batch= could be a bug? I have been reviewing official documentation but I can not find anything about this.
I also reviewed this a little old but great conference and he doesn’t mention this neither
Following this rules, the objects should be batched together
Edit: I have found this article speaking about the same, but it doesn’t even care about Z, just interleaving breaks the batching for him.
In my toy example is not like that, but in more complex examples, it also happens to me



