Render Order
Overview
Sorting (i.e. when X
is rendered on top of Y
) in Nova is determined by the following, from lowest to highest priority:
Note
All root UIBlocks (i.e. a UIBlock on an active GameObject without a Parent UIBlock) are implicitly SortGroups with default values. Throughout this article, the usage of "SortGroup" refers to both explicitly added SortGroup components and UIBlock hierarchy roots.
Hierarchy Order
Within a SortGroup hierarchy, coplanar elements are sorted in depth-first hierarchical order.
Z-Index
For coplanar content, Z-Index overrides the default hierarchical ordering within a SortGroup hierarchy.
Z-Index only applies to the specified UIBlock (i.e. it does not affect the UIBlock's children), and the final render order is determined as follows:
- All UIBlocks with a Z-Index of
N
, sorted hierarchically - All UIBlocks with a Z-Index of
N + 1
, sorted hierarchically
Note
Unlike Unity's order in layer, Z-Index does not take precedence over distance to camera.
Sort Group Order
For coplanar content, SortingOrder can be used to ensure a SortGroup hierarchy renders in a desired order with respect to another SortGroup hierarchy. SortGroups with a higher sorting order render on top of those with a lower sorting order value.
Note
Unlike Unity's SortingGroup, SortingOrder does not take precedence over distance to camera.
Distance To Camera
Content that is closer to the camera renders on top of content behind it. Sorting between 3D Nova content, or Nova and non-Nova content uses the standard Unity sorting metric. Namely, the distance from the camera to the bounds-center of each is compared. The bounds of a UIBlock hierarchy encompasses all of the UIBlocks within the hierarchy.
Sorting of 2D Nova content considers more than just the center of the bounds to mitigate inconsistencies, artifacts, and "popping" that can occur from the standard sorting algorithm:
Render Queue
The render queue value on a SortGroup component modifies the material render queue for all of the transparent draw calls in its UIBlock hierarchy. This means that render queue can be used to configure the render order of Nova content and non-Nova content, such as making a UIBlock hierarchy always render before or after other objects in the scene:
Note
The render queue of opaque draw calls (currently limited to opaque UIBlock3Ds) are not affected by render queue and are always rendered at the default value of 2000
for opaque geometry.