WVR_RenderFoveationMode

WVR_EXPORT WVR_Result WVR_RenderFoveationMode(WVR_FoveationMode mode)

Enable or disable foveated rendering or set the default mode for foveated rendering.

WVR_PreRenderEye must be called to apply foveated effect on a texture. This function is device dependent. WVR_IsRenderFoveationSupport must be called to check if the device supports foveated rendering. This function must be called after calling WVR_RenderInit.

Version
API Level 5
Parameters
  • mode: Change the foveated rendering mode.
Return Value
  • WVR_Success: Mode was successfully changed.
  • others: Failed to change the mode. See WVR_Result for more information.

Struct and enumeration

WVR_RenderFoveationParams_t is defined as below.

struct WVR_RenderFoveationParams

Foveation parameters.

Aggregate custom information of foveated rendering used in WVR_PreRenderEye.

Public Members

float focalX

focalX: The x coordinate of the focal point in normalized device coordinates. (-1.0 - 1.0)

float focalY

focalY: The y coordinate of the focal point in normalized device coordinates. (-1.0 - 1.0)

float fovealFov

fovealFov: The fov of the foveal.

WVR_PeripheralQuality periQuality

periQuality: The peripheral region quality of the foveated rendering.

enum WVR_PeripheralQuality

The peripheral region quality that is used in WVR_RenderFoveationParams_t.

Values:

WVR_PeripheralQuality_Low = 0x0000

WVR_PeripheralQuality_Low: The peripheral region quality is low while power saved is high.

WVR_PeripheralQuality_Medium = 0x0001

WVR_PeripheralQuality_Medium: The peripheral region quality is medium and power saved are average.

WVR_PeripheralQuality_High = 0x0002

WVR_PeripheralQuality_High: The peripheral region quality is high while power saved is low.

How to use

Foveated rendering is a technique used to reduce power consumption and improve performance. It reduce the resolution of the peripheral region while keeping the resolution of the foveal region clear and sharp. This correspond to two visions of the human visual system: foveal vision and peripheral vision. Foveal vision has the highest acuity while peripheral vision has lower acuity. When the resolution of images in the peripheral vision is reduced, people don’t notice the difference.

_images/foveatedrendering_resolution_demo.jpg

This sample image uses an extreme FOV setting to show obvious results. Settings are FOV25° and PeripheralQuality Low.

When a device has a eye tracking feature, there will be 2 types of foveated rendering.

  • Fixed foveated rendering: In a device that doesn’t have eye-tracking sensor, the focal position information cannot be retrieved. It is assumed that the user is looking at the center of the screen or something that needs attention.
  • Eye-tracked foveated rendering: The gaze point is tracked by eye-tracking sensor. A more aggressive can be used and users will not notice a drop in quality.

Even on devices that don’t have an eye-tracking sensor, there can still benefits in using fixed foveated rendering. Currently, WaveVR SDK only supports fixed foveated rendering, eye-tracked foveated rendering will be supported in the future.

WaveVR SDK provide two styles of fixed foveated rendering programming:

  • Simple: Runtime handles most of the work.
#include <wvr/wvr_render.h>

// To enable foveated rendering
WVR_RenderFoveationMode(WVR_FoveationMode_Default);

while(true) {
    // Step 1 PreRenderEye. Runtime will set up texture parameters for foveated rendering.
    // Left eye
    int32_t IndexLeft = WVR_GetAvailableTextureIndex(mLeftEyeQ);
    WVR_TextureParams_t eyeTexture = WVR_GetTexture(mLeftEyeQ, IndexLeft);
    WVR_PreRenderEye(WVR_Eye_Left, &eyeTexture);

    // Right eye
    int32_t IndexRight =  = WVR_GetAvailableTextureIndex(mRightEyeQ);
    eyeTexture = WVR_GetTexture(mRightEyeQ, IndexRight);
    WVR_PreRenderEye(WVR_Eye_Right, &eyeTexture);

    // Step 2 Render scene

    // Step 3 Submit texture
    WVR_SubmitError e;
    // Left eye
    e = WVR_SubmitFrame(WVR_Eye_Left, &leftEyeTexture);

    // Right eye
    e = WVR_SubmitFrame(WVR_Eye_Right, &rightEyeTexture);
}
  • Full function: Developers assign different foveated rendering parameters.
#include <wvr/wvr_render.h>

// To enable foveated rendering
WVR_RenderFoveationMode(WVR_FoveationMode_Enable);

while(true) {
    // Step 1 PreRenderEye. Runtime will set up texture parameters using the given foveated rendering parameters.
    // Left eye
    int32_t IndexLeft = WVR_GetAvailableTextureIndex(mLeftEyeQ);
    WVR_TextureParams_t eyeTexture = WVR_GetTexture(mLeftEyeQ, IndexLeft);
    WVR_RenderFoveationParams_t foveated;
    foveated.focalX = foveated.focalY = 0.0f; // focal position
    foveated.fovealFov = 30.0f;  // 30 degrees
    foveated.periQuality = static_cast<WVR_PeripheralQuality>(WVR_PeripheralQuality_High);
    WVR_PreRenderEye(WVR_Eye_Left, &eyeTexture, &foveated);

    // Right eye
    int32_t IndexRight =  = WVR_GetAvailableTextureIndex(mRightEyeQ);
    eyeTexture = WVR_GetTexture(mRightEyeQ, IndexRight);
    WVR_RenderFoveationParams_t foveated;
    foveated.focalX = foveated.focalY = 0.0f; // focal position
    foveated.fovealFov = 30.0f;  // 30 degrees
    foveated.periQuality = static_cast<WVR_PeripheralQuality>(WVR_PeripheralQuality_High);
    WVR_PreRenderEye(WVR_Eye_Right, &eyeTexture, &foveated);

    // Step 2 Render scene

    // Step 3 Submit texture
    WVR_SubmitError e;
    // Left eye
    e = WVR_SubmitFrame(WVR_Eye_Left, &leftEyeTexture);

    // Right eye
    e = WVR_SubmitFrame(WVR_Eye_Right, &rightEyeTexture);
}

Peripheral Region Quality Samples

  1. _images/native_foveation_high_pq.png
FOV = 30°
Peripheral quality = high
The surrounding cubes and text in the peripheral region are a bit blurred.

  1. _images/native_foveation_medium_pq.png
FOV = 30°
Peripheral quality = Medium
Compared to the first sample image, the cubes and text in the peripheral region are more blurred.

  1. _images/native_foveation_low_pq.png
FOV = 30°
Peripheral quality = Low
Compared to the second sample image, the cubes in the peripheral region are more blurred and text becomes unreadable.

Reminders

Things to remember for foveated rendering:

  • Final rendering results may differ on different devices.
  • Some devices do not support foveated rendering: Use WVR_IsRenderFoveationSupport to check if the device supports foveated rendering.
  • If MSAA and foveated rendering are used at the same time. MSAA will affect the final rendering results of foveated rendering.
  • Do not use tessellation, geometry, or compute shaders with foveated rendering.

Warning

The foveation setting here would be loss effect during AdaptiveQuality enabled with WVR_QualityStrategy_AutoFoveation strategy. It has be controlled by Adaptive Quality.