r.DynamicRes.MinScreenPercentage

r.DynamicRes.MinScreenPercentage

#Overview

name: r.DynamicRes.MinScreenPercentage

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).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.DynamicRes.MinScreenPercentage is to set the minimal primary screen percentage for dynamic resolution scaling in Unreal Engine 5. This setting variable is part of the dynamic resolution system, which allows the engine to adjust the rendering resolution dynamically to maintain performance.

This setting variable is primarily used by the dynamic resolution subsystem within Unreal Engine’s rendering module. Based on the callsites, it’s clear that this variable is defined and used in the DynamicResolution.cpp file, which is part of the Engine’s runtime.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value derived from DynamicRenderScaling::FHeuristicSettings::kDefaultMinResolutionFraction, but can be changed at runtime through console commands or programmatically.

The r.DynamicRes.MinScreenPercentage interacts closely with other dynamic resolution settings, particularly r.DynamicRes.MaxScreenPercentage. These two variables define the range within which the dynamic resolution system can operate.

Developers must be aware that this variable sets a lower bound for the screen percentage. Setting this value too low might result in very low-resolution rendering, which could significantly impact visual quality. Conversely, setting it too high might limit the engine’s ability to scale down resolution to maintain performance in demanding scenes.

Best practices when using this variable include:

  1. Balancing it carefully with r.DynamicRes.MaxScreenPercentage to provide an appropriate range for resolution scaling.
  2. Testing thoroughly to ensure the minimum resolution still provides acceptable visual quality for your game.
  3. Considering different values for different quality presets or platforms.

The associated variable CVarDynamicResMinSP is the actual console variable object that holds the value of r.DynamicRes.MinScreenPercentage. It’s used internally by the engine to access and modify the setting. The purpose and considerations for CVarDynamicResMinSP are essentially the same as for r.DynamicRes.MinScreenPercentage, as they represent the same setting in different forms (one as a string identifier, the other as a C++ object).

When working with CVarDynamicResMinSP directly in C++ code, developers should be aware that it’s accessed using GetValueOnAnyThread() or similar methods, and its value is converted from a percentage to a fraction using the GetPercentageCVarToFraction function when used in calculations for the dynamic resolution system.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:78, section: [IOS DeviceProfile]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:18

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarDynamicResMinSP(
	TEXT("r.DynamicRes.MinScreenPercentage"),
	DynamicRenderScaling::FractionToPercentage(DynamicRenderScaling::FHeuristicSettings::kDefaultMinResolutionFraction),
	TEXT("Minimal primary screen percentage."),
	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<float> CVarDynamicResMaxSP(
	TEXT("r.DynamicRes.MaxScreenPercentage"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:17

Scope: file

Source code excerpt:



static TAutoConsoleVariable<float> CVarDynamicResMinSP(
	TEXT("r.DynamicRes.MinScreenPercentage"),
	DynamicRenderScaling::FractionToPercentage(DynamicRenderScaling::FHeuristicSettings::kDefaultMinResolutionFraction),
	TEXT("Minimal primary screen percentage."),
	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<float> CVarDynamicResMaxSP(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:148

Scope (from outer to inner):

file
function     DynamicRenderScaling::FHeuristicSettings GetPrimaryDynamicResolutionSettings

Source code excerpt:

	DynamicRenderScaling::FHeuristicSettings BudgetSetting;
	BudgetSetting.Model = DynamicRenderScaling::EHeuristicModel::Quadratic;
	BudgetSetting.MinResolutionFraction      = DynamicRenderScaling::GetPercentageCVarToFraction(CVarDynamicResMinSP);
	BudgetSetting.MaxResolutionFraction      = DynamicRenderScaling::GetPercentageCVarToFraction(CVarDynamicResMaxSP);
	BudgetSetting.ThrottlingMaxResolutionFraction = DynamicRenderScaling::GetPercentageCVarToFraction(CVarDynamicResThrottlingMaxSP);
	BudgetSetting.UpperBoundQuantization     = CVarUpperBoundQuantization.GetValueOnAnyThread();
	BudgetSetting.BudgetMs                   = CVarFrameTimeBudget.GetValueOnAnyThread() * (1.0f - DynamicRenderScaling::GetPercentageCVarToFraction(CVarOverBudgetGPUHeadRoomPercentage));
	BudgetSetting.ChangeThreshold            = DynamicRenderScaling::GetPercentageCVarToFraction(CVarChangeThreshold);
	BudgetSetting.TargetedHeadRoom           = DynamicRenderScaling::GetPercentageCVarToFraction(CVarTargetedGPUHeadRoomPercentage);