Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / Using IDL / Controlling the Depth of Objects in a View

IDL

Controlling the Depth of Objects in a View

Controlling the Depth of Objects in a View

In graphics rendering, the depth buffer is an array of depth values maintained by a graphics device, one value per pixel, to record the depth of primitives rendered at each pixel. It is usually used to prevent the drawing of objects located behind other objects that have already been drawn in order to generate a visually correct scene. In IDL, smaller depth values are closer to the viewer.

Depth buffer properties provide more control over how Object Graphics primitives are affected by the depth buffer. You can now control which primitives may be rejected from rendering by the depth buffer, how the primitives are rejected, and which primitives may update the depth buffer.

Control of the depth buffer is achieved through a test function or by completely disabling the buffer. The depth test function is a logical comparison function used by the graphics device to determine if a pixel should be drawn on the screen. This decision is based on the depth value currently stored in the depth buffer and the depth of the primitive at that pixel location.

The test function is applied to each pixel of an object. A pixel of the object is drawn if the object’s depth at that pixel passes the test function set for that object. If the pixel passes the depth test, the depth buffer value for that pixel is also updated to the pixel’s depth value.

The possible test functions are:

  • INHERIT - use the test function set for the parent model or view.
  • NEVER - never passes.
  • LESS - passes if the depth of the object’s pixel is less than the depth buffer’s value.
  • EQUAL - passes if the depth of the object’s pixel is equal to the depth buffer’s value.
  • LESS OR EQUAL - passes if the depth of the object’s pixel is less than or equal to the depth buffer’s value.
  • GREATER - passes if the depth of the object’s pixel is greater than or equal to the depth buffer’s value.
  • NOT EQUAL - passes if the depth of the object’s pixel is not equal to the depth buffer’s value.
  • GREATER OR EQUAL - passes if the depth of the object’s pixel is greater than or equal to the depth buffer’s value.
  • ALWAYS - always passes

The IDL default is LESS. Commonly used values are LESS and LESS OR EQUAL, which allow primitives closer to the viewer to be drawn.

Disabling the depth test function allows all primitives to be drawn on the screen without testing their depth against the values in the depth buffer. When the depth test is disabled, the graphics device effectively uses the painter’s algorithm to update the screen. That is, the last item drawn at a location is the item that remains visible. The depth test function of ALWAYS produces the same result as disabling the depth test.

Moreover, you can disable updating the depth buffer. Disabling depth buffer writing prevents the updating of depth information as primitives are drawn to the frame buffer. Such primitives are unprotected in the sense that any other primitive drawn later at that location will draw over it as if it were not there.

Most visualization objects now have the following properties related to the depth buffer:

  • DEPTH_TEST_DISABLE
  • DEPTH_TEST_FUNCTION
  • DEPTH_WRITE_DISABLE



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us