API reference
API reference
Select your platform
No SDKs available
No versions available

DepthWrite

DepthWrite

enum DepthWrite : Enum<DepthWrite>
Controls whether rendering operations write to the depth buffer.
The depth buffer (or Z-buffer) stores depth information for each pixel in a rendered scene. This enum determines whether a material will update the depth buffer when rendered.
Depth writing works in conjunction with depth testing (DepthTest). While depth testing determines whether a fragment should be drawn based on existing depth values, depth writing controls whether that fragment updates the depth buffer with its own depth value.
Example usage:
// Enable depth writing for standard opaque objects
sceneMaterial.setDepthWrite(DepthWrite.ENABLE)

// Disable depth writing for transparent objects
sceneMaterial.setDepthWrite(DepthWrite.DISABLE)
Common use cases:
  • Enable depth writing for opaque objects to ensure proper occlusion
  • Disable depth writing for transparent objects to allow proper blending

Entries

NameSummary
ENABLE

Enables writing to the depth buffer.
DISABLE

Disables writing to the depth buffer.

Properties

NameSummary
encoding
val encoding: Int

Integer value corresponding to the native graphics API encoding for this depth write mode
name
val name: String
ordinal
val ordinal: Int

Functions

NameSummary
valueOf
fun valueOf(value: String): DepthWrite

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<DepthWrite>

Returns an array containing the constants of this enum type, in the order they’re declared.
Did you find this page helpful?