WVR_RenderFoveation

WVR_EXPORT void WVR_RenderFoveation(bool enable)

Enable or disable foveated rendering (deprecated).

Deprecated. Using new API WVR_RenderFoveationMode. Using to enable or disable foveated rendering. And developer need to call WVR_PreRenderEye to take foveated rendering effect on texture. This function is platform-depent, must call WVR_IsRenderFoveationSupport to check does this platform support this.

Version
API Level 3
Parameters
  • enable: To enable or diable foveated rendering.

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.

Notification

This api is deprecated, please refer new API WVR_RenderFoveationMode .

How to use

Foveated rendering is a technique to reduce power consumption and increment the performance. It is achieved by reducing the resoultion of peripheral region and keeping the resolution of foveal region. This is corresponding to two visions of human visual system, foveal vision and peripheral vision. Foveal vision has highest acuity and peripheral vision has lower acuity. Even reduce image quality of peripheral vision, users will not notice. See the sample image below.

_images/foveatedrendering_resolution_demo.jpg

This demo image use a extreme FOV setting to show you an obvious resoult. Settings are FOV25° & PeripheralQuality Low.

According to whether platform has eye-tracking sensor, it exists two forms of foveated rendering

  1. Fixed foveated rendering: In a device which don’t have eye-tracking sensor, can’t get information about focal postion. Assume that user is looking at the screen center or something that needs attention.
  2. Eye-tracked foveated rendering: where the gaze point is tracked by eye-tracking sensor, can using more aggressive setting and end users would not notice a drop in quality.

Even on a device which don’t have eye-tracking sensor, still can gain benfit by using fixed foveated rendering. WaveVR SDK only support fixed foveated rendering now, will support eye-tracked foveated rendering in furture.

WaveVR SDK provide two styles of fixed foveated rendering programming, below is an example for foveated rendering:

  1. Simple, runtime handle most of the work.
#include <wvr/wvr_render.h>

// To enable foveated rendering
WVR_RenderFoveation(true);

while(true) {
    // Step 1 PreRenderEye. Runtime will setup 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;
    // Lift eye
    e = WVR_SubmitFrame(WVR_Eye_Left, &leftEyeTexture);

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

// To enable foveated rendering
WVR_RenderFoveation(true);

while(true) {
    // Step 1 PreRenderEye. Runtime will setup texture parameters using 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 degree
    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 degree
    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;
    // Lift eye
    e = WVR_SubmitFrame(WVR_Eye_Left, &leftEyeTexture);

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

Option PeripheralQuality demonstration

_images/native_foveation_high_pq.png

This demo picture is using FOV 30° and peripheralQuality high. Can notice that the surrounding cubes and text are a bit blurred.

_images/native_foveation_medium_pq.png

This demo picture is using FOV 30° and peripheralQuality medium. Compared with peripheralQuality high, the surrounding cubes and text are more blurred.

_images/native_foveation_low_pq.png

This demo picture is using FOV 30° and peripheralQuality low. Compared with peripheralQuality medium, the surrounding cubes are more blurred and text becomes unreadable.

Precautions

Below items must be noticed before using foveated rendering.

  1. Final rendering result may different on different platforms.
  2. Some paltfroms may not support foveated rendering, using WVR_IsRenderFoveationSupport to query .
  3. Using MSAA and foveated rendering at the same time, the former will effect final rendering result of the latter。
  4. Tessellation, geometry, or compute shaders could not be used with foveated rendering。