xr.VRS.DynamicFoveation
xr.VRS.DynamicFoveation
#Overview
name: xr.VRS.DynamicFoveation
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether foveation level should adjust based on GPU utilization\n 0: Disabled (default);\n 1: Enabled\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of xr.VRS.DynamicFoveation is to control the dynamic foveation feature in Unreal Engine’s Variable Rate Shading (VRS) system. This setting is specifically related to the rendering system, particularly for XR (Extended Reality) applications.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the Variable Rate Shading subsystem. It’s implemented in the FoveatedImageGenerator.cpp file, which suggests it’s part of the foveated rendering feature.
The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with an initial value of 0 (disabled by default). Users can change this value at runtime through console commands or configuration files.
The associated variable CVarDynamicFoveation directly interacts with xr.VRS.DynamicFoveation. They share the same value and purpose.
Developers must be aware that this variable controls whether the foveation level should adjust based on GPU utilization. When enabled (set to 1), the system will dynamically adjust the foveation level, which can impact rendering performance and visual quality.
Best practices when using this variable include:
- Only enable it (set to 1) when you want to dynamically adjust foveation based on GPU utilization.
- Monitor performance impacts when enabled, as dynamic adjustment may have overhead.
- Test thoroughly in XR applications to ensure the dynamic foveation doesn’t cause noticeable visual artifacts.
- Consider the target hardware capabilities when deciding to enable this feature.
Regarding the associated variable CVarDynamicFoveation:
The purpose of CVarDynamicFoveation is identical to xr.VRS.DynamicFoveation. It’s the C++ representation of the console variable in the engine’s code.
This variable is used within the Renderer module, specifically in the FoveatedImageGenerator class. It’s checked in the PrepareImages function to determine whether to apply dynamic foveation.
The value of CVarDynamicFoveation is set when the xr.VRS.DynamicFoveation console variable is set. They are effectively the same variable, with CVarDynamicFoveation being the in-code access point.
CVarDynamicFoveation interacts directly with the foveated rendering logic. When enabled, it triggers the UpdateDynamicVRSAmount() function to calculate the dynamic VRS amount.
Developers should be aware that accessing CVarDynamicFoveation.GetValueOnAnyThread() may have thread safety implications, as indicated by its name.
Best practices for CVarDynamicFoveation include:
- Use it to check the current state of dynamic foveation in rendering code.
- Be mindful of potential performance impacts when frequently checking its value.
- Consider caching the value if used in performance-critical sections of code.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:1148, section: [Oculus_Quest DeviceProfile]
- INI Section:
Oculus_Quest DeviceProfile
- Raw value:
1
- Is Array:
False
#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:27
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDynamicFoveation(
TEXT("xr.VRS.DynamicFoveation"),
0,
TEXT("Whether foveation level should adjust based on GPU utilization\n")
TEXT(" 0: Disabled (default);\n")
TEXT(" 1: Enabled\n"),
ECVF_RenderThreadSafe);
#Associated Variable and Callsites
This variable is associated with another variable named CVarDynamicFoveation
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/FoveatedImageGenerator.cpp:26
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDynamicFoveation(
TEXT("xr.VRS.DynamicFoveation"),
0,
TEXT("Whether foveation level should adjust based on GPU utilization\n")
TEXT(" 0: Disabled (default);\n")
TEXT(" 1: Enabled\n"),
ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/FoveatedImageGenerator.cpp:151
Scope (from outer to inner):
file
function void FFoveatedImageGenerator::PrepareImages
Source code excerpt:
// Set up dynamic VRS amount based on target framerate and use it to interpolate cutoffs (default to max level)
float VRSDynamicAmount = 1.0f;
if (CVarDynamicFoveation.GetValueOnAnyThread() && VRSMaxLevel > 0)
{
VRSDynamicAmount = UpdateDynamicVRSAmount();
}
if (VRSMaxLevel <= 0 || VRSDynamicAmount <= 0)
{