enum DepthTest : Enum<DepthTest>
// 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)
| Name | Summary |
|---|---|
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. |
| Name | Summary |
|---|---|
encoding | val encoding: Int Integer value corresponding to the native graphics API encoding for this depth test function |
name | val name: String |
ordinal | val ordinal: Int |
| Name | Summary |
|---|---|
valueOf | fun valueOf(value: String): DepthTest Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) |
values | fun values(): Array<DepthTest> Returns an array containing the constants of this enum type, in the order they’re declared. |