docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Eye tracking and foveated rendering

    Configure foveated rendering on Android XR to reduce GPU load without a noticeable loss of visual quality.

    Foveated rendering lowers the resolution of the areas that a user doesn't look at directly. On devices that support eye tracking, gaze-based foveated rendering keeps the high-resolution area centered on the user's gaze. This page supplements Foveated rendering in OpenXR with the settings and permissions that Android XR requires.

    Prerequisites

    To use foveated rendering on Android XR, do the following:

    • Set the active build target to Android XR, or use an Android XR build profile.
    • Enable the Foveated Rendering feature in the OpenXR settings.

    When you set the active build target to Android XR, Unity enables the Android XR feature group and the Foveated Rendering feature in the XR Plug-in Management > OpenXR settings. You can set this build target in the Build Profiles window or an Android XR build profile. Unity applies these settings the next time the Unity Editor reloads scripts.

    For more information, refer to Android XR build profile in the Unity Manual.

    Enable eye tracking and foveated rendering

    To enable eye tracking and foveated rendering, configure the following in the OpenXR section of the XR Plug-in Management settings:

    1. Add the Eye Gaze Interaction Profile under Enabled Interaction Profiles.
    2. Enable the Foveated Rendering feature from All Features under OpenXR Feature Groups.

    Your application can now use foveated rendering. Gaze-based foveated rendering also requires the user to grant eye-tracking permission, which Unity requests for you. For more information, refer to Eye-tracking permission.

    For information about how to configure your interaction profiles and OpenXR features, refer to Configure project settings.

    Eye-tracking permission

    Gaze-based foveated rendering requires the android.permission.EYE_TRACKING_FINE permission. Fixed foveated rendering doesn't require it.

    When you enable the Foveated Rendering feature, Unity handles this permission for you:

    • At build time, Unity adds the permission to your application's Android manifest.
    • When Unity initializes XR, it requests the permission from the user if they haven't already granted it. You don't need to request the permission in your own code.

    If the user denies the permission, your application uses fixed foveated rendering instead. To use gaze-based foveated rendering, your application must also set XRDisplaySubsystem.foveatedRenderingFlags to FoveatedRenderingFlags.GazeAllowed. For more information, refer to Use the SRP foveation API.

    By default, Unity initializes XR when your application starts, so the permission prompt appears at launch. To control when the prompt appears, disable Initialize XR on Startup in Project Settings > XR Plug-in Management and initialize XR from your own code. For more information, refer to XR Plug-in Management settings in the Unity Manual.

    Optimize rendering at foveation level 0

    When you set the foveation level to 0, Android XR can disable fragment density map attachment automatically. Android XR applies this optimization when your project meets the requirements in Prerequisites. You don't need to call additional APIs or enable any other features.

    This optimization has no setting in the UI, and Android XR skips it without a warning in either of the following cases:

    • Your project doesn't use the Android XR build target or build profile.
    • You disable the Foveated Rendering feature in Project Settings > XR Plug-in Management > OpenXR.

    Warm up pipeline state objects

    Attaching or detaching the fragment density map changes the render pass, so Unity needs a separate pipeline state object (PSO) for each foveation state. Unity compiles a PSO the first time it renders a shader variant under a given state, then caches it.

    Because Unity caches each PSO, later changes between 0 and higher foveation levels reuse the PSOs it already compiled. A shader variant that Unity hasn't rendered before still compiles the first time it appears under either foveation state, which can cause a frame spike.

    If your application changes the foveation level to and from 0 during gameplay, warm up both sets of PSOs during a loading screen so that this compilation happens outside active gameplay.

    For more information, refer to Warm up PSOs in the Unity Manual.

    Additional resources

    • Foveated rendering in OpenXR
    • Foveated rendering (Unity Manual)
    • Configure project settings
    • Permissions
    • Android XR build profile (Unity Manual)
    In This Article
    Back to top
    Copyright © 2026 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)