---
title: ARView.PostProcessContext
framework: realitykit
role: symbol
role_heading: Structure
path: realitykit/arview/postprocesscontext
---

# ARView.PostProcessContext

An object the framework uses to pass data to a postprocess callback.

## Declaration

```swift
struct PostProcessContext
```

## Mentioned in

Checking the pixel format of a postprocess effect’s output texture Implementing postprocess effects using Metal compute functions Using Metal performance shaders to create custom postprocess effects

## Overview

Overview In iOS 15 and later, as well as macOS 12 and later, you can register a callback function to apply postprocessing effects to RealityKit’s rendered scene. Once every frame, RealityKit calls that function before it displays the scene. You can use this callback to apply postprocess effects using any APIs that can modify an image texture. However, because RealityKit calls this method every frame, you should only use APIs that execute on the GPU, such as Metal compute functions, Metal Performance Shaders, or Core Image. You can also render additional content, such as a rendered SpriteKit scene, on top of the frame buffer. note: For more information on implementing postprocess effects, see Implementing special rendering effects with RealityKit postprocessing, which demonstrates multiple postprocess techniques. A postprocess callback takes a single PostProcessContext parameter, which contains data the callback function needs to modify the rendered scene, including the frame buffer, depth map, and a property for writing the modified image. If you’ve registered a postprocess callback, that function needs to encode to the output texture or the frame is never displayed. A postprocess function looks like this:     func myPostProcessCallback(context: ARView.PostProcessContext) {         // Handle postprocessing here.     } To register a function as the postprocess render callback, assign it to the postProcess property of the renderCallbacks  property of the scene’s ARView: arView.renderCallbacks.postProcess = myPostProcessCallback To stop postprocessing, set the postProcess render callback to nil. arView.renderCallbacks.postProcess = nil If your app turns postprocessing on and off frequently, another option for disabling postprocess effects is to keep your callback registered, but use an MTLBlitCommandEncoder to encode the unmodified framebuffer directly to the output texture whenever postprocess effects aren’t active.  func myPostProcessCallback(context: ARView.PostProcessContext) {      if (usePostProcessEffects) {          handlePostProcessing(context: ARView.PostProcessContext)          return      }

// If postprocess effects are disabled, copy sourceColorTexture      // directly to targetColorTexture.      let blitEncoder = context.commandBuffer.makeBlitCommandEncoder()      blitEncoder?.copy(from: context.sourceColorTexture, to: context.targetColorTexture)      blitEncoder?.endEncoding()  }

## Topics

### Initializers

- [init(_:_:_:_:_:_:_:)](realitykit/arview/postprocesscontext/init(_:_:_:_:_:_:_:).md)

### Instance Properties

- [commandBuffer](realitykit/arview/postprocesscontext/commandbuffer.md)
- [device](realitykit/arview/postprocesscontext/device.md)
- [projection](realitykit/arview/postprocesscontext/projection.md)
- [sourceColorTexture](realitykit/arview/postprocesscontext/sourcecolortexture.md)
- [sourceDepthTexture](realitykit/arview/postprocesscontext/sourcedepthtexture.md)
- [targetColorTexture](realitykit/arview/postprocesscontext/targetcolortexture.md)
- [time](realitykit/arview/postprocesscontext/time.md)

## See Also

### Postprocessing

- [Postprocessing effects](realitykit/postprocessing-effects.md)
- [ARView.RenderCallbacks](realitykit/arview/rendercallbacks-swift.struct.md)
- [PostProcessEffect](realitykit/postprocesseffect.md)
