xr.VRS.GazeTrackedFoveation

xr.VRS.GazeTrackedFoveation

#Overview

name: xr.VRS.GazeTrackedFoveation

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of xr.VRS.GazeTrackedFoveation is to enable or disable gaze-tracking for foveated Variable Rate Shading (VRS) in Unreal Engine’s XR (Extended Reality) rendering system.

This setting variable is primarily used by the rendering system, specifically for Variable Rate Shading in XR applications. It is part of the Renderer module, as evidenced by its location in the “VariableRateShading/FoveatedImageGenerator.cpp” file.

The value of this variable is set through a console variable (CVarGazeTrackedFoveation) with a default value of 0 (disabled). It can be changed at runtime using console commands or through C++ code.

The associated variable CVarGazeTrackedFoveation directly interacts with xr.VRS.GazeTrackedFoveation. They share the same value and purpose.

Developers must be aware that:

  1. This feature requires a valid eye-tracking device and stereo rendering device to function properly.
  2. Enabling this feature may have performance implications, as it involves additional processing for gaze tracking.
  3. The feature is render thread safe, meaning it can be safely modified from different threads.

Best practices when using this variable include:

  1. Only enable it when targeting XR platforms that support eye-tracking and variable rate shading.
  2. Test the performance impact of enabling this feature in your specific application.
  3. Consider providing a user setting to toggle this feature, as some users may prefer it on or off.

Regarding the associated variable CVarGazeTrackedFoveation:

Developers should use CVarGazeTrackedFoveation.GetValueOnAnyThread() when they need to check if gaze-tracked foveation is enabled in their rendering code, particularly when implementing custom VRS or foveated rendering features.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/FoveatedImageGenerator.cpp:43

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarGazeTrackedFoveation(
	TEXT("xr.VRS.GazeTrackedFoveation"),
	0,
	TEXT("Enable gaze-tracking for foveated VRS\n")
	TEXT(" 0: Disabled (default);\n")
	TEXT(" 1: Enabled\n"),
	ECVF_RenderThreadSafe);

#Associated Variable and Callsites

This variable is associated with another variable named CVarGazeTrackedFoveation. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/FoveatedImageGenerator.cpp:42

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarGazeTrackedFoveation(
	TEXT("xr.VRS.GazeTrackedFoveation"),
	0,
	TEXT("Enable gaze-tracking for foveated VRS\n")
	TEXT(" 0: Disabled (default);\n")
	TEXT(" 1: Enabled\n"),
	ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/FoveatedImageGenerator.cpp:326

Scope (from outer to inner):

file
function     bool FFoveatedImageGenerator::IsGazeTrackingEnabled

Source code excerpt:

bool FFoveatedImageGenerator::IsGazeTrackingEnabled() const
{
	return CVarGazeTrackedFoveation.GetValueOnAnyThread()
		&& GEngine->EyeTrackingDevice.IsValid()
		&& GEngine->StereoRenderingDevice.IsValid();
}