An object that creates matte textures you use to occlude your app's virtual content with people, that ARKit recognizes in the camera feed.


class ARMatteGenerator : NSObject


Use this class when you want full control over occluding your app's virtual content, based on people ARKit recognizes in the camera feed.

To assist your custom renderer with people occlusion, matte generator processes alpha and depth information in a frame's segmentationBuffer and estimatedDepthData to provide you with matte and depth textures. You use these textures to layer people on top of your app's virtual content.


Creating a Matte Generator

Creating an Alpha Matte Texture

func generateMatte(from: ARFrame, commandBuffer: MTLCommandBuffer) -> MTLTexture

Generates alpha matte at either full resolution or half the resolution of the captured image.

Creating a Depth Texture

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

Generates dilated depth at the resolution of the segmentation stencil.

Controlling Resolution

enum ARMatteGenerator.Resolution

A resolution for a matte texture.


Inherits From

Conforms To

See Also

Custom Display

Effecting People Occlusion in Custom Renderers

Occlude your app’s virtual content where ARKit recognizes people in the camera feed by using matte generator.

Displaying an AR Experience with Metal

Control rendering of your app's virtual content on top of a camera feed.