WVR_SetFoveationConfig

WVR_EXPORT WVR_Result WVR_SetFoveationConfig(const WVR_Eye eye, const WVR_RenderFoveationParams_t * foveatedParam)

Set the foveated rendering config.

Need to be called before WVR_PreRenderEye to let config take place on the same frame. This function must be called after calling WVR_RenderInit.

Version
API Level 5
Parameters
  • eye: WVR_Eye, eye id to specify the side of the scene.
  • foveatedParam: Foveated rendering config
Return Value
  • WVR_Success: The config was successfully set.
  • others: Failed to set the config. See WVR_Result for more information.

Struct and enumeration

WVR_RenderFoveationParams_t is defined as:

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

Here is an example for the function:

#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 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_SetFoveationConfig(WVR_Eye_Left, &foveated)
    WVR_PreRenderEye(WVR_Eye_Left, &eyeTexture);

    // 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_SetFoveationConfig(WVR_Eye_Right, &foveated)
    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);
}