上传YomovSDK

This commit is contained in:
Sora丶kong
2026-03-03 03:15:46 +08:00
parent 9096da7e6c
commit eb97f31065
6477 changed files with 1932208 additions and 3 deletions

View File

@@ -0,0 +1,88 @@
---
uid: openxr-composition-layers
---
# Composition Layers Support
The OpenXR Composition Layers feature provides support for rendering high quality images on layer types, such as cylinder, equirect, cube, and more, on platforms like the Quest headsets.
This functionality allows developers to manage visual layers in a flexible, performant way, tailored for XR applications.
Refer to the [Composition Layers](https://docs.unity3d.com/Packages/com.unity.xr.compositionlayers@latest) documentation for information about using composition layers in a scene.
## Installation
To use this feature, install the [Composition Layers package](https://docs.unity3d.com/Packages/com.unity.xr.compositionlayers@1.0/manual/index.html). Follow the steps in the package documentation for installation details.
## Enabling Composition Layers
Once the package is installed, you can enable OpenXR Composition Layers in your Unity project:
1. Open the **Project Settings** window (menu: **Edit > Project Settings**).
2. Select **XR Plug-in Management** from the list of settings on the left.
3. If necessary, enable **OpenXR** in the list of **Plug-in Providers**. Unity installs the OpenXR plug-in, if not already installed.
4. Select the **OpenXR** settings page under **XR Plug-in Management**.
5. Enable the **Composition Layer Support** option in the **OpenXR Feature Groups** area of the **OpenXR** settings.
![OpenXR feature options](../../images/openxr-features.png)
## Custom Layers
In addition to the built-in layer types supported by the Composition Layers feature, you can create and register your own custom composition layers. This is particularly useful when your project requires non-standard visual behavior, optimized layer rendering, or complex interactions in AR/VR environments.
### Custom Layer Example
The following example demonstrates how to create a custom layer handler for a custom layer type. This handler is responsible for managing the lifecycle of the layer, rendering, and other properties.
```c#
#if UNITY_EDITOR
[UnityEditor.XR.OpenXR.Features.OpenXRFeature(UiName = "OpenXR Custom Layer Handler Example",
BuildTargetGroups = new[] { BuildTargetGroup.Standalone, BuildTargetGroup.WSA, BuildTargetGroup.Android },
Company = "Unity",
Desc = "An example to demonstrate how to enable a handler for a customized composition layer type.",
DocumentationLink = "",
FeatureId = "com.unity.openxr.features.customlayerexample",
OpenxrExtensionStrings = "",
Version = "1")]
#endif
public class CustomFeature : OpenXRFeature
{
bool isSubscribed;
protected override void OnEnable()
{
if (OpenXRLayerProvider.isStarted)
CreateAndRegisterLayerHandler();
else
{
OpenXRLayerProvider.Started += CreateAndRegisterLayerHandler;
isSubscribed = true;
}
}
protected override void OnDisable()
{
if (isSubscribed)
{
OpenXRLayerProvider.Started -= CreateAndRegisterLayerHandler;
isSubscribed = false;
}
}
protected void CreateAndRegisterLayerHandler()
{
if (enabled)
{
var layerHandler = new CustomLayerHandler();
OpenXRLayerProvider.RegisterLayerHandler(typeof(CustomQuadLayerData), layerHandler);
}
}
}
#endif
```
This code can also be imported from the OpenXR Samples in the Package Manager.
### When to Use Custom Layers
You may want to create a custom layer in situations where:
- You need to implement a specific rendering technique not covered by the standard layer types (such as a specialized quad or cylinder layer).
- Performance optimizations for specific layer interactions are required.
- Create unique visual effects or layer behaviors in your XR application.
By registering custom layer handlers, you can gain full control over how the composition layers are processed and rendered, allowing for more tailored XR experiences.

View File

@@ -0,0 +1,28 @@
---
uid: openxr-dpad-interaction
---
# D-Pad Interaction
Unity OpenXR provides support for the Dpad Binding extension specified by Khronos. Use this layout to retrieve the bindings data that the extension returns. This extension allows the application to bind one or more digital actions to a trackpad or thumbstick as though it were a dpad by defining additional component paths to suggest bindings for.
Enables the OpenXR interaction profile for Dpad Interaction and exposes the `<DPad>` layout within the [Unity Input System](https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/).
For more information about the Dpad Binding extension, refer to the [OpenXR Specification](https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_dpad_binding).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
| `/input/thumbstick/dpad_up` | thumbstickDpadUp | Boolean |
| `/input/thumbstick/dpad_down` | thumbstickDpadDown | Boolean |
| `/input/thumbstick/dpad_left` | thumbstickDpadLeft | Boolean |
| `/input/thumbstick/dpad_right` | thumbstickDpadRight | Boolean |
| `/input/trackpad/dpad_up` | trackpadDpadUp | Boolean |
| `/input/trackpad/dpad_down` | trackpadDpadDown | Boolean |
| `/input/trackpad/dpad_left` | trackpadDpadLeft | Boolean |
| `/input/trackpad/dpad_right` | trackpadDpadRight | Boolean |
| `/input/trackpad/dpad_center` | trackpadDpadCenter | Boolean |

View File

@@ -0,0 +1,23 @@
---
uid: openxr-eye-gaze-interaction
---
# Eye Gaze Interaction
Unity OpenXR provides support for the Eye Tracking Interaction extension specified by Khronos. Use this layout to retrieve the pose data that the extension returns.
At present, this device does not appear in the Unity Input System drop-down menus. To bind, go the gaze position/rotation, and use the following binding paths.
|**Data**|**Binding Path**|
|--------|------------|
|Position|`<EyeGaze>/pose/position`|
|Rotation|`<EyeGaze>/pose/rotation`|
For more information about the Eye Gaze extension, refer to the [OpenXR Specification](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_eye_gaze_interaction).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
| `/input/gaze_ext/pose` | pose | Pose |

View File

@@ -0,0 +1,206 @@
---
uid: openxr-foveated-rendering
---
# Foveated rendering in OpenXR
Foveated rendering is an optimization technique that can speed up rendering with little perceived impact on visual quality. Foveated rendering works by lowering the resolution of areas in the user's peripheral vision. On headsets that support eye-tracking as well as foveated rendering, the higher-resolution area can be centered where the user is currently looking. Without eye-tracking, the higher resolution area is fixed near the middle of the screen. Fixed foveated rendering can be more apparent to the user since they can shift their eyes to look at the peripheral areas.
OpenXR platforms use the variable shading rate (VSR) technique for foveated rendering, which does not require you to change custom shaders. (However, if you are creating assets that should work on all XR platforms, refer to the "Foveated rendering shaders" topic in [Foveated rendering](https://docs.unity3d.com/Manual/xr-foveated-rendering.html) to learn how to write shaders and shader graphs that work under all supported foveated rendering methods.)
OpenXR devices can implement VRS using a variety of techniques and a single device can support more than one implementation. The Unity OpenXR plug-in chooses from the following techniques, in this order, depending on what the current device supports:
1. Gaze-based Fragment Density Map (GFDM) from provider.
2. Fixed Fragment Density Map (FFDM) from provider.
3. Fragment Shading Rate (FSR) using a provider's texture.
4. Fragment Shading Rate using a compute shader calculated from the asymmetric FOVs the provider gives.
This topic covers aspects of foveated rendering specific to the Unity OpenXR provider plug-in:
* [Prerequisites](#prerequisites)
* [Configure foveated rendering](#configure-foveated-rendering)
* [Use the **SRP Foveation** API](#use-the-srp-foveation-api)
* [Use the **Legacy** API](#use-the-legacy-api)
* [Request eye-tracking permission on Android](#request-eye-tracking-permission)
For general information about foveated rendering in Unity XR, refer to [Foveated rendering](https://docs.unity3d.com/Manual/xr-foveated-rendering.html).
<a id="prerequisites"></a>
## Prerequisites
To use the foveated rendering feature in OpenXR, your project must meet the following prerequisites:
* Unity 6+
* Unity OpenXR plugin (com.unity.xr.openxr) 1.11.0+
* Universal Rendering Pipeline or High Definition Render Pipeline (HDRP not recommended for mobile XR platforms such as the Meta Quest family of devices)
Alternately, you can use the Meta Core XR SDK package to access the OpenXR foveated rendering feature on Quest devices:
* Unity 2022.2+, Unity 6+
* Unity OpenXR plugin (com.unity.xr.openxr) 1.11.0+
* Meta Core XR SDK 68.0+
* Built-in or Universal Rendering Pipeline
> [!NOTE]
> The primary differences between the Unity **SRP Foveation** API and the Meta API for foveated rendering include:
>
> * They uses different APIs and code paths to enable and control foveated rendering on a device.
> * The Unity **SRP Foveation** API works on all platforms that support foveated rendering, which allows you to share code across different types of devices.
> * The Unity **SRP Foveation** API does not support the Built-in Rendering Pipeline.
> * The Meta API, which only works on Quest devices, supports Unity 2022.3 and the Built-in Render Pipeline.
> * The Meta API does not support foveated rendering when you use intermediate render targets. Intermediate rendering targets are used by post-processing, tone mapping and camera stacking, for example, and may be used by other rendering features, too.
>
> Unity recommends that you use the Unity **SRP Foveation** API where possible for better compatibility. You can still use other features from the Meta Core XR SDK in conjunction with the **SRP Foveation** API, if desired.
<a id="configure-foveated-rendering"></a>
## Configure foveated rendering
You can configure foveated rendering in a project that meets the [Prerequisites](#prerequisites):
* [Configure SRP Foveation](#configure-srp-foveation)
* [Configure Legacy foveated rendering](#configure-legacy-foveated-rendering)
* [Configure gaze-based foveated rendering](#configure-gaze-based-foveated-rendering)
Once configured in settings, you must also turn on foveated rendering at runtime. By default, the foveated rendering strength or level is set to off. You must also set a runtime flag to use gaze-based foveated rendering.
Refer to the following topics for more information:
* [Use the SRP Foveation API](#use-the-srp-foveation-api)
* [Use the Legacy API](#use-the-srp-foveation-api)
<a id="configure-srp-foveation"></a>
### Configure SRP Foveation
To enable the **SRP Foveation** API in Unity 6+:
1. Open the **Project Settings** window.
2. Under **XR Plug-in Management**, select the **OpenXR** settings.
3. Set the **Foveated Rendering API** option to **SRP Foveation**.
3. In the list of **OpenXR Feature Groups**, select **All Features**.
4. Enable the **Foveated Rendering** feature.
![SRP Foveation settings](../images/FoveatedRendering/xr-foveation-srp-api-settings.png)<br/>*Settings to enable foveated rendering with the **SRP Foveation** API*
After you have configured the settings, you must also turn on foveated rendering at runtime. Refer to [Use the SRP Foveation API](#use-the-srp-foveation-api) for more information.
> [!NOTE]
> You must configure the project to use either the [Universal Render Pipeline (URP)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@17.0/manual/InstallURPIntoAProject.html) or the [High Definition Render Pipeline (HDRP)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@17.0/manual/convert-project-from-built-in-render-pipeline.html), if you have not already done so.
<a id="configure-legacy-foveated-rendering"></a>
### Configure Legacy foveated rendering
In Unity 6+, set the OpenXR **Foveated Render API** option to **Legacy** to use the Meta Core XR SDK, which only supports the Meta Quest family of devices. In Unity 2022, there is no option to select a **Foveated Rendering API**. Only the legacy API using the Meta Core XR SDK is supported.
1. Install the [Meta Core XR SDK](com.unity3d.kharma:upmpackage/com.meta.xr.sdk.core) package, if necessary. You can get this package from the [Unity Asset Store](https://assetstore.unity.com/packages/tools/integration/meta-xr-core-sdk-269169). The package adds the Meta OpenXR feature group to the OpenXR along with the associated features. Refer to the [Meta Developer site](https://developer.oculus.com/downloads/package/meta-xr-core-sdk/68.0) for more information.
2. Open the **Project Settings** window.
3. Select the **XR Plug-in Management** settings from the list on the left.
4. Select the **Android** tab.
5. Under **OpenXR**, enable the **Meta XR feature group**, which is added when you install the Meta Core SDK package. (You might be prompted to restart the Unity Editor, which you can do now or after you finish configure these settings.)
![Enable Meta XR feature group](../images/FoveatedRendering/xr-meta-feature-group.png)
6. Select the **OpenXR** settings area (below **XR Plug-in Management**).
7. Set the **Foveated Rendering API** option to **Legacy**.
8. In the list of **OpenXR Feature Groups**, select **All Features**.
9. Disable the **Foveated Rendering** feature, if it is enabled.
10. Enable the **Meta XR Foveated Rendering** feature.
11. (Optional) Enable the **Meta XR Eye Tracked Foveation** feature.
![Legacy Foveation settings](../images/FoveatedRendering/xr-foveation-legacy-settings.png)<br/>*Settings to enable foveated rendering with the **Legacy** API*
After you have configured the settings, you must also turn on foveated rendering at runtime. Refer to [Use the Legacy API](#use-the-legacy-api) for more information.
> [!NOTE]
> The Meta Core XR SDK is a third-party package, which is not under Unity control. The OpenXR features and API it provides can change without notice.
<a id="configure-gaze-based-foveated-rendering"></a>
### Configure gaze-based foveated rendering
Devices that provide eye tracking can support gaze-based foveated rendering in which the highest resolution area is centered where the user is looking.
When using the Unity **SRP Foveation** API, you do not need to enable gaze-based foveated rendering in the OpenXR settings. You do need to [turn the feature on at runtime](#use-the-srp-foveation-api) and make sure any required permissions are enabled.
When using the **Legacy**, Meta Core XR SDK, you must enable the **Meta XR Eye Tracked Foveation** OpenXR feature.
To use eye-tracking data, you must [Request eye-tracking permission on Android](#request-eye-tracking-permission). Other platforms may have similar requirements.
<a id="use-the-srp-foveation-api"></a>
## Use the SRP Foveation API
After you have configured foveated rendering in the OpenXR settings, you must also turn the feature on at runtime. If you want to use gaze-based foveated rendering, you must set a runtime flag, which might require user permission.
To specify the amount, or *strength*, of the foveation effect, you must assign a value between 0 and 1 to the [XRDisplaySubsystem.foveatedRenderingLevel](xref:UnityEngine.XR.XRDisplaySubsystem.foveatedRenderingLevel) property. The default value of zero turns foveation off altogether. A value of one is the maximum strength. Different device types can interprete this value in the way that best suits their native API. Meta Quest devices, for example, have discrete levels for setting the foveation strength: if you assign a value of `0.5` to `foveatedRenderingLevel`, the provider plug-in sets the device's *medium* foveation level.
To specify that you want to use gaze-based foveated rendering, set [XRDisplaySubsystem.foveatedRenderingFlags](xref:UnityEngine.XR.XRDisplaySubsystem.foveatedRenderingFlags) to [FoveatedRenderingFlags.GazeAllowed](xref:UnityEngine.XR.XRDisplaySubsystem.FoveatedRenderingFlags.GazeAllowed). If you do not set this flag, the device doesn't support gaze-based foveated rendering, or the user turns off or denies permission to use eye-tracking, then fixed foveated rendering is performed.
To set either of these foveated rendering APIs, you must first get a reference to the active [XRDisplaySubsystem](xref:UnityEngine.XR.XRDisplaySubsystem) from the Unity [SubsystemManager](xref:UnityEngine.SubsystemManager). Unity supports multiple subsystems of the same type, and returns a list when you get the subsystems of a given type. Ordinarily, only one `XRDisplaySubsystem` exists and you can use the lone subsystem in the `XRDisplaySubsystem` list returned by [SubsystemManager.GetSubsystems](https://docs.unity3d.com/6000.0/Documentation/ScriptReference/SubsystemManager.GetSubsystems.html).
The following code example illustrates how to set foveated rendering to full strength and enable gaze-based foveation after getting the instance of the active `XRDisplaySubsystem`:
```C#
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
public class FoveationStarter : MonoBehaviour
{
List<XRDisplaySubsystem> xrDisplays = new List<XRDisplaySubsystem>();
void Start()
{
SubsystemManager.GetSubsystems(xrDisplays);
if (xrDisplays.Count == 1)
{
xrDisplays[0].foveatedRenderingLevel = 1.0f; // Full strength
xrDisplays[0].foveatedRenderingFlags
= XRDisplaySubsystem.FoveatedRenderingFlags.GazeAllowed;
}
}
}
```
> [!NOTE]
> This code example relies on methods available in Unity 6+. It does not compile in earlier versions.
<a id="use-the-legacy-api"></a>
## Use the Legacy API
This API was built only for Quest headsets; it may not be supported on other devices. You must install Meta's Core XR SDK package for this API to be available.
After you configured foveated rendering in the OpenXR settings, you must also turn the feature on at runtime. If you want to use gaze-based foveated rendering, you must set a runtime flag, which might require user permission.
The following code example illustrates how to set foveated rendering to High and enable gaze-based foveation using the **Legacy API** and the Meta Core XR SDK package:
```C#
using UnityEngine;
using UnityEngine.XR;
public class FoveationStarter : MonoBehaviour
{
private void Start()
{
OVRManager.foveatedRenderingLevel = OVRManager.FoveatedRenderingLevel.High;
OVRManager.eyeTrackedFoveatedRenderingEnabled = true;
}
}
```
Refer to Meta's [OVRManager Class Reference](https://developer.oculus.com/reference/unity/v67/class_o_v_r_manager#acbd6d504192d2a2a7461382a4eae0715a84ec48f67b50df5ba7f823879769e0ad) for more information.
<a id="request-eye-tracking-permission"></a>
## Request eye-tracking permission on Android
The Android platform requires the user to grant permission before your app can access eye-tracking data. Eye-tracking permission is required to use gaze-based foveated rendering.
To declare that your application uses eye tracking, you must add a `uses-feature` and a `uses-permission` element to your application's Android manifest file:
``` xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<uses-feature android:name="oculus.software.eye_tracking" android:required="false" />
<uses-permission android:name="com.oculus.permission.EYE_TRACKING" />
... the rest of the manifest elements ...
```
Refer to [Declare permissions for an application](xref:um-android-permissions-declare) for instructions about how to add these and other custom elements to the Android manifest.
If the user denies permission, your application uses fixed foveated rendering instead. Refer to [Request runtime permissions
](xref:um-android-requesting-permissions) for more information about handling Android permissions issues, including how to handle cases where the user has denied permission.

View File

@@ -0,0 +1,24 @@
---
uid: openxr-hand-common-poses-interaction
---
# Hand Common Poses Interaction
Unity OpenXR provides support for the Hand Interaction extension specified by Khronos. Use this layout to retrieve the bindings data that the extension returns. This extension defines four commonly used action poses for all user hand
interaction profiles including both hand tracking devices and motion controller devices.
Enables the OpenXR interaction feature for Hand Common Poses Interaction and exposes the `<HandInteractionPoses>` layout within the [Unity Input System](https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/).
OpenXR Specification about Hand Interaction Extension will be updated here when it is available.
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
|`/input/grip/pose` | devicePose | Pose |
|`/input/aim/pose` | pointer | Pose |
|`/input/pinch_ext/pose` | pinchPose | Pose |
|`/input/poke_ext/pose` | pokePose | Pose |

View File

@@ -0,0 +1,32 @@
---
uid: openxr-hand-interaction-profile
---
# Hand Interaction Profile
The hand interaction profile is designed for runtimes which provide hand inputs using hand tracking devices instead of controllers with triggers or buttons.
The hand interaction profile allows hand tracking devices to provide commonly used gestures and action poses. Enable this OpenXR interaction profile to expose the `<HandInteraction>` device layout within the [Unity Input System](xref:input-system-index).
OpenXR Specification about Hand Interaction Profile will be updated here when it is available.
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
|`/input/grip/pose` | devicePose | Pose |
|`/input/aim/pose` | pointer | Pose |
|`/input/pinch_ext/pose` | pinchPose | Pose |
|`/input/poke_ext/pose` | pokePose | Pose |
|`/input/pinch_ext/value`| pinchValue | Float |
|`/input/pinch_ext/ready_ext` | pinchReady | Boolean|
|`/input/aim_activate_ext/value`| pointerActivateValue | Float |
|`/input/aim_activate_ext/ready_ext` | pointerActivateReady | Boolean|
|`/input/grasp_ext/value`| graspValue | Float |
|`/input/grasp_ext/ready_ext` | graspReady | Boolean|
| Unity Layout Only | isTracked | Flag Data |
| Unity Layout Only | trackingState | Flag Data |
| Unity Layout Only | devicePosition | Vector3 |
| Unity Layout Only | deviceRotation | Quaternion |
[!include[](snippets/unity-layout.md)]

View File

@@ -0,0 +1,35 @@
---
uid: openxr-hp-reverb-g2-controller-profile
---
# HP Reverb G2 Controller Profile
Enables the OpenXR interaction profile for the HP Reverb G2 Controller and exposes the `<ReverbG2Controller>` device layout within the [Unity Input System](xref:input-system-index).
For more information about the HP Reverb G2 interaction profile, refer to the [OpenXR Specification](https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_hp_mixed_reality_controller).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
|`/input/x/click`| primaryButton (Left Hand Only) | Boolean |
|`/input/y/click`| secondaryButton (Left Hand Only) | Boolean |
|`/input/a/click`| primaryButton (Right Hand Only) | Boolean |
|`/input/b/click`| secondaryButton (Right Hand Only) | Boolean |
|`/input/menu/click` | menu | Boolean|
|`/input/squeeze/value`| grip | Float |
|`/input/squeeze/value`| gripPressed | Boolean (float cast to Boolean) |
|`/input/trigger/value`|trigger| Float |
|`/input/trigger/value`| triggerPressed | Boolean (float cast to Boolean) |
|`/input/thumbstick`| thumbstick | Vector2 |
|`/input/thumbstick/click`| thumbstickClicked | Boolean |
|`/input/grip/pose` | devicePose | Pose |
|`/input/aim/pose` | pointer | Pose |
|`/output/haptic` | haptic | Vibrate |
| Unity Layout Only | isTracked | Flag Data |
| Unity Layout Only | trackingState | Flag Data |
| Unity Layout Only | devicePosition | Vector3 |
| Unity Layout Only | deviceRotation | Quaternion |
[!include[](snippets/unity-layout.md)]

View File

@@ -0,0 +1,33 @@
---
uid: openxr-htc-vive-controller-profile
---
# HTC Vive Controller Profile
Enables the OpenXR interaction profile for the HTC Vive Controller and exposes the `<ViveController>` device layout within the [Unity Input System](xref:input-system-index).
For more information about the HTC Vive interaction profile, refer to the [OpenXR Specification](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_htc_vive_controller_profile).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
|`/input/system/click`| select | Boolean |
|`/input/squeeze/click`| grip | Float ( Boolean value cast to float)|
|`/input/squeeze/click`| gripButton | Boolean |
|`/input/menu/click` | menu | Boolean|
|`/input/trigger/value`|trigger| Float |
|`/input/trigger/click`|triggerPressed| Boolean |
|`/input/trackpad`|trackpad| Vector2 |
|`/input/trackpad/click`|trackpadClicked| Boolean |
|`/input/trackpad/touch`|trackpadTouched| Boolean |
|`/input/grip/pose`| devicePose| Pose |
|`/input/aim/pose`|pointer| Pose |
|`/output/haptic` | haptic | Vibrate |
| Unity Layout Only | isTracked | Flag Data |
| Unity Layout Only | trackingState | Flag Data |
| Unity Layout Only | devicePosition | Vector3 |
| Unity Layout Only | deviceRotation | Quaternion |
[!include[](snippets/unity-layout.md)]

View File

@@ -0,0 +1,28 @@
---
uid: openxr-khronos-simple-controller-profile
---
# Khronos Simple Controller Profile
Enables the OpenXR interaction profile for the Khronos Simple Controller and exposes the `<SimpleController>` device layout within the [Unity Input System](https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/).
For more information about the Khronos Simple Controller interaction profile, refer to the [OpenXR Specification](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_khronos_simple_controller_profile).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
|`/input/select/click`| select | Boolean |
|`/input/menu/click` | menu | Boolean |
|`/input/grip/pose` | devicePose | Pose |
|`/input/aim/pose` | pointer | Pose |
|`/output/haptic` | haptic | Vibrate |
| Unity Layout Only | isTracked | Flag Data |
| Unity Layout Only | trackingState | Flag Data |
| Unity Layout Only | devicePosition | Vector3 |
| Unity Layout Only | deviceRotation | Quaternion |
| Unity Layout Only | pointerPosition | Vector3 |
| Unity Layout Only | pointerRotation | Quaternion |
[!include[](snippets/unity-layout.md)]

View File

@@ -0,0 +1,100 @@
---
uid: openxr-meta-quest-support
---
# Meta Quest Support
Understand how to configure the OpenXR plug-in for Meta Quest devices.
The Meta Quest Support feature enables Meta Quest support for the OpenXR plug-in. The **Meta Quest Support** window provides configurable settings specific for Meta Quest devices.
Refer to the following sections to understand how to [Enable Meta Quest Support](#Enable-support), and the [Settings](#settings) you can configure.
## Enable Meta Quest Support {#enable}
To deploy to Meta Quest, enable the Meta Quest Support feature on the Android build target as follows:
1. Open the Project Settings window (menu: **Edit > Project Settings**).
2. Select the **XR Plug-in Management** from the list of settings on the left.
3. If necessary, enable **OpenXR** in the list of **Plug-in Providers**. Unity installs the OpenXR plug-in, if not already installed.
4. Select the OpenXR settings page under XR Plug-in Management.
5. Add the **Oculus Touch Controller Profile** to the **Interaction Profiles** list. (You can have multiple profiles enabled in the list, the OpenXR chooses the one to use based on the current device at runtime.)
6. Enable **Meta Quest Support** under **OpenXR Feature Groups**.
When you enable Meta Quest Support, Unity produces Application Package Kit (APK) files that you can run on the Quest family of devices.
## Open the Meta Quest Support window
The **Meta Quest Support** settings window provides the settings you can configure for OpenXR support on Meta Quest devices.
To open the **Meta Quest Support** window:
1. Open the **OpenXR** section of **XR Plug-in Management** (menu: **Edit** > **Project Settings** > **XR Plug-in Management** > **OpenXR**).
2. Under **OpenXR Feature Groups**, enable **Meta Quest Support**.
3. Click the gear icon next to **Meta Quest Support** to open **Meta Quest Support** settings.
![Meta Quest Support in the OpenXR settings.](../images/meta-quest-support.png)<br/>*Meta Quest Support feature.*
## Settings reference {#settings}
The following sections provide a reference of the settings you can configure in the **Meta Quest Support** window.
### Rendering Settings
Use the following settings to configure rendering in your project.
#### Symmetric Projection (Vulkan)
If enabled, when the application begins it will create a stereo symmetric view that changes the eye buffer resolution based on the Inter-Pupillary Distance (IPD). Provides a performance benefit across all IPD values.
#### Optimize Buffer Discards (Vulkan)
Enable this setting to enable an optimization that allows 4x Multi Sample Anti Aliasing (MSAA) textures to be memoryless on Vulkan.
#### Optimize Multiview Render Regions (Vulkan)
Enable to activate Multiview Render Regions optimizations at application start (Unity 6.1 and newer).
To learn more about this feature, refer to [Multiview Render Regions](xref:openxr-multiview-render-regions).
#### Space Warp motion vector texture format
Choose the format used by the motion vector texture to store its values. The option you choose depends on whether you want to prioritize visual quality and performance.
The options you can choose are:
| Option | Description |
| :---------- | :---------- |
| **RGBA16f** | Use this for more precise values. This can improve the visual quality of Space Warp. |
| **RG16f** | Use this option for reduced memory usage, but slightly less precision. |
To learn more about Space Warp, refer to [URP Application Spacewarp](xref:um-xr-application-spacewarp).
### Manifest Settings
Use the following settings to configure your project manifest.
#### Force Remove Internet Permission
Enable to force the removal of internet permissions added to the [Android App Manifest](xref:um-android-manifest).
#### System Splash Screen
Uses a `PNG` in the `Assets` folder as the system splash screen image. If set, the OS will display the system splash screen as a high quality compositor layer as soon as the app is starting to launch, until the app submits the first frame.
Use the picker (&#8857;) to select an image from the `Assets` folder you want to use as the system splash screen image.
### Target Devices
Select the Quest devices your project targets.
### Experimental
The **Experimental** section contains experimental settings that are under active development.
> [!NOTE]
> Experimental settings might change before theyre verified.
## Additional resources
* [Develop for Meta Quest](xref:um-xr-meta-quest-develop) (Unity manual)
* [Oculus All In on OpenXR: Deprecates Proprietary APIs](https://developer.oculus.com/blog/oculus-all-in-on-openxr-deprecates-proprietary-apis) (Meta developer blog)

View File

@@ -0,0 +1,46 @@
---
uid: openxr-meta-quest-plus-touch-controller-profile
---
# Meta Quest Touch Plus Controller Profile
Enables the OpenXR interaction profile for Meta Quest Touch Plus controllers and exposes the `<QuestTouchPlusController>` device layout within the [Unity Input System](xref:input-system-index).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
|`/input/thumbstick`| thumbstick | Vector2 |
|`/input/squeeze/value`| grip | Float |
|`/input/squeeze/value`| gripPressed | Boolean (float cast to Boolean) |
|`/input/menu/click`| menu (Left Hand Only)| Boolean |
|`/input/system/click`| menu (Right Hand Only)| Boolean |
|`/input/a/click`| primaryButton (Right Hand Only) | Boolean |
|`/input/a/touch`| primaryTouched (Right Hand Only) | Boolean |
|`/input/b/click`| secondaryButton (Right Hand Only) | Boolean |
|`/input/b/touch`| secondaryTouched (Right Hand Only) | Boolean |
|`/input/x/click`| primaryButton (Left Hand Only) | Boolean |
|`/input/x/touch`| primaryTouched (Left Hand Only) | Boolean |
|`/input/y/click`| secondaryButton (Left Hand Only) | Boolean |
|`/input/y/touch`| secondaryTouched (Left Hand Only) | Boolean |
|`/input/trigger/value`| trigger | Float |
|`/input/trigger/value`| triggerPressed | Boolean (float cast to Boolean) |
|`/input/trigger/touch`| triggerTouched| Boolean (float cast to Boolean) |
|`/input/thumbstick/click`| thumbstickClicked | Boolean |
|`/input/thumbstick/touch`| thumbstickTouched | Boolean |
|`/input/thumbrest/touch`| thumbrestTouched | Boolean |
|`/input/grip/pose` | devicePose | Pose |
|`/input/aim/pose` | pointer | Pose |
|`/input/trigger/force` | triggerForce | Float |
|`/input/trigger/curl_meta` | triggerCurl | Float |
|`/input/trigger/slide_meta` | triggerSlide | Float |
|`/input/trigger/proximity_meta` | triggerProximity | Boolean |
|`/input/thumb_meta/proximity_meta` | thumbProximity | Boolean |
|`/output/haptic` | haptic | Vibrate |
| Unity Layout Only | isTracked | Flag Data |
| Unity Layout Only | trackingState | Flag Data |
| Unity Layout Only | devicePosition | Vector3 |
| Unity Layout Only | deviceRotation | Quaternion |
[!include[](snippets/unity-layout.md)]

View File

@@ -0,0 +1,48 @@
---
uid: openxr-meta-quest-pro-touch-controller-profile
---
# Meta Quest Pro Touch Controller Profile
Enables the OpenXR interaction profile for Meta Quest Pro controllers and exposes the `<QuestProTouchController>` device layout within the [Unity Input System](xref:input-system-index).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
|`/input/thumbstick`| thumbstick | Vector2 |
|`/input/squeeze/value`| grip | Float |
|`/input/squeeze/value`| gripPressed | Boolean (float cast to Boolean) |
|`/input/menu/click`| menu (Left Hand Only)| Boolean |
|`/input/system/click`| menu (Right Hand Only)| Boolean |
|`/input/a/click`| primaryButton (Right Hand Only) | Boolean |
|`/input/a/touch`| primaryTouched (Right Hand Only) | Boolean |
|`/input/b/click`| secondaryButton (Right Hand Only) | Boolean |
|`/input/b/touch`| secondaryTouched (Right Hand Only) | Boolean |
|`/input/x/click`| primaryButton (Left Hand Only) | Boolean |
|`/input/x/touch`| primaryTouched (Left Hand Only) | Boolean |
|`/input/y/click`| secondaryButton (Left Hand Only) | Boolean |
|`/input/y/touch`| secondaryTouched (Left Hand Only) | Boolean |
|`/input/trigger/value`| trigger | Float |
|`/input/trigger/value`| triggerPressed | Boolean (float cast to Boolean) |
|`/input/trigger/touch`| triggerTouched| Boolean (float cast to Boolean) |
|`/input/thumbstick/click`| thumbstickClicked | Boolean |
|`/input/thumbstick/touch`| thumbstickTouched | Boolean |
|`/input/thumbrest/touch`| thumbrestTouched | Boolean |
|`/input/grip/pose` | devicePose | Pose |
|`/input/aim/pose` | pointer | Pose |
|`/input/stylus_fb/force` | stylusForce | Float |
|`/input/trigger/curl_fb` | triggerCurl | Float |
|`/input/trigger/slide_fb` | triggerSlide | Float |
|`/input/trigger/proximity_fb` | triggerProximity | Boolean |
|`/input/thumb_fb/proximity_fb` | thumbProximity | Boolean |
|`/output/haptic` | haptic | Vibrate |
|`/output/trigger_haptic_fb` | hapticTrigger | Vibrate |
|`/output/thumb_haptic_fb` | hapticThumb | Vibrate |
| Unity Layout Only | isTracked | Flag Data |
| Unity Layout Only | trackingState | Flag Data |
| Unity Layout Only | devicePosition | Vector3 |
| Unity Layout Only | deviceRotation | Quaternion |
[!include[](snippets/unity-layout.md)]

View File

@@ -0,0 +1,29 @@
---
uid: openxr-microsoft-hand-interaction
---
# Microsoft Hand Interaction
Unity OpenXR provides support for the Hololens 2 Hand interaction profile. This layout inherits from `<XRController>` so bindings that use XR Controller and are available on this device (for example, `<XRController>/devicePosition`) will bind correctly.
This interaction profile does not provide hand mesh or hand rig data. These will be added in the future.
For more information about the Microsoft Hand Interaction extension, refer to the [OpenXR Specification](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_MSFT_hand_interaction).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
|`/input/select/click`| select | Boolean |
|`/input/squeeze/value` | squeeze | Float |
|`/input/grip/pose` | devicePose | Pose |
|`/input/aim/pose` | pointer | Pose |
| Unity Layout Only | isTracked | Flag Data |
| Unity Layout Only | trackingState | Flag Data |
| Unity Layout Only | devicePosition | Vector3 |
| Unity Layout Only | deviceRotation | Quaternion |
| Unity Layout Only | pointerPosition | Vector3 |
| Unity Layout Only | pointerRotation | Quaternion |
[!include[](snippets/unity-layout.md)]

View File

@@ -0,0 +1,36 @@
---
uid: openxr-microsoft-mixed-reality-motion-controller-profile
---
# Microsoft Mixed Reality Motion Controller Profile
Enables the OpenXR interaction profile for the Microsoft Mixed Reality Motion controller and exposes the `<WMRSpatialController>` device layout within the [Unity Input System](xref:input-system-index).
For more information about the Microsoft Mixed Reality Motion Controller interaction profile, refer to the [OpenXR Specification](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_microsoft_mixed_reality_motion_controller_profile).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
|`/input/thumbstick`| joystick | Vector2 |
|`/input/trackpad`| touchpad | Vector2 |
|`/input/squeeze/click`| grip | Float (Boolean cast to float) |
|`/input/squeeze/click`| gripPressed | Boolean |
|`/input/menu/click`| menu | Boolean |
|`/input/trigger/value`| trigger | Float |
|`/input/trigger/value`| triggerPressed | Boolean (float cast to Boolean) |
|`/input/thumbstick/click`| joystickClicked | Boolean |
|`/input/trackpad/click`| touchpadClicked | Boolean |
|`/input/trackpad/touch`| touchpadTouched | Boolean |
|`/input/grip/pose` | devicePose | Pose |
|`/input/aim/pose` | pointer | Pose |
|`/output/haptic` | haptic | Vibrate |
| Unity Layout Only | isTracked | Flag Data |
| Unity Layout Only | trackingState | Flag Data |
| Unity Layout Only | devicePosition | Vector3 |
| Unity Layout Only | deviceRotation | Quaternion |
| Unity Layout Only | pointerPosition | Vector3 |
| Unity Layout Only | pointerRotation | Quaternion |
[!include[](snippets/unity-layout.md)]

View File

@@ -0,0 +1,25 @@
---
uid: openxr-multiview-render-regions
---
# Multiview Render Regions
The Multiview Render Regions feature is an optimization technique that prevents processing on areas of the screen that are not visible to the user.
For a detailed explanation of Multiview Render Regions, refer to [Multiview Render Regions](https://docs.unity3d.com/6000.1/Documentation/Manual/xr-multiview-render-regions.html) in the Unity Manual.
## Prerequisites
To enable this feature, you will need the following:
* Unity 6.1 or newer.
* Ensure that the Vulkan API is enabled. This feature is not available on other graphics APIs at this point in time.
## Enable Multiview Render Regions
To enable the Multiview Render Regions feature:
1. Open the **OpenXR** section of **XR Plug-in Management** (menu: **Edit** > **Project Settings** > **XR Plug-in Management** > **OpenXR**).
2. Under **All Features**, enable **Meta Quest Support**.
3. Use the **Gear** icon to open **Meta Quest Support** settings.
4. Under **Rendering Settings**, enable **Optimize Multiview Render Regions**.
![The Optimize Multiview Render Regions feature is enabled in the OpenXR Rendering Settings.](../images/multiview-render-regions.png)<br/>*Enable the Optimize Multiview Render Regions feature in Rendering Settings.*

View File

@@ -0,0 +1,42 @@
---
uid: openxr-oculus-touch-controller-profile
---
# Oculus Touch Controller Profile
Enables the OpenXR interaction profile for Oculus Touch controllers and exposes the `<OculusTouchController>` device layout within the [Unity Input System](https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/).
For more information about the Oculus Touch interaction profile, refer to the [OpenXR Specification](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_oculus_touch_controller_profile).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
|`/input/thumbstick`| thumbstick | Vector2 |
|`/input/squeeze/value`| grip | Float |
|`/input/squeeze/value`| gripPressed | Boolean (float cast to Boolean) |
|`/input/menu/click`| menu (Left Hand Only)| Boolean |
|`/input/system/click`| menu (Right Hand Only)| Boolean |
|`/input/a/click`| primaryButton (Right Hand Only) | Boolean |
|`/input/a/touch`| primaryTouched (Right Hand Only) | Boolean |
|`/input/b/click`| secondaryButton (Right Hand Only) | Boolean |
|`/input/b/touch`| secondaryTouched (Right Hand Only) | Boolean |
|`/input/x/click`| primaryButton (Left Hand Only) | Boolean |
|`/input/x/touch`| primaryTouched (Left Hand Only) | Boolean |
|`/input/y/click`| secondaryButton (Left Hand Only) | Boolean |
|`/input/y/touch`| secondaryTouched (Left Hand Only) | Boolean |
|`/input/trigger/value`| trigger | Float |
|`/input/trigger/value`| triggerPressed | Boolean (float cast to Boolean) |
|`/input/trigger/touch`| triggerTouched| Boolean (float cast to Boolean) |
|`/input/thumbstick/click`| thumbstickClicked | Boolean |
|`/input/thumbstick/touch`| thumbstickTouched | Boolean |
|`/input/grip/pose` | devicePose | Pose |
|`/input/aim/pose` | pointer | Pose |
|`/output/haptic` | haptic | Vibrate |
| Unity Layout Only | isTracked | Flag Data |
| Unity Layout Only | trackingState | Flag Data |
| Unity Layout Only | devicePosition | Vector3 |
| Unity Layout Only | deviceRotation | Quaternion |
[!include[](snippets/unity-layout.md)]

View File

@@ -0,0 +1,18 @@
---
uid: openxr-palm-pose-interaction
---
# Palm Pose Interaction
Unity OpenXR provides support for the Palm Pose extension specified by Khronos. Use this layout to retrieve the pose data that the extension returns. This extension also adds a new input component path using this "palm_ext" pose identifier to existing interaction profiles when active.
Enables the OpenXR interaction feature for Palm Pose Interaction and exposes the `<PalmPose>` layout within the [Unity Input System](https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/).
For more information about the Palm Pose extension, refer to the [OpenXR Specification](https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_palm_pose).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
| `/input/palm_ext/pose` | palmPose | Pose |

View File

@@ -0,0 +1,182 @@
---
uid: openxr-performance-settings
---
# XR performance settings
The OpenXR performance settings feature lets you provide performance hints to an OpenXR runtime and allows you to get notification when an important aspect of device performance changes.
XR devices must balance power and thermal state against performance to achieve an optimal user experience. You can provide performance hints to an OpenXR runtime to help it make the best tradeoffs for the task your application is running. For example, if your application is displaying a scene consisting of a loading graphic or simple menu without significant rendering requirements, you could tell the runtime to operate at a lower power level to save energy and thermal capacity for a later, more complex scene. Likewise, if you have a sequence that is very demanding, you could tell the runtime to operate at max capacity for a short time. You can provide hints separately for the CPU and the GPU. Refer to [Performance level hints](#performance-settings-level-hints) for more information.
You can subscribe to notifications that report changes in important aspects of device performance. These aspects include compositing, rendering, and thermal capacity. The performance notifications inform you when one of these performance categories changes between the normal, warning, and impaired states. The OpenXR runtime reports performance changes separately for the CPU and GPU. Your application can respond to these notifications by reducing the application workload. Refer to [Performance notifications](#performance-settings-notifications) for more information.
Refer to [Enable the performance settings OpenXR feature](#enable-performance-feature) for instructions about enabling the feature in your project.
> [!NOTE]
> The target XR platform must support the OpenXR "XR\_EXT\_performance\_settings" extension. Otherwise, the XR Performance Settings won't be activated at runtime. Be sure to confirm that your target platform supports the extension.
For more information about the OpenXR Performance Settings extension, refer to the [OpenXR Specification](https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_performance_settings).
<a name="enable-performance-feature"></a>
## Enable the performance settings OpenXR feature
To use the performance settings API, you must enable it in the **OpenXR Project Settings**:
1. Open the **Project Settings** window (menu: **Edit > Project Settings**).
2. Expand the **XR Plug-in Management** section, if necessary.
3. Select the **OpenXR** area under **XR Plug-in Management**.
4. Choose the **Platform Build Target** from the tabs along the top of the **OpenXR** settings page.
5. Check the box next to **XR Performance Settings** (in the **All Features** group) to enable the feature.
6. Repeat for other platforms, if desired.
![](../images/performance-settings-feature.png)
<a name="performance-settings-level-hints"></a>
## Performance level hints
The performance level hints help an OpenXR runtime balance the tradeoffs it must make between energy usage, thermal state, and your application's performance needs. You can provide separate hints for the CPU and GPU hardware domains.
You can set the following levels as hints about your application's current performance needs:
- **Power Savings**: At this level, the OpenXR runtime prioritizes energy conservation over consistent frame rendering and latency.
- **Sustained Low**: At this level, the OpenXR runtime tries to balance resource usage and high performance, prioritizing the former. Energy savings are prioritized over low latency, but the runtime tries to maintain a relatively stable frame rendering and XR compositing flow, as long as it's thermally sustainable.
- **Sustained High**: This level is the default hint, if none is set by your application. At this level, the OpenXR runtime prioritizes consistent rendering, XR compositing and latency in a thermal range that is sustainable.
- **Boost**: At this level, the OpenXR runtime allows maximum resource usage without trying to keep the device operating in a thermally sustainable range. If the device hardware exceeds its thermal limits, the runtime must throttle performance, so you should limit use of this performance level to short durations (less that 30 seconds).
> [!NOTE]
> When setting the Performance Level Hint to **Sustained Low** or **Sustained High** levels, your application can still experience performance throttling. For example, a device might exceed thermal limits due to external circumstances, such as operating in a high-temperature environment or for an extended amount of time. You can use [Performance Notifications](#performance-settings-notifications) to detect such impending performance issues and lower application workload before the runtime must impose throttling.
Use the static method, [XrPerformanceSettingsFeature.SetPerformanceLevelHint](xref:UnityEngine.XR.OpenXR.Features.Extensions.PerformanceSettings.XrPerformanceSettingsFeature.SetPerformanceLevelHint*) to set a given performance level hint for a specific CPU or GPU performance domain.
By choosing the lowest level that gives your application good performance, you can extend the device's battery life and avoid overheating. For example, you could set the **Power Savings** hint during loading screens. For normal operation, you could set **Sustained Low** for less demanding sequences, and **Sustained High** for more complex scenes. When appropriate, you could set the **Boost** hint to achieve maximum performance for a brief time.
Here are some examples of how you might use performance level hints in different scenarios:
- The application shows static pictures without any interactive elements:
```c#
XrPerformanceSettingsFeature.SetPerformanceLevelHint(PerformanceDomain.CPU, PerformanceLevelHint.PowerSavings);
XrPerformanceSettingsFeature.SetPerformanceLevelHint(PerformanceDomain.GPU, PerformanceLevelHint.PowerSavings);
// Show a picture sequence and continue with app loading
```
- The application is in a normal state, with simple interactivity and low complexity scenes:
```c#
XrPerformanceSettingsFeature.SetPerformanceLevelHint(PerformanceDomain.CPU, PerformanceLevelHint.SustainedLow);
XrPerformanceSettingsFeature.SetPerformanceLevelHint(PerformanceDomain.GPU, PerformanceLevelHint.SustainedLow);
// Run regular app process
```
- The application needs to render a complex scene with multiple, interactive composition layers:
```c#
XrPerformanceSettingsFeature.SetPerformanceLevelHint(PerformanceDomain.GPU, PerformanceLevelHint.SustainedHigh);
// Load and process action scene
```
- The application needs to process a large amount of data on device:
```c#
XrPerformanceSettingsFeature.SetPerformanceLevelHint(PerformanceDomain.CPU, PerformanceLevelHint.Boost);
// Run complex logic
```
<a name="performance-settings-notifications"></a>
## Performance notifications
The OpenXR runtime can inform your application about performance changes, so you can react and adjust the current workload, if desired.
Performance is categorized as one of the following performance states:
- **Normal**: No performance degradation is expected and the app can run as usual.
- **Warning**: The OpenXR runtime is expecting performance degradation if device conditions do not improve.
- **Impaired**: The device is suffering performance degradation.
An OpenXR runtime monitors performance of the device CPU and GPU across a set of key performance areas, called subdomains. These subdomains include:
* [Compositing](#compositing-subdomain): A runtime task that takes all rendered layers and combines them for display.
* [Rendering](#rendering-subdomain): Your application's timely submission of frames to the compositor.
* [Thermal](#thermal-subdomain): The hardware device's temperature compared to its thermal limits.
If the performance state of a subdomain changes, the [XrPerformanceSettingsFeature](xref:UnityEngine.XR.OpenXR.Features.Extensions.PerformanceSettings.XrPerformanceSettingsFeature.OnXrPerformanceChangeNotification) object dispatches an event that describes the change. Refer to [Subscribe to performance notifications](#subscribe) for information about handling this event.
When the performance state of a domain and subdomain changes for the worse, you should take mitigation measures that reduce application workload in that area. If you do not, the OpenXR runtime might impose its own, more drastic, measures.
After a sufficient period (determined by the runtime) of improved performance, a performance state can change from impaired to warning, and from warning to normal. Leaving the impaired state means that the runtime has stopped its own mitigation measures.
> [!TIP]
> Performance impairment may not be caused directly by your application, but by situational causes, such as high room temperature or a large amount of background tasks running on the device. Even so, the better you can tune your app to avoid performance degradation, the better the user experience will be across variable operating conditions.
<a name="compositing-subdomain"></a>
### Compositing subdomain
Compositing is a task performed by the OpenXR runtime to combine submitted frames for final display. The runtime must share CPU and GPU resources with your application while performing this task. If the runtime can't complete compositing in time, visual artifacts can occur. When in the impaired state, the OpenXR runtime might take actions that interfere with your application, such as limiting frame rate, ignoring submitted layers, or even shutting down the application.
* In the **Normal** state, the compositor can consistently finish with sufficient margin.
* In the **Warning** state, the compositor is finishing its task in time, but the margin is considered insufficient.
* In the **Impaired** state, the compositor cannot finish its task in time.
<a name="rendering-subdomain"></a>
### Rendering subdomain
Your application's rendering pipeline must submit rendered layers to the compositor for display. If frames aren't submitted in time for the compositor to use them, dropped frames and other artifacts can occur. In the impaired state, the OpenXR runtime might take actions that interfere with your application, such as telling the user that the application is unresponsive or displaying a tracking environment to maintain user orientation.
* In the **Normal** state, your application is consistently submitting rendered frames to the compositor in time to be used.
* In the **Warning** state, at least one layer is regularly submitted past the compositor deadline.
* In the **Impaired** state, late submission of frames has reached a critical threshold.
<a name="thermal-subdomain"></a>
### Thermal subdomain
XR devices must stay within a safe operating temperature. When a device reaches its thermal limits, the OpenXR runtime must take drastic measures to lower heat generation. These mitigations can severely impact the user experience.
* In the **Normal** state, the device is operating within a sustainable thermal range.
* In the **Warning** state, the OpenXR runtime anticipates that the device will soon overheat under the current load.
* In the **Impaired** state, the OpenXR is taking measures such as throttling performance, to reduce the device temperature.
<a name="subscribe"></a>
### Subscribe to performance notifications
Subscribe to the [XrPerformanceSettingsFeature.OnXrPerformanceChangeNotification](xref:UnityEngine.XR.OpenXR.Features.Extensions.PerformanceSettings.XrPerformanceSettingsFeature.OnXrPerformanceChangeNotification) event to receive an event when the performance state of a domain and subdomain changes.
A notification event provides the following data (as a [PerformanceChangeNotification](xref:UnityEngine.XR.OpenXR.Features.Extensions.PerformanceSettings.PerformanceChangeNotification) struct):
* Old performance state (normal, warning, or impaired)
* New performance state (normal, warning, or impaired)
* Affected domain (CPU or GPU)
* Affected subdomain (compositing, rendering, or thermal)
The following code snippet illustrates how you can subscribe to the performance notification event and handle performance changes (by calling your own application-defined functions that modify performance):
```c#
// Subscribe to the performance notification event at runtime
XrPerformanceSettingsFeature.OnXrPerformanceChangeNotification += OnPerformanceChangeNotification;
// Process the notification when it happens
void OnPerformanceChangeNotification(PerformanceChangeNotification notification)
{
switch (notification.toLevel)
{
case PerformanceNotificationLevel.Normal:
// Let the application run as normal execution
RestorePerformance(notification.domain, notification.subDomain);
break;
case PerformanceNotificationLevel.Warning:
// Reduce workload of low priority tasks
LimitPerformance(notification.domain, notification.subDomain);
break;
case PerformanceNotificationLevel.Impaired:
// Execute app with the minimum required processes for the given domain and subdomain
ReducePerformance(notification.domain, notification.subDomain);
break;
}
}
```

View File

@@ -0,0 +1,2 @@
> [!NOTE]
> Some Unity controls don't correspond to an OpenXR path. Unity expresses [Pose](https://docs.unity3d.com/Documentation/ScriptReference/Pose.html) data as individual elements, whereas OpenXR expresses poses as a group of data. These additional controls contain `Unity Layout Only` in the **OpenXR Path** column. You can use this additional Pose data for more fine-grained controls. To learn more, refer to [Pose data](xref:openxr-input#pose-data).

View File

@@ -0,0 +1,44 @@
---
uid: openxr-valve-index-controller-profile
---
# Valve Index Controller Profile
Enables the OpenXR interaction profile for the Valve Index controller and exposes the `<ValveIndexController>` device layout within the [Unity Input System](https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/).
For more information about the Valve Index interaction profile, refer to the [OpenXR Specification](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_htc_vive_controller_profile).
## Available controls
The following table outlines the mapping between the OpenXR paths and Unity's implementation:
| OpenXR Path | Unity Control Name | Type |
|----|----|----|
|`/input/system/click`| system | Boolean |
|`/input/system/touch`| systemTouched | Boolean |
|`/input/a/click`| primaryButton | Boolean |
|`/input/a/touch`| primaryTouched | Boolean |
|`/input/b/click`| secondaryButton | Boolean |
|`/input/b/touch`| secondaryTouched | Boolean |
|`/input/squeeze/value`| grip | Float |
|`/input/squeeze/value`| gripPressed | Boolean (cast from float) |
|`/input/squeeze/force`| gripForce | Float |
|`/input/trigger/click`| triggerPressed | Boolean |
|`/input/trigger/value`| trigger | Float |
|`/input/trigger/touch`| triggerTouched | Boolean |
|`/input/thumbstick`| thumbstick | Vector2 |
|`/input/thumbstick/click`| thumbstickClicked | Boolean |
|`/input/thumbstick/touch`| thumbstickTouched | Boolean |
|`/input/trackpad`| trackpad | Vector2 |
|`/input/trackpad/touch`| trackpadTouched | Boolean |
|`/input/trackpad/force`| trackpadForce | Float |
|`/input/grip/pose` | devicePose | Pose |
|`/input/aim/pose` | pointer | Pose |
|`/output/haptic` | haptic | Vibrate |
| Unity Layout Only | isTracked | Flag Data |
| Unity Layout Only | trackingState | Flag Data |
| Unity Layout Only | devicePosition | Vector3 |
| Unity Layout Only | deviceRotation | Quaternion |
| Unity Layout Only | pointerPosition | Vector3 |
| Unity Layout Only | pointerRotation | Quaternion |
[!include[](snippets/unity-layout.md)]