# 4. Reference

# 4.1 Foveation Rendering

  • Set Foveation Level
 /// <summary>
        /// Set the Foveation Level
        /// </summary>
        /// <param name="level">Foveation levels -1 (close),level 0 (low), level 1 (Med), and level 2 (high)</param>
        public static void SetFoveationLevel(int level)
        {
            NativeMethods.SetFoveationLevel(level);
        }
  • Set Foveation Parameters
 /// Set Foveation Parameters
        /// </summary>
        /// <param name="foveationGainX">The reducing rate of the pixel density on the X-axis. The value larger, the reducing rate is faster.</param>
        /// <param name="foveationGainY">The reducing rate of the pixel density on the Y-axis</param>
        /// <param name="foveationArea">The area of pixel density is not reduced. The value larger, the area is bigger.</param>
        /// <param name="foveationMinimum">The minimum pixel Density</param>
        public static void SetFoveationParameters(float foveationGainX, float foveationGainY, float foveationArea, float foveationMinimum)
        {
            NativeMethods.SetFoveationParameters(foveationGainX, foveationGainY, foveationArea, foveationMinimum);
        }

# 4.2 Boundary APIs

# 4.2.1 UnityXR

UnityXR provides the following APIs:

  • Gets the list of 3D position values that represents the SDK-set boundary.
UnityEngine.XR.InputDevices.GetDeviceAtXRNode(UnityEngine.XR.XRNode.Head).subsystem.TryGetBoundaryPoints(List<Vector3> boundaryPoints)
  • An event that takes the delegate instance that the XRInputSubsystem calls when it changes its tracking boundary.
UnityEngine.XR.InputDevices.GetDeviceAtXRNode(UnityEngine.XR.XRNode.Head).subsystem.boundaryChanged

# 4.2.2 Qiyu

QiyuBoundary class provide more boundary APIs for developers to use.

  • Get whether the boundary is a custom type
public static bool GetConfigured()
  • Return testing results of nodes relative to the boundary
public static BoundaryTestResult TestNode(Node node)
  • Return testing results of arbitrary points relative to the boundary
public static QiyuBoundary.BoundaryTestResult TestPoint(Vector3 point)
  • Gets an array of 3D position values of boundary
public static Vector3[] GetGeometry()
  • Get the dimensions of boundary
public static Vector3 GetDimensions()
  • Get whether the boundary is visible or not
public static bool GetVisible()
  • Set weather the boundary is always visible (Note: User configuration of boundary in system settings will overwrite this interface’s action)
public static void SetVisible(bool value)

# 4.3 Device

SDK provides device information APIs, using the device manufacturer, name, serial number and so on. Developers can use UnityXR standard APIs or QIYU APIs GetDeviceInfo().

Device QIYU 3 QIYU Dream QIYU Dream Pro QIYU MIX
Manufacturer Dreamagic Dreamagic Dreamagic Dreamagic
Headset QiyuHMD-3 QiyuHMD-Dream QiyuHMD-DreamPro QiyuHMD-MIX
Left Controller Qiyu Controller-Left-3 Qiyu Controller-Left-Dream Qiyu Controller-Left-Dream Qiyu Controller-Left-MIX
Right Controller Qiyu Controller-Right-3 Qiyu Controller-Right-Dream Qiyu Controller-Right-Dream Qiyu Controller-Right-MIX
  • XR.InputDevice(https://docs.unity.cn/cn/2020.3/ScriptReference/XR.InputDevice.html (opens new window)

  • Unity.XR.Qiyu.QiyuXRCore.GetDeviceInfo()

    Return:

    public struct QiyuDeviceInfo
            {
                public string Name_HMD;//Headset name
                public string Name_CtrL;//Left Controller
                public string Name_CtrR;//Right Controller
                public string Manufacturer;//Manufacturer
                public string SN_HMD;//Headset SN
                public string SN_CtrL;//Left Controller serialNumber(current is null)
                public string SN_CtrR;//Right Controller serialNumber(current is null)
            };
    

Note:Please refer to the ButtonTest scene in Sample.

# 4.4 QIYU 3Dof Mode

 /// <summary>
        /// Set 3Dof mode, 1 is 3dof, 0 is 6dof
        /// </summary>
        /// <returns></returns>
        public static void SetAppTrackingMode(int mode)
        {
            if (!QiyuPlatform.IsAndroid)
                return;

 			QiyuXRCorePlugin.QVR_SetAppTrackingMode(mode);
   		}

# 4.5 Display Refresh Rates

The display refresh rate stands for the VR device refreshing every second. The value of Display Refresh Rates higher the higher FPS and definition are supported and it will more stable for tracking. The default display Refresh Rates of QIYU devices is 72Hz, in other words, the application will refreshing at 72 Hz if developers do not set or modify the value which can be set by using the following APIs.

It is worth to pay attention, higher display refresh rates requires less time for each frame, the application should make sure the performance is meet the QIYU Application review guidelines, otherwise, the application might be lived on QIYU store. Please refer to the Display refresh rates support by different types of QIYU devices:

Device Display Refresh Rates
QIYU MIX 72Hz、90Hz
QIYU Dream Pro 72Hz、90Hz
QIYU Dream 72Hz
QIYU 3 72Hz
  • Set display refresh rate(QiyuXRCore.TrySetDisplayRefreshRate)
///<summary>
///Set display refresh rate
///</summary>
///<paramname="refreshRate">refresh Rate</param>
///<returns></returns>
publicstaticboolTrySetDisplayRefreshRate(floatrefreshRate)
{
if(!QiyuPlatform.IsAndroid)
returnfalse;
returnQiyuXRCorePlugin.QVR_SetDisplayRefreshRate(refreshRate);
}
  • Get Display Refresh Rate(QiyuXRCore.TryGetDisplayRefreshRate)
///<summary>
///Get Display Refresh Rate
///</summary>
///<paramname="refreshRate">return value</param>
///<returns></returns>
publicstaticboolTryGetDisplayRefreshRate(outfloatrefreshRate)
{
if(!QiyuPlatform.IsAndroid)
{
refreshRate=72;
returntrue;
}
floatrate=0;
if(QiyuXRCorePlugin.QVR_GetDisplayRefreshRate(refrate))
{
refreshRate=rate;
returntrue;
}
else
{
refreshRate=rate;
returnfalse;
}
}
  • Get available Display refresh rate list(QiyuXRCore.TryGetAvailableDisplayRefreshRates)
///<summary>
///Get available Display refresh rates
///</summary>
///<paramname="refreshRates">return list</param>
///<returns></returns>
publicstaticboolTryGetAvailableDisplayRefreshRates(outfloat[]refreshRates)
{
if(!QiyuPlatform.IsAndroid)
{
refreshRates=newfloat[]{72,90};
returntrue;
}
intcount=0;
QiyuXRCorePlugin.QVR_GetAvailableDisplayRefreshRates(IntPtr.Zero,refcount);
if(count>0)
{
if(cachedRefreshRatesBuffer.GetCapacity()<count)
cachedRefreshRatesBuffer.Reset(count);
if(cachedRefreshRatesManagedBuffer.Length<count)
cachedRefreshRatesManagedBuffer=newfloat[count];
QiyuXRCorePlugin.QVR_GetAvailableDisplayRefreshRates(cachedRefreshRatesBuffer.GetPointer(),ref
count);
Marshal.Copy(cachedRefreshRatesBuffer.GetPointer(),cachedRefreshRatesManagedBuffer,
0,count);
refreshRates=newfloat[count];
for(inti=0;i<count;i++)
{
refreshRates[i]=cachedRefreshRatesManagedBuffer[i];
}
returntrue;
}
else
{
refreshRates=newfloat[0];
returnfalse;
}
}

# 4.6 Passthrough

  • Get the capabilities of passthrough

    public static PassthroughCapabilities GetPassthroughCapabilities()
            {
                if (!QiyuPlatform.IsAndroid)
                    return PassthroughCapabilities.NotSupport;
    
                return (PassthroughCapabilities)QiyuXRCorePlugin.QVR_GetPassthroughCapabilities();
            }
    
            public enum PassthroughCapabilities : int
            {
                NotSupport = 0,//Not support passthrough
                Mono = 1,//Support mono passthrough
                Color = 2//Support color passthrough
            }
    
  • Enable/disable Passthrough background:

    public static void EnableSeeThrough(bool visible)
            {
                if (QiyuPlatform.IsAndroid)
                {
                    QiyuXRCorePlugin.QVR_EnableSeeThrough(visible);
                }
    }
    
  • Register and unregister callback functions for enabling/disabling Passthrough background:

    public static void RegisterSeeThroughCallback(Action<int> callback)
            {
                if (seethrough_callback == null)
                {
                    seethrough_callback = callback;
                    if (QiyuPlatform.IsAndroid)
                    {
                        SeeThroughCallBack callback_delegate = OnSeeThroughChanged;
                        QiyuXRCorePlugin.QVR_SetSeeThroughCallback(Marshal.GetFunctionPointerForDelegate(callback_delegate));
                    }
                }
                else
                {
                    seethrough_callback += callback;
                    UnityEngine.Debug.Log("User RegisterSeeThroughCallback!");
                }
            }
    
            public static void UnRegisterSeeThroughCallback(Action<int> callback)
            {
                if (seethrough_callback != null)
                {
                    seethrough_callback -= callback;
                    UnityEngine.Debug.Log("User UnRegisterSeeThroughCallback!");
                }
            }
    
  • Calling example:

            var deviceInfo = Unity.XR.Qiyu.QiyuXRCore.GetDeviceInfo();
            if (deviceInfo.Name_HMD != "QiyuHMD-3" && deviceInfo.Name_HMD != "QiyuHMD-Dream" && deviceInfo.Name_HMD != "QiyuHMD-Dream Pro")
            {
                //Currently, passthrough is only supported on Qiyu MIX and newer models. If it is enabled without excluding older models, the screen will be black.
                QiyuSeeThrough.EnableSeeThrough(true);
            }