Drawing layers ordering seems to be inconsistent when playing with Z position.
In the attached scene, you can see two cases.
First one :
Layer Red is nudged 2 behind
His son (yellow), is nudged 1 more behind (then 3B in absolute positions)
Bleu layer is nudged in 3B
The result i as expected : Red is in front, yellow is just behind, and blue is at the bottom.
But when moving all layers frontward from 1 nudge, blue is still at the same ‘absolute’ position than yellow, but is not behind anymore.
Do I miss any logic behind this comportment, or is it just some kind of inconsistency ?
I am on am iPad currently so the numbers in your column are too small to make out however I believe we need to see the numbers for both the before and after nudge to confirm what the origin and resulting positions are.
If you are not using Premium you are at a disadvantage. Premium has the Node View which adds another way to see layers without the limitation of the linear Timeline.
It is hard to tell what has happened without seeing where you moved things from. You could have made a mistake.
Concerning the values before, it’s quite easy.
I started with layers at the default position (Z offset 0).
And I did nudge either 1, 2 or 3 times, with alt-arrow.
Actually, I just can’t figure what SHOULD happen, in terms of ordering, when 2 layers have the same z-offset.
What seems logical is that, when Z are identical, the layer position is then used to sort.
But, obviously in my example, it’s not the case.
Is it something you could share ?
At this time, were thinking about moving from Flash to ToonBoom in order to produce animations in our games.
But due to this non-understandable behavior, we can’t manage to produce an exporter for our game that doesn’t produce flickering.
thank you for your answer.
I’m using the Advanced version (14).
What you are proposing is exactly what I tried : starting with 3 layers, moving them along Z axis, and try to understand the result.
And the fact is that there ARE inconsistencies in the result.
I can’t send you my project (too big for an attachment), but you would see that upon a certain point, there is no logic on ordering. If you want to see that, I can send you an email.
Anyway, my goal was to have the same output in my game engine (Unity) than in your editor, and I finally find how to achieve this.
I post my solution here, as it could help other people who have the same problem.
The reason there is no “logic” sometimes in ordering is that when rendering, you reduce the Z value precision.
Bad news: due to the nature of the computation (involving Mathf.floor), some layers, that should be at the same Z, can have slightly different Z after the operation
Good news: the computation is deterministic.
TL;DR: if you want to order layers in your custom renderer, apply these steps :
compute a new Z with this formula (from the iOs Unity renderer):
const double PLANE_QUANTUM = 1.0/(1024.0*64.0);
double roundOffsetZ = floor( ( (double)offsetZ / PLANE_QUANTUM ) + 0.5 ) * PLANE_QUANTUM;
order your layers with this roundOffsetZ
in case of equality, display higher layer index first.