r.Editor.Viewport.ScreenPercentage
r.Editor.Viewport.ScreenPercentage
#Overview
name: r.Editor.Viewport.ScreenPercentage
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Controls the editor viewports\' default screen percentage when using r.Editor.Viewport.ScreenPercentageMode=0.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Editor.Viewport.ScreenPercentage is to control the default screen percentage for editor viewports in Unreal Engine 5. This setting is specifically used when the screen percentage mode is set to 0 (r.Editor.Viewport.ScreenPercentageMode=0).
This setting variable is primarily used by the editor’s viewport rendering system, which is part of the UnrealEd module. It affects how the editor viewports are rendered, particularly in terms of resolution scaling.
The value of this variable is set in multiple places:
- It is initially set to 100 when the console variable is created in EditorProjectSettings.cpp.
- It can be modified through project settings in the UEditorPerformanceProjectSettings class.
- It can be overridden by user settings in the same class.
The associated variable CVarEditorViewportDefaultScreenPercentage interacts directly with r.Editor.Viewport.ScreenPercentage. They share the same value and are used interchangeably in the code.
Developers should be aware of the following when using this variable:
- It affects editor performance, as higher values will increase the rendering resolution and potentially impact frame rates.
- It interacts with other settings like minimum and maximum rendering resolutions.
- Changes to this variable will affect all editor viewports unless overridden for specific views.
Best practices for using this variable include:
- Adjust it based on the project’s needs and the available hardware resources.
- Consider the trade-off between visual quality and editor performance.
- Use it in conjunction with other resolution-related settings for optimal results.
Regarding the associated variable CVarEditorViewportDefaultScreenPercentage:
- It serves the same purpose as r.Editor.Viewport.ScreenPercentage.
- It is used internally by the engine to access and modify the screen percentage value.
- It’s typically used in C++ code rather than directly through console commands.
- Developers should treat it as equivalent to r.Editor.Viewport.ScreenPercentage when working with the engine’s source code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:36
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarEditorViewportDefaultScreenPercentage(
TEXT("r.Editor.Viewport.ScreenPercentage"), 100,
TEXT("Controls the editor viewports' default screen percentage when using r.Editor.Viewport.ScreenPercentageMode=0."),
ECVF_Default);
TAutoConsoleVariable<int32> CVarEditorViewportDefaultMinRenderingResolution(
TEXT("r.Editor.Viewport.MinRenderingResolution"), 720,
TEXT("Controls the minimum number of rendered pixel by default in editor viewports."),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:278
Scope: file
Source code excerpt:
static auto CVarEditorViewportDefaultScreenPercentagePathTracerMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.PathTracer"));
static auto CVarEditorViewportDefaultScreenPercentageMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.NonRealTime"));
static auto CVarEditorViewportDefaultScreenPercentage = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentage"));
static auto CVarEditorViewportDefaultMinRenderingResolution = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.MinRenderingResolution"));
static auto CVarEditorViewportDefaultMaxRenderingResolution = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.MaxRenderingResolution"));
if (ViewStatus == EViewStatusForScreenPercentage::PathTracer)
{
Mode = EScreenPercentageMode(FMath::Clamp(CVarEditorViewportDefaultScreenPercentagePathTracerMode->GetInt(), 0, 2));
#Associated Variable and Callsites
This variable is associated with another variable named CVarEditorViewportDefaultScreenPercentage
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:35
Scope: file
Source code excerpt:
ECVF_Default);
TAutoConsoleVariable<float> CVarEditorViewportDefaultScreenPercentage(
TEXT("r.Editor.Viewport.ScreenPercentage"), 100,
TEXT("Controls the editor viewports' default screen percentage when using r.Editor.Viewport.ScreenPercentageMode=0."),
ECVF_Default);
TAutoConsoleVariable<int32> CVarEditorViewportDefaultMinRenderingResolution(
TEXT("r.Editor.Viewport.MinRenderingResolution"), 720,
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:295
Scope (from outer to inner):
file
function void UEditorPerformanceProjectSettings::ExportResolutionValuesToConsoleVariables
Source code excerpt:
CVarEditorViewportDefaultPathTracerScreenPercentageMode->Set(int32(EditorProjectSettings->PathTracerScreenPercentageMode), ECVF_SetByProjectSetting);
CVarEditorViewportNonRealtimeDefaultScreenPercentageMode->Set(int32(EditorProjectSettings->NonRealtimeScreenPercentageMode), ECVF_SetByProjectSetting);
CVarEditorViewportDefaultScreenPercentage->Set(EditorProjectSettings->ManualScreenPercentage, ECVF_SetByProjectSetting);
CVarEditorViewportDefaultMinRenderingResolution->Set(EditorProjectSettings->MinViewportRenderingResolution, ECVF_SetByProjectSetting);
CVarEditorViewportDefaultMaxRenderingResolution->Set(EditorProjectSettings->MaxViewportRenderingResolution, ECVF_SetByProjectSetting);
}
// Override with the per editor user settings
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:330
Scope (from outer to inner):
file
function void UEditorPerformanceProjectSettings::ExportResolutionValuesToConsoleVariables
Source code excerpt:
if (EditorUserSettings->bOverrideManualScreenPercentage)
{
CVarEditorViewportDefaultScreenPercentage->Set(EditorUserSettings->ManualScreenPercentage, ECVF_SetByProjectSetting);
}
if (EditorUserSettings->bOverrideMinViewportRenderingResolution)
{
CVarEditorViewportDefaultMinRenderingResolution->Set(EditorUserSettings->MinViewportRenderingResolution, ECVF_SetByProjectSetting);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:278
Scope: file
Source code excerpt:
static auto CVarEditorViewportDefaultScreenPercentagePathTracerMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.PathTracer"));
static auto CVarEditorViewportDefaultScreenPercentageMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.NonRealTime"));
static auto CVarEditorViewportDefaultScreenPercentage = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentage"));
static auto CVarEditorViewportDefaultMinRenderingResolution = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.MinRenderingResolution"));
static auto CVarEditorViewportDefaultMaxRenderingResolution = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.MaxRenderingResolution"));
if (ViewStatus == EViewStatusForScreenPercentage::PathTracer)
{
Mode = EScreenPercentageMode(FMath::Clamp(CVarEditorViewportDefaultScreenPercentagePathTracerMode->GetInt(), 0, 2));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:306
Scope: file
Source code excerpt:
unimplemented();
}
GlobalResolutionFraction = GetResolutionFraction(CVarEditorViewportDefaultScreenPercentage->GetInt());
MinRenderingResolution = CVarEditorViewportDefaultMinRenderingResolution->GetInt();
MaxRenderingResolution = CVarEditorViewportDefaultMaxRenderingResolution->GetInt();
}
#else
{
unimplemented();