What Is Z-Order?

Article Details
  • Written By: Eugene P.
  • Edited By: Angela B.
  • Last Modified Date: 15 September 2019
  • Copyright Protected:
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
In 2014, scientists mapped a roundworm's brain and uploaded it into a Lego robot, which moved without instructions.  more...

October 15 ,  1969 :  The US Vietnam Moratorium march took place.  more...

Z-Order is the name given to the process involved in sorting which items in a computer application should appear visually in front of other objects. One common use for z-order is when there are multiple windows open in a graphical user interface (GUI) and the z-order determines which windows will be drawn fully and which ones will be obscured by the windows above them. The name z-order derives from the traditional naming conventions used when describing three-dimensional (3D) spaces, where X refers to the right-left direction, Y to the up-down direction and Z to the forward-back direction. Nearly all 3D applications use some form of z-ordering to quickly determine which objects should or should not be rendered to increase the display speed of a scene.

The actual axis being described by a z-order can be thought of as extending into the display field, moving either toward or away from a viewer looking at the monitor. The further away an object is, the higher its number in the ordering, while closer objects have lower numbers. By using simple sorting algorithms, objects that are more distant from the viewer can be excluded from view or can be only partially drawn, because they are obscured by objects that are closer.


One common use for z-order is to maintain the state of a series of open windows or other GUI elements in an application. When a window or other element is generated, it is assigned an order number to indicate that it is in full view. If another window or element is opened, the z-ordering is shifted so the new active window is considered closest. In addition to helping provide cues that make drawing GUI elements more efficient, some operating systems or applications also use it to determine the tab order so that, when a user uses the keyboard to cycle through a GUI, the elements that gain focus are selected based on their z-order.

Graphics editing programs use z-ordering methods to draw images that have multiple layers, ensuring that the layers are rendered in the correct sequence. This same principle is applied to programs used for publication or layout, where several elements can be stacked to create a composite. In some situations, as in vector graphics, the order also is used to calculate geometric operations on objects, such as creating a union or difference between layered geometries.

In 3D applications, the z-order also is sometimes called a z-buffer or depth buffer. Aside from providing an optimized way to sort objects within a scene, it also allows for efficient hidden surface removal. Objects that have a distant enough number in the z-ordering can be ignored and not rendered at all, while objects that are covered by closer shapes can have entire segments of their geometry left un-rendered because they cannot be seen.


You might also Like


Discuss this Article

Post your comments

Post Anonymously


forgot password?