r.ScreenPercentage.Auto.PixelCountMultiplier
r.ScreenPercentage.Auto.PixelCountMultiplier
#Overview
name: r.ScreenPercentage.Auto.PixelCountMultiplier
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ScreenPercentage.Auto.PixelCountMultiplier is to control the automatic screen percentage scaling in Unreal Engine’s rendering system. It acts as a multiplier for the pixel count when the engine is automatically adjusting the screen percentage.
This setting variable is primarily used in the Engine module, specifically within the legacy screen percentage driver. Based on the callsites, it’s part of the rendering system that manages screen resolution and scaling.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1.0f, but can be changed at runtime through console commands or configuration files.
The variable interacts closely with other screen percentage-related variables, such as r.ScreenPercentage.MinResolution and r.ScreenPercentage.MaxResolution. It’s also associated with the C++ variable CVarAutoPixelCountMultiplier, which is used to access the value in the code.
Developers should be aware that this variable affects the automatic screen percentage scaling. A value higher than 1.0 will increase the pixel count, potentially improving image quality at the cost of performance, while a value lower than 1.0 will decrease the pixel count, potentially improving performance at the cost of image quality.
Best practices when using this variable include:
- Carefully balancing between performance and visual quality.
- Testing different values to find the optimal setting for your specific game or application.
- Considering the target hardware capabilities when adjusting this value.
- Using it in conjunction with other screen percentage settings for fine-tuned control.
Regarding the associated variable CVarAutoPixelCountMultiplier:
The purpose of CVarAutoPixelCountMultiplier is to provide programmatic access to the r.ScreenPercentage.Auto.PixelCountMultiplier value within the C++ code.
This variable is used in the Engine module, specifically in the legacy screen percentage driver implementation.
The value of CVarAutoPixelCountMultiplier is set automatically by the CVar system to match r.ScreenPercentage.Auto.PixelCountMultiplier.
It interacts directly with the FStaticResolutionFractionHeuristic::FUserSettings structure, where it’s used to update the AutoPixelCountMultiplier member.
Developers should be aware that this is the internal representation of the console variable and should be used when accessing the value in C++ code rather than trying to read the console variable directly.
Best practices for using CVarAutoPixelCountMultiplier include:
- Using GetValueOnGameThread() to access its current value.
- Avoiding direct modification of this variable; instead, modify the console variable r.ScreenPercentage.Auto.PixelCountMultiplier.
- Consider caching the value if it’s accessed frequently, as GetValueOnGameThread() might have some overhead.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:41
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarAutoPixelCountMultiplier(
TEXT("r.ScreenPercentage.Auto.PixelCountMultiplier"), 1.0f,
TEXT(""),
ECVF_Default);
static TAutoConsoleVariable<float> CVarScreenPercentageMinResolution(
TEXT("r.ScreenPercentage.MinResolution"),
0.0f,
#Associated Variable and Callsites
This variable is associated with another variable named CVarAutoPixelCountMultiplier
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:40
Scope: file
Source code excerpt:
ECVF_Scalability | ECVF_Default);
static TAutoConsoleVariable<float> CVarAutoPixelCountMultiplier(
TEXT("r.ScreenPercentage.Auto.PixelCountMultiplier"), 1.0f,
TEXT(""),
ECVF_Default);
static TAutoConsoleVariable<float> CVarScreenPercentageMinResolution(
TEXT("r.ScreenPercentage.MinResolution"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:220
Scope (from outer to inner):
file
function void FStaticResolutionFractionHeuristic::FUserSettings::PullRunTimeRenderingSettings
Source code excerpt:
Mode = EScreenPercentageMode::Manual;
GlobalResolutionFraction = GlobalResolutionFractionOverride;
AutoPixelCountMultiplier = CVarAutoPixelCountMultiplier.GetValueOnGameThread();
}
#if WITH_EDITOR
else if (FStaticResolutionFractionHeuristic::FUserSettings::EditorOverridePIESettings())
{
PullEditorRenderingSettings(ViewStatus);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:261
Scope (from outer to inner):
file
function void FStaticResolutionFractionHeuristic::FUserSettings::PullRunTimeRenderingSettings
Source code excerpt:
MinRenderingResolution = CVarScreenPercentageMinResolution.GetValueOnGameThread();
MaxRenderingResolution = CVarScreenPercentageMaxResolution.GetValueOnGameThread();
AutoPixelCountMultiplier = CVarAutoPixelCountMultiplier.GetValueOnGameThread();
if (GlobalResolutionFraction <= 0.0)
{
GlobalResolutionFraction = 1.0f;
Mode = EScreenPercentageMode::Manual;
}