Depth Sort problem

Discuss Moho bugs (or suspected bugs) with other users. To report bugs to Smith Micro, please visit support.smithmicro.com

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

Post Reply
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Depth Sort problem

Post by Peteroid » Mon Sep 27, 2010 2:22 pm

I have a character that has 3 parts... his face, his eyes, and his mouth.

The mouth and eyes are switch layers (each of which also contains switch layers), and the face is a group of vector layers. I also offset the eyes and mouth slightly in the Z direction (at frame 0). They are all grouped in one big group layer, which I turn depth sorting on.

I have turned on 'depth sort' in every group. What happens is very strange. No matter what angle the camera views the character from, the mouth is ALWAYS behind and the eyes are ALWAYS in front!

I've tried different depth sort setting. Sorting by distance by 'true distance' and 'depth layer' and both at the same time. I've also tried combos of having depth sorting on in one group layer and not in others, since all on didn't work. Same result.

However. If I turn depth sorting off, I am able to manipulate what is in front of what manually by stacking the eye, mouth, and face layers in the proper order in the big group layer. So I have a work around. But is my situation just too complex for it to figure out proper depth sorting automatically?
[==Peter==]
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete » Mon Sep 27, 2010 5:15 pm

Sort layers by zdepth in a group layer or the root layer stack is performed based on the distance of the origin of the layer (yes that light brown cross usually in the center of the canvas) relative to the camera.
Maybe you think that a layer is closer to the camera but to hide or show it before or after other layer it uses the origin of the layer.
I believe that setting the origin of all layers would make crazy the zdepth sort. On the other hand, depending on where is the camera, moving the origin (which is non animatable) would put layers on its correct place.

Because, what's the distance of a layer (infinite 2D plane) to a point (a 3D camera)? Remember that camera doesn't know anything about edge detection or transparent parts because there is not any kind of surface meshing and true zdepth calculation in AS layers...

-G
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid » Mon Sep 27, 2010 6:04 pm

Genete wrote:Sort layers by zdepth in a group layer or the root layer stack is performed based on the distance of the origin of the layer (yes that light brown cross usually in the center of the canvas) relative to the camera.
Maybe you think that a layer is closer to the camera but to hide or show it before or after other layer it uses the origin of the layer.
I believe that setting the origin of all layers would make crazy the zdepth sort. On the other hand, depending on where is the camera, moving the origin (which is non animatable) would put layers on its correct place.

Because, what's the distance of a layer (infinite 2D plane) to a point (a 3D camera)? Remember that camera doesn't know anything about edge detection or transparent parts because there is not any kind of surface meshing and true zdepth calculation in AS layers...

-G
Yeah that does make sense.

LOL I just wrote up a whole description of my situation to prove what you were talking about wasn't my case. Then I realized you ARE talking about my situation!

It is easy to think depth sort is based on our perception of what is closer... but we use the ENTIRE LAYER when we make that appraisal. When the appraisal is limited to a single point (the layer's origin) that can be placed anywhere within the Layer, then what is in front of what is not a matter of what plane is in front of what plane, but which point is closer.

Where this gets weird (and the reason for my confusion till now) is THIS case:

It is possible for the origin A in plane A to be closer than the origin B in plane B while AT THE SAME TIME plane A is farther away than plane B!

This is because one can move the origin point in plane B as far away as one wants (mathematically, sanity not being an issue) from the camera (the entire infinite plane is available conceptually), and so in particular, Origin B can be moved farther away than the Origin A for ANY Plane A!

And it is amazing how often this origins-are-closer-than-the-planes' case comes up. This is not a problem with AS, this is just how math works. Though it COULD be improved by having a separate 'depth point', and even more so if it were animated.

One very common problem stems from close-ups. The closer the camera gets to one of the origin points the more its ENTIRE LAYER will be 'artificially-favored' when it comes to visual priority.

This is good to realize! :)

Specifically in my case, I just looked at the origins of the eyes and mouth and face. I realize that they are at different Y-heights. So, a camera at eye level will think the eyes are closer than the leaves, which are then closer than the mouth at most distances (since only the origins are considered), since diagonals are always longer than a perpendicular (shortest distance between two point, the Pythagorean theorem, those kind of things)!
[==Peter==]
Post Reply