docs.unity3d.com

AR Foundation 6.0.1

Search Results for

    Show / Hide Table of Contents

    Camera components

    AR Foundation uses two primary components to control device camera functionality in your AR scene: ARCameraManager and ARCameraBackground. Your scene should contain at most one of each of these components enabled at a time. After initial scene setup you can find AR Camera Manager and AR Camera Background components in the XR Origin GameObject hierarchy at XR Origin > Camera Offset > Main Camera.

    AR Camera Manager component

    The ARCameraManager component is a manager that enables or disables the device camera when the component is enabled or disabled, respectively, and gives you a scripting interface for camera-related features.

    AR Camera Manager component
    AR Camera Manager component

    Property Description
    Auto Focus Enables or disables a request to use the camera's automatic focus mode. When disabled, fixed focus mode is used. Availability of Auto Focus depends on camera hardware.
    Image Stabilization Helps stabilize shaky video from the camera. You can check the XRCameraSubsystemDescriptor.supportsImageStabilization to determine whether your provider supports Image Stabilization.
    Light Estimation Estimates lighting properties of the environment. There are five options:
    • Ambient Intensity: Estimates the overall average brightness
    • Ambient Color: Estimates the overall average color
    • Ambient Spherical Harmonics: Estimates the spherical harmonics describing the scene. Spherical harmonics are used to produce more realistic lighting calculations.
    • Main Light Direction: Estimates the direction of the primary light source. The direction points away from the light (so that it matches the light's direction).
    • Main Light Intensity: Estimates the brightness of the primary light source.
    While you can request any of these simultaneously, support for each varies among devices. Some platforms might not be able to simultaneously provide all options, or it might depend on other features (for example, camera Facing Direction).
    Facing Direction Controls which camera is used. This value can be either World or User. On handheld mobile devices like phones and tablets, World refers to the rear camera and User refers to the front-facing ("selfie") camera.
    Render Mode Sets the ARCameraManager's requestedBackgroundRenderingMode, which specifies the stage in Unity's render pipeline that the AR camera background is rendered. There are three options:
    • Any: Let the camera provider decide when to render the background.
    • Before Opaques: Render the full camera background before opaque geometry. This is the default behavior on Android and iOS.
    • After Opaques: Selectively render the camera background after opaque geometry, rendering only pixels that are not occluded by opaque geometry in the scene. If your scene occludes a significant portion of the background with opaque geometry, this render mode can be an optimization to reduce overdraw.
    Note

    After Opaques has slightly different rendering behavior beyond its render order. After Opaques also causes ARCameraBackground to render a fullscreen quad at the Camera's farClipPlane to ensure that depth testing properly culls fragments that are behind opaque geometry.

    AR Camera Background component

    The ARCameraBackground component renders video from the device camera as the background of the scene. Enable this component to render the AR background, and disable it to disable background rendering.

    AR Camera Background component
    AR Camera Background component

    Property Description
    Use Custom Material If you set Use Custom Material to true, ARCameraBackground uses the Custom Material you specify to render the background.
    Custom Material Only visible if Use Custom Material is true. Set this property to use your own shader to render the background. AR Foundation uses the Material from the active provider plug-in by default, but you can override the default with your own Material.

    Apple and ARKit are trademarks of Apple Inc., registered in the U.S. and other countries and regions.

    In This Article
    • Camera components
    • AR Camera Manager component
    • AR Camera Background component
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)