WVR_RenderFoveationMode

WVR_EXPORT WVR_Result WVR_RenderFoveationMode(WVR_FoveationMode mode)

Switch foveated rendering mode.

Using to enable or disable foveated rendering or set to deafult mode. And developer need to call WVR_PreRenderEye to take foveated effect on texture. This function is platform-depent, must call WVR_IsRenderFoveationSupport to check does this platform support this. This function must be called after calling WVR_RenderInit.

Version
API Level 5
Parameters
  • mode: Switch foveated rendering mode.
Return Value
  • WVR_Success: switch mode successfully.
  • others: WVR_Result mean failure.

Struct and enumeration

WVR_RenderFoveationParams_t is defined as below.

struct WVR_RenderFoveationParams

Foveation parameters.

Aggregate custom informations of foveated rendering. Using in WVR_PreRenderEye.

Public Members

float focalX

focalX: The x coordinate of the focal point in normalized device coordinates.

float focalY

focalY: The y coordinate of the focal point in normalized device coordinates.

float fovealFov

fovealFov: The fov of the foveal.

WVR_PeripheralQuality periQuality

periQuality: The peripheral quality of foveated rendering.

enum WVR_PeripheralQuality

Peripheral Quality which using in WVR_RenderFoveationParams_t.

Values:

WVR_PeripheralQuality_Low = 0x0000

WVR_PeripheralQuality_Low: Peripheral quity is low and power saving is high.

WVR_PeripheralQuality_Medium = 0x0001

WVR_PeripheralQuality_Medium: Peripheral quity is medium and power saving is medium.

WVR_PeripheralQuality_High = 0x0002

WVR_PeripheralQuality_High: Peripheral quity is high and power saving 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.