This page describes the depth test property in Qt Quick 3D.
When disabled, the depthTestEnabled property can be used to simultaneously override depth testing and the order of rendering the objects. The operation of this property is not as obvious as many of the other properties in the system so this page offers some insight into when, where, and why this property can be used.
默认情况下,
depthTestEnabled
特性为
true
. This is the normal mode of operation, and rendering is done in two passes. First, reading and writing from the depth buffer is enabled and all opaque objects are rendered from front to back (objects closer to camera are rendered first). In the second pass, writing to the depth buffer is disabled and all transparent (non-opaque) objects are rendered from back to front.
The first pass allows for optimal z-culling for normal opaque 3D objects and the second pass allows for correct blending of transparent objects.
当设为
false
, rendering is done in single pass. In this mode the depth buffer is not used at all, and all objects are rendered in a single back to front pass.
Each setting for this property has pros and cons.
Pros:
Cons:
Pros:
Cons:
The depthTestEnabled property is an advanced feature that can be used to improve performance under certain specific scenarios. It can be activated per-scene to enable a separate one pass rendering technique that can achieve better performance than the default rendering technique, by eliminating depth testing in cases where 3D objects do not overlap or intersect.
This property should be disabled with some care. Although it is possible to increase performance by disabling this property on some scenes, it can introduce undesirable rendering errors and even in some cases adversely affect performance. Remember to measure thoroughly when optimizing.