Using RefreshRate in Your App
On platforms which support dynamically adjusting the display refresh rate, application developers may request a specific display refresh rate in order to improve the overall user experience, examples include:
1. A video application may choose a display refresh rate which better matches the video content playback rate in order to achieve smoother video frames.
2. An application which can support a higher frame rate may choose to render at the higher rate to improve the overall perceptual quality, for example, lower latency and less flicker.
Supported Platforms and Devices
Platform | Headset | Supported | Plugin Version | |
PC | PC Streaming | Focus 3/XR Elite/Focus Vision | X | |
Pure PC | Vive Cosmos | X | ||
Vive Pro series | X | |||
AIO | Focus 3/XR Elite/Focus Vision | V | 2.2.0 and above |
Specification
This chapter will explore how to create more immersive experiences using the Display Refresh Rate feature within the Display Refresh Rate extension.
Environment Settings
1. Check your VIVE OpenXR Plugin version
In Window > Package Manager, make sure your VIVE OpenXR Plugin 2.0.0 or newer.
2. Enable the RefreshRate feature
In Edit > Project Settings > XR Plug-in Management > OpenXR, enable the XR FB Display Refresh Rate feature.
Golden Sample
-
An application to identify what display refresh rate the session supports and the current display refresh rate.
-
An application to request a display refresh rate to indicate its preference to the runtime.
Create a script and attach it onto any GameObject in the scene.
In the script, first add a using namespace.
using VIVE.OpenXR;
-
To Get current Refresh Rate:
float value; if (XR_FB_display_refresh_rate.GetDisplayRefreshRate(out value) == XrResult.XR_SUCCESS) { Debug.Log("GetDisplayRefreshRate = " + value); }
-
To Request a specific Refresh Rate:
XR_FB_display_refresh_rate.RequestDisplayRefreshRate(90.0f);
-
Check the capacity of the display Refresh Rates of the Device:
UInt32 count; float[] values = new float[2]; XrResult result = XR_FB_display_refresh_rate.EnumerateDisplayRefreshRates(displayRefreshRateCapacityInput : 0, displayRefreshRateCountOutput:out count, displayRefreshRates: out values[0]); if (result == XrResult.XR_SUCCESS) { Debug.Log("EnumerateDisplayRefreshRates = " + count); Array.Resize(ref values, (int)count); result = XR_FB_display_refresh_rate.EnumerateDisplayRefreshRates(displayRefreshRateCapacityInput: count, displayRefreshRateCountOutput: out count, displayRefreshRates: out values[0]); if (result == XrResult.XR_SUCCESS) { for (int i = 0; i < count; i++) { Debug.Log("EnumerateDisplayRefreshRates index " + i + " RefreshRates = " + values[i]); } } }
See Also
Display Refresh Rate extension.