Skip to content

Cameras in the scene and video background

Philip Lamb edited this page Sep 11, 2023 · 4 revisions

At runtime, artoolkitX for Unity creates objects in the scene to render the camera feed behind your AR content. We call this the "video background". For a monocular camera, a single Unity Texture2D and a gameobject and components to render the texture are created during ARXController.StartAR(), and dynamically updated each loop through ARXController.UpdateAR().

The video background requires its own layer. You specify this layer via the setting on ARXController:

Unity Editor view of ARXController component, showing the layer setting under video settings

The video background will be created in this layer, and associated with a 2D orthogonal camera which renders only this layer. While any Camera with ARXCamera component attached will have its culling mask set so as to not render the content of this layer, if you have other camera cameras in the scene you should unset this layer on their culling mask:

Unity Editor view of an extra Camera component showing its culling mask with video background layer unchecked

Since the video background image is not usually wanted in the Unity Editor scene view, it is recommended to hide the layer from the scene view using the Layers inspector. Click the "eye" icon so it is crossed out.

Unity Editor layers inspector with AR background layer hidden