Documentation is work in progress and not completeEditor
GPU Constraints and 3D

Z-Depth and Layer Ordering in 3D

The Z-Ordering Problem

In a standard 2D composition, Z-order (draw order) is explicit — elements are drawn in the order they appear in the layer stack, with higher layers appearing in front.

In a 3D composition, elements at different Z-depth positions may need to be drawn in a different order than the layer stack to appear correctly. An element at Z = -100 (far from viewer) should appear behind an element at Z = +100 (close to viewer), regardless of their layer stack position.

Z-Sort Modes

Painter's Algorithm (Default): Elements are drawn in layer stack order regardless of Z-depth. This is compatible with blend modes and is predictable, but can produce incorrect visual ordering when elements at different Z-depths cross the same screen area.

Depth Sort: FlashFX sorts elements by their camera-space Z depth before drawing. This produces correct visual depth ordering for non-overlapping, non-transparent elements.

Depth Sort Limitations:

  • -Incompatible with most blend modes (breaks batching)
  • -Cannot correctly handle two transparent, overlapping elements at different depths simultaneously (classic painters algorithm problem — there is no mathematically correct solution for overlapping translucent geometry without hardware depth buffering)
  • -FlashFX does not use WebGL's depth buffer for compositing because it cannot accommodate transparency

Managing Z-Ordering Manually

For most motion graphics work, manual Z-ordering (using the layer stack) is more reliable than automatic depth sorting:

  1. 1.Design the composition so that elements at greater depth (further away) are lower in the layer stack
  2. 2.Avoid having transparent elements at different depths overlap the same canvas region simultaneously
  3. 3.Use a Null Object hierarchy to group elements by depth tier, then arrange the null groups in the stack