Camera

The following three types of cameras can usually be recognized and used:

  1. Camera under XROrigin

../_images/image_as1_1.png
  1. Camera configured on a FrameSource through Advanced Options when there is no XROrigin

../_images/image_as1_2.png
  1. The main camera when there is no XROrigin

../_images/image_as1_3.png

Camera configuration

../_images/image_as1_4.png ../_images/image_as1_5.png
  • Clear Flags: should be set to Solid Color to ensure the Camera image can be rendered properly. If set to Skybox, the Camera image will not be displayed. When using XR headsets or glasses, it is recommended to keep the device SDK’s default configuration.

  • Background: This is an optional setting; for better user experience it is recommended to set the background color to black so that a black screen is shown before the Camera device is opened and during switching. When using XR headsets or glasses, it is recommended to keep the device SDK’s default configuration.

  • Clipping Planes: In addition to the usual rendering and performance requirements, you should consider the physical size and distance of objects to be recognized or interacted with in the real scene. For example, set Near to 0.1 (meters) to avoid objects not appearing when the camera is very close, and set Far to 1000 (meters) to avoid distant objects being clipped.

Note

AR Foundation usually sets its clipping planes to (0.1, 20) , this may clip objects away displayed more than 20 meters from the Camera (the device in real world). Please make sure to change its value for your needs before you use them.

URP

When using URP, the camera image is rendered by the EasyARCameraImageRendererFeature, you need to refer to Universal Render Pipeline (URP) Configuration to add the EasyARCameraImageRendererFeature.

If it is not added correctly, you will see UI errors or error logs at startup or during running,

../_images/image_as1_6.png ../_images/image_as1_7.png

When using AR Foundation, AR Foundation provides a similar RendererFeature. You should refer to AR Foundation Introduction under Project Setup > Universal Render Pipeline to add ARBackgroundRendererFeature. This is not described in detail here.

Attention

Because Unity does not provide a public API to manipulate these features, you must add them manually in the editor; otherwise you will get errors at runtime or the camera image will not be displayed.