r.ScreenPercentage.Default.VR.Mode

r.ScreenPercentage.Default.VR.Mode

#Overview

name: r.ScreenPercentage.Default.VR.Mode

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 r.ScreenPercentage.Default.VR.Mode is to control the default screen percentage mode for VR (Virtual Reality) rendering in Unreal Engine 5. This setting variable is part of the rendering system, specifically dealing with resolution scaling in VR environments.

This setting variable is primarily used in the Engine module, specifically within the LegacyScreenPercentageDriver.cpp file. It’s part of the screen percentage system, which allows for dynamic resolution scaling to maintain performance in demanding rendering scenarios.

The value of this variable is set using a console variable (CVar) system. It’s defined as a TAutoConsoleVariable, which means it can be changed at runtime through console commands or configuration files.

The variable interacts with the EScreenPercentageMode enum, which likely defines different modes for screen percentage behavior (such as Manual, Dynamic, etc.). The value is clamped between 0 and 2, suggesting there are three possible modes.

Developers must be aware that this variable specifically affects VR rendering. It’s used in conjunction with other screen percentage settings for different view types (like mobile or desktop).

Best practices when using this variable include:

  1. Understanding the performance implications of different screen percentage modes in VR.
  2. Testing thoroughly in VR environments to ensure the chosen mode provides the best balance of performance and visual quality.
  3. Considering this setting in conjunction with other VR-specific rendering options.

Regarding the associated variable CVarScreenPercentageDefaultVRMode:

This is the actual console variable that stores the value for r.ScreenPercentage.Default.VR.Mode. It’s defined with the same default value (EScreenPercentageMode::Manual) and the same console variable flags (ECVF_Scalability | ECVF_Default).

The CVarScreenPercentageDefaultVRMode variable is used directly in the code to retrieve the current setting value. For example, in the FStaticResolutionFractionHeuristic::FUserSettings::PullRunTimeRenderingSettings function, it’s accessed using GetValueOnGameThread() to determine the screen percentage mode for VR views.

When working with this variable, developers should:

  1. Use CVarScreenPercentageDefaultVRMode.GetValueOnGameThread() to read the current value in C++ code.
  2. Be aware that changes to this variable will affect all VR rendering in the engine unless overridden locally.
  3. Consider exposing this setting in user-facing graphics options for VR experiences, allowing players to optimize for their hardware.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:23

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultVRMode(
	TEXT("r.ScreenPercentage.Default.VR.Mode"), int32(EScreenPercentageMode::Manual),
	TEXT(""),
	ECVF_Scalability | ECVF_Default);

static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultPathTracerMode(
	TEXT("r.ScreenPercentage.Default.PathTracer.Mode"), int32(EScreenPercentageMode::Manual),
	TEXT(""),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:22

Scope: file

Source code excerpt:

	ECVF_Scalability | ECVF_Default);

static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultVRMode(
	TEXT("r.ScreenPercentage.Default.VR.Mode"), int32(EScreenPercentageMode::Manual),
	TEXT(""),
	ECVF_Scalability | ECVF_Default);

static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultPathTracerMode(
	TEXT("r.ScreenPercentage.Default.PathTracer.Mode"), int32(EScreenPercentageMode::Manual),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:238

Scope (from outer to inner):

file
function     void FStaticResolutionFractionHeuristic::FUserSettings::PullRunTimeRenderingSettings

Source code excerpt:

		else if (ViewStatus == EViewStatusForScreenPercentage::VR)
		{
			Mode = EScreenPercentageMode(FMath::Clamp(CVarScreenPercentageDefaultVRMode.GetValueOnGameThread(), 0, 2));
		}
		else if (ViewStatus == EViewStatusForScreenPercentage::Mobile)
		{
			Mode = EScreenPercentageMode(FMath::Clamp(CVarScreenPercentageDefaultMobileMode.GetValueOnGameThread(), 0, 2));
		}
		else if (ViewStatus == EViewStatusForScreenPercentage::Desktop)