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

Setting Passthrough Configuration (Beta)

This extension enables an application to configure the passthrough image with different appearances according to the demands of the application. The passthrough configurations that the runtime provides to applications include:
1. Adjusting the image rate of the passthrough.
2. Modifying the image quality of the passthrough.

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 V 2.5.0 and above
XR Elite V 2.5.0 and above
Focus Vision V 2.5.0 and above

Environment Settings

Enable Feature

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


Golden Sample

The following are examples of configuring passthrough settings using HTC's APIs.

  1. EnumeratePassthroughImageRatesHTC : This API enumerates available passthrough image rates.

    static UInt32 count = 0;
    static XrPassthroughConfigurationImageRateHTC[] arrays = new XrPassthroughConfigurationImageRateHTC[2];
    
    void Start()
    {
            XrResult result = XR_HTC_passthrough_configuration.EnumeratePassthroughImageRatesHTC(imageRateCapacityInput: 0, imageRateCountOutput: ref count, imageRates: arrays);
            if (result == XrResult.XR_SUCCESS)
            {
                    Array.Resize(ref arrays, (int)count);
                    List<String> Options = new List<String>();
                    result = XR_HTC_passthrough_configuration.EnumeratePassthroughImageRatesHTC(imageRateCapacityInput: count, imageRateCountOutput: ref count, imageRates: arrays);
    
                    if (result == XrResult.XR_SUCCESS)
                    {
                            for (int i = 0; i < count; i++)
                            {
                                    Debug.Log("Passthrough_manager EnumeratePassthroughImageRatesHTC index " + i + " srcImageRate = " + arrays[i].srcImageRate);
                                    Debug.Log("Passthrough_manager EnumeratePassthroughImageRatesHTC index " + i + " dstImageRate = " + arrays[i].dstImageRate);
                            }
                    }
            }
            else
            {
                    Debug.Log("Passthrough_manager EnumeratePassthroughImageRatesHTC result = " + result);
            }
    }
    
  2. GetPassthroughConfigurationHTC : This API retrieves the passthrough configuration for image rate or image quality.

    Case 1: Get Image Rate Configuration

    XrPassthroughConfigurationImageRateHTC config_rate = new XrPassthroughConfigurationImageRateHTC();
    config_rate.type = XrStructureType.XR_TYPE_PASSTHROUGH_CONFIGURATION_IMAGE_RATE_HTC;
    config_rate.next = IntPtr.Zero;
    
    int size = Marshal.SizeOf(typeof(XrPassthroughConfigurationImageRateHTC));
    IntPtr ptr = Marshal.AllocHGlobal(size);
    
    Marshal.StructureToPtr(config_rate, ptr, false);
    if (XR_HTC_passthrough_configuration.GetPassthroughConfigurationHTC(ptr) == XrResult.XR_SUCCESS)
    {
            config_rate = (XrPassthroughConfigurationImageRateHTC)Marshal.PtrToStructure(ptr, typeof(XrPassthroughConfigurationImageRateHTC));
            Debug.Log("Passthrough_manager get srcImageRate = " + config_rate.srcImageRate);
            Debug.Log("Passthrough_manager get dstImageRate = " + config_rate.dstImageRate);
    }
    Marshal.FreeHGlobal(ptr);
    

    Case 2: Get Image Quality Configuration

    XrPassthroughConfigurationImageQualityHTC config_quality = new XrPassthroughConfigurationImageQualityHTC();
    config_quality.type = XrStructureType.XR_TYPE_PASSTHROUGH_CONFIGURATION_IMAGE_QUALITY_HTC;
    config_quality.next = IntPtr.Zero;
    
    int size2 = Marshal.SizeOf(typeof(XrPassthroughConfigurationImageQualityHTC));
    IntPtr ptr2 = Marshal.AllocHGlobal(size2);
    
    Marshal.StructureToPtr(config_quality, ptr2, false);
    if (XR_HTC_passthrough_configuration.GetPassthroughConfigurationHTC(ptr2) == XrResult.XR_SUCCESS)
    {
            config_quality = (XrPassthroughConfigurationImageQualityHTC)Marshal.PtrToStructure(ptr2, typeof(XrPassthroughConfigurationImageQualityHTC));
            Debug.Log("Passthrough_manager get scale = " + config_quality.scale);
    }
    Marshal.FreeHGlobal(ptr2);
    
  3. SetPassthroughConfigurationHTC : This API sets the passthrough configuration for image rate or image quality.

    Case 1: Set Image Rate Configuration

    static private void OnImageRateChanged(float fromSrcImageRate, float fromDestImageRate, float toSrcImageRate, float toDestImageRate)
    {
            Debug.Log("Passthrough_manager fromSrcImageRate = " + fromSrcImageRate);
            Debug.Log("Passthrough_manager fromDestImageRate = " + fromDestImageRate);
            Debug.Log("Passthrough_manager toSrcImageRate = " + toSrcImageRate);
            Debug.Log("Passthrough_manager toDestImageRate = " + toDestImageRate);
    }
    
    VivePassthroughImageRateChanged.Listen(OnImageRateChanged);
    XrPassthroughConfigurationImageRateHTC config = new XrPassthroughConfigurationImageRateHTC();
    config.type = XrStructureType.XR_TYPE_PASSTHROUGH_CONFIGURATION_IMAGE_RATE_HTC;
    config.next = IntPtr.Zero;
    config.srcImageRate = 90.0f;
    config.dstImageRate = 90.0f;
    
    int size = Marshal.SizeOf(typeof(XrPassthroughConfigurationImageRateHTC));
    IntPtr ptr = Marshal.AllocHGlobal(size);
    
    Marshal.StructureToPtr(config, ptr, false);
    if (XR_HTC_passthrough_configuration.SetPassthroughConfigurationHTC(ptr) == XrResult.XR_SUCCESS)
    {
            // Successfully set configuration
    }
    Marshal.FreeHGlobal(ptr);
    

    Case 2: Set Image Quality Configuration

    static private void OnImageQualityChanged(float fromQuality, float toQuality)
    {
            Debug.Log("Passthrough_manager from scale = " + fromQuality);
            Debug.Log("Passthrough_manager to scale = " + toQuality);
    }
    
    VivePassthroughImageQualityChanged.Listen(OnImageQualityChanged);
    XrPassthroughConfigurationImageQualityHTC config = new XrPassthroughConfigurationImageQualityHTC();
    config.type = XrStructureType.XR_TYPE_PASSTHROUGH_CONFIGURATION_IMAGE_QUALITY_HTC;
    config.next = IntPtr.Zero;
    config.scale = 0.75f;
    
    int size = Marshal.SizeOf(typeof(XrPassthroughConfigurationImageQualityHTC));
    IntPtr ptr = Marshal.AllocHGlobal(size);
    
    Marshal.StructureToPtr(config, ptr, false);
    if (XR_HTC_passthrough_configuration.SetPassthroughConfigurationHTC(ptr) == XrResult.XR_SUCCESS)
    {
            Debug.Log("Passthrough_manager set scale = " + config.scale);
    }
    Marshal.FreeHGlobal(ptr);