Contents

disableDepthOfField

Disable the depth of field effect for all virtual content.

Declaration

static let disableDepthOfField: ARView.RenderOptions

Discussion

When you set the focal point of a camera, you actually choose a range of focus rather than a point. Objects outside the range — either too close or too far away — appear out of focus, while objects inside the range appear in focus. The size of the range, known as the depth of field, depends on characteristics of the lens, the focal point, and other factors.

[Image]

If you place a virtual object outside of the range of focus, it can appear detached from the scene in which it appears unless you blur the object to match its surroundings. In many cases, the depth of field is large enough that this doesn’t matter. But if it does matter for your app, you can enable a post-processing effect that blurs virtual objects to account for depth of field.

Without depth of field

With depth of field

[Image]

[Image]

Because of its computational cost, the system disables depth of field by default when you create a new ARView instance. To enable depth of field, remove the disableDepthOfField option from the renderOptions set. If you do enable depth of field, be sure to check your app’s performance, as described in Improving the Performance of a RealityKit App.

See Also

Disabling rendering effects