<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/PhysicallyBasedMaterial/writesDepth",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation23PhysicallyBasedMaterialV11writesDepthSbvp"
  },
  "title" : "writesDepth"
}
-->

# writesDepth

A boolean value that determines whether this material writes its depth into RealityKit’s depth buffer.

```
var writesDepth: Bool { get set }
```

## Discussion

If true, meshes with this material will occlude objects behind them by writing their depth
into RealityKit’s depth buffer.

If false, meshes with this material will not write their depth into
RealityKit’s depth buffer, and may be overwritten by objects drawn behind them, depending on
draw order.

The default value is true.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)