// Configure a material to only render pixels that are closer to the camera than existing pixels sceneMaterial.setDepthTest(DepthTest.LESS) // Configure a material to always render regardless of depth (useful for debug lines) sceneMaterial.setDepthTest(DepthTest.ALWAYS) // Configure a material to only render pixels at exactly the same depth as existing pixels sceneMaterial.setDepthTest(DepthTest.EQUAL)
enum DepthTest : Enum<DepthTest>
| Member | Description |
|---|---|
NEVER |
Never passes the depth test. The fragment is always discarded regardless of depth. Rarely used in practice.
|
LESS |
Passes the depth test if the fragment's depth is less than the stored depth. This is the most common depth test function for standard 3D rendering, as it ensures closer objects occlude farther ones.
|
EQUAL |
Passes the depth test if the fragment's depth is equal to the stored depth. Useful for drawing objects at exactly the same depth, like decals or overlays.
|
LESS_OR_EQUAL |
Passes the depth test if the fragment's depth is less than or equal to the stored depth. Similar to LESS, but also includes fragments at exactly the same depth.
|
GREATER |
Passes the depth test if the fragment's depth is greater than the stored depth. Can be used for special effects or rendering the back faces of objects.
|
NOT_EQUAL |
Passes the depth test if the fragment's depth is not equal to the stored depth. Rarely used in standard rendering.
|
GREATER_OR_EQUAL |
Passes the depth test if the fragment's depth is greater than or equal to the stored depth. Can be used for special effects or when rendering from back to front.
|
ALWAYS |
Always passes the depth test. The fragment is always drawn regardless of depth. Useful for UI elements, skyboxes, or other objects that should not be occluded.
|
encoding
: Int
[Get] |
Integer value corresponding to the native graphics API encoding for this depth test function
Signature
val encoding: Int |