<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ARKit",
  "identifier" : "/documentation/ARKit/ARMatteGenerator/generateDilatedDepth(from:commandBuffer:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "ARKit"
    ],
    "preciseIdentifier" : "c:objc(cs)ARMatteGenerator(im)generateDilatedDepthFromFrame:commandBuffer:"
  },
  "title" : "generateDilatedDepth(from:commandBuffer:)"
}
-->

# generateDilatedDepth(from:commandBuffer:)

Generates dilated depth at the resolution of the segmentation stencil.

```
func generateDilatedDepth(from frame: ARFrame, commandBuffer: any MTLCommandBuffer) -> any MTLTexture
```

## Return Value

A dilated depth texture which consists of a single channel of type `float32`.

## Discussion

You use the linear depth information this function provides when compositing a virtual object with the camera image.

---

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)