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 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.
-
float
-
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.
-
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.
According to whether platform has eye-tracking sensor, it exists two forms of foveated rendering
- 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.
- 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:
- 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);
}
- 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
Precautions
Below items must be noticed before using foveated rendering.
- Final rendering result may different on different platforms.
- Some paltfroms may not support foveated rendering, using WVR_IsRenderFoveationSupport to query .
- Using MSAA and foveated rendering at the same time, the former will effect final rendering result of the latter。
- Tessellation, geometry, or compute shaders could not be used with foveated rendering。