Please Select Your Location
Australia
Österreich
België
Canada
Canada - Français
中国
Česká republika
Denmark
Deutschland
France
HongKong
Iceland
Ireland
Italia
日本
Korea
Latvija
Lietuva
Lëtzebuerg
Malta
المملكة العربية السعودية (Arabic)
Nederland
New Zealand
Norge
Polska
Portugal
Russia
Saudi Arabia
Southeast Asia
España
Suisse
Suomi
Sverige
台灣
Ukraine
United Kingdom
United States
Please Select Your Location
België
Česká republika
Denmark
Iceland
Ireland
Italia
Latvija
Lietuva
Lëtzebuerg
Malta
Nederland
Norge
Polska
Portugal
España
Suisse
Suomi
Sverige

Using Foveation in Your App

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.0.0 and above

Specification

This chapter will explore how to create more immersive experiences using the Foveation feature within the Foveation extension.
Note: Only OpenGLES3 is supported when using foveated rendering.

Environment Settings

Check your VIVE OpenXR Plugin version

In Window > Package Manager, make sure your VIVE OpenXR Plugin 2.0.0 or newer.

Enable the Foveation feature

In Edit > Project Settings > XR Plug-in Management > OpenXR, enable the VIVE XR Foveation feature.


Golden Sample

This article shows how to enable, disable, and customize the foveation in your app.

Create a script and attach it onto any GameObject in the scene.

In the script, first add a using namespace.

using VIVE.OpenXR.ViveFoveation;

Declare a XrFoveationModeHTC named UsingMode.

[SerializeField] XrFoveationModeHTC UsingMode;

The type of foveation creates in your app will depend on UsingMode. There are three type modes, Fixed, Dynamic, and Custom. The Fixed mode means the clear field of view will always be in the center of both eyes. On the contrary, when using the Dynamic mode, the clear field of view will follow the player's eyes, if eye gaze is enable. Finally, the Custom mode let you set the foveation yourself, including the position of clear field of view, the clarity, and the size of clear field of view.

Then, declare an array of XrFoveationConfigurationHTC with size of two.

XrFoveationConfigurationHTC[] Configs = new XrFoveationConfigurationHTC[2];

Configs is used to store the setting of the foveation when using Custom mode.

In Start, set the configuration and use ApplyFoveationHTC() to enable the foveation.

void Start()
{
    /////////////////////Setting for left eye/////////////////////////////
    Configs[0].level = XrFoveationLevelHTC.XR_FOVEATION_LEVEL_HIGH_HTC; //
    Configs[0].clearFovDegree = 0;                                      //
    Configs[0].focalCenterOffset.x = 0.0f;                              // 
    Configs[0].focalCenterOffset.y = 0.0f;                              //
    //////////////////////////////////////////////////////////////////////

    ////////////////////Setting for right eye/////////////////////////////
    Configs[1].level = XrFoveationLevelHTC.XR_FOVEATION_LEVEL_HIGH_HTC; //
    Configs[1].clearFovDegree = 0;                                      //
    Configs[1].focalCenterOffset.x = 0.0f;                              //
    Configs[1].focalCenterOffset.y = 0.0f;                              //
    //////////////////////////////////////////////////////////////////////

    switch (UsingMode)
    {
        //XR_FOVEATION_MODE_FIXED_HTC: The position of foveation is fixed
        case XrFoveationModeHTC.XR_FOVEATION_MODE_FIXED_HTC:
            ViveFoveation.ApplyFoveationHTC(XrFoveationModeHTC.XR_FOVEATION_MODE_FIXED_HTC, 0, null);
            break;
        //XR_FOVEATION_MODE_DYNAMIC_HTC: the position of foveation can be adjust
        case XrFoveationModeHTC.XR_FOVEATION_MODE_DYNAMIC_HTC:
            ViveFoveation.ApplyFoveationHTC(XrFoveationModeHTC.XR_FOVEATION_MODE_DYNAMIC_HTC, 0, null);
            break;
        //XR_FOVEATION_MODE_CUSTOM_HTC: the foveation will use the custom setting
        case XrFoveationModeHTC.XR_FOVEATION_MODE_CUSTOM_HTC:
            ViveFoveation.ApplyFoveationHTC(UsingMode, 2, Configs);
            break;
    }
}

now if you run the app, you will be able to see the foveation.

  • Display with foveation


  • Display without foveation


If you want to disable the foveation, execute the following code.

ViveFoveation.ApplyFoveationHTC(XrFoveationModeHTC.XR_FOVEATION_MODE_DISABLE_HTC, 0, null);

See Also

Foveation extension.