r.Editor.Viewport.ScreenPercentageMode.RealTime
r.Editor.Viewport.ScreenPercentageMode.RealTime
#Overview
name: r.Editor.Viewport.ScreenPercentageMode.RealTime
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Controls the default screen percentage mode for realtime editor viewports using desktop renderer.
It is referenced in 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Editor.Viewport.ScreenPercentageMode.RealTime is to control the default screen percentage mode for realtime editor viewports using the desktop renderer in Unreal Engine 5.
-
This setting variable is primarily used by the rendering system, specifically for managing screen percentage in editor viewports.
-
The Unreal Engine subsystems that rely on this variable are primarily the editor’s viewport rendering system and the engine’s screen percentage management system.
-
The value of this variable is set through a console variable (CVar) system. It’s initialized in the engine’s source code and can be modified through project settings or user preferences.
-
This variable interacts with several other related variables, such as CVarEditorViewportDefaultScreenPercentageMode, which shares the same value. It’s also part of a family of similar variables for different rendering modes (mobile, VR, path tracer, etc.).
-
Developers should be aware that this variable affects the default rendering resolution in editor viewports, which can impact performance and visual quality during development.
-
Best practices when using this variable include:
- Understanding the implications of different screen percentage modes on performance and visual quality.
- Considering the target platforms and hardware capabilities when adjusting this setting.
- Using project settings or user preferences to customize this value rather than hardcoding it.
Regarding the associated variable CVarEditorViewportDefaultScreenPercentageMode:
-
Its purpose is similar to r.Editor.Viewport.ScreenPercentageMode.RealTime, but it’s used for non-realtime editor viewports.
-
This variable is used in the same subsystems as the main variable, primarily in the editor’s viewport rendering system.
-
Its value is set and modified in the same way as the main variable, through the CVar system and project/user settings.
-
It interacts with the same family of screen percentage mode variables for different rendering scenarios.
-
Developers should be aware that this variable affects non-realtime viewports, which may have different performance considerations compared to realtime viewports.
-
Best practices for this variable are similar to those for the main variable, with an additional consideration for the specific needs of non-realtime rendering scenarios in the editor.
#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:11
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarEditorViewportDefaultScreenPercentageMode(
TEXT("r.Editor.Viewport.ScreenPercentageMode.RealTime"), int32(EScreenPercentageMode::BasedOnDisplayResolution),
TEXT("Controls the default screen percentage mode for realtime editor viewports using desktop renderer."),
ECVF_Default);
TAutoConsoleVariable<int32> CVarEditorViewportDefaultMobileScreenPercentageMode(
TEXT("r.Editor.Viewport.ScreenPercentageMode.Mobile"), int32(EScreenPercentageMode::BasedOnDPIScale),
TEXT("Controls the default screen percentage mode for realtime editor viewports using mobile renderer."),
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SCommonEditorViewportToolbarBase.cpp:194
Scope (from outer to inner):
file
function static FFormatNamedArguments GetScreenPercentageFormatArguments
Source code excerpt:
static FFormatNamedArguments GetScreenPercentageFormatArguments(const FEditorViewportClient& ViewportClient)
{
static auto CVarEditorViewportDefaultScreenPercentageRealTimeMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.RealTime"));
static auto CVarEditorViewportDefaultScreenPercentageMobileMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.Mobile"));
static auto CVarEditorViewportDefaultScreenPercentageVRMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.VR"));
static auto CVarEditorViewportDefaultScreenPercentagePathTracerMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.PathTracer"));
static auto CVarEditorViewportDefaultScreenPercentageMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.NonRealTime"));
const UEditorPerformanceProjectSettings* EditorProjectSettings = GetDefault<UEditorPerformanceProjectSettings>();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:273
Scope: file
Source code excerpt:
#if WITH_EDITOR
{
static auto CVarEditorViewportDefaultScreenPercentageRealTimeMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.RealTime"));
static auto CVarEditorViewportDefaultScreenPercentageMobileMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.Mobile"));
static auto CVarEditorViewportDefaultScreenPercentageVRMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.VR"));
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"));
#Associated Variable and Callsites
This variable is associated with another variable named CVarEditorViewportDefaultScreenPercentageMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SCommonEditorViewportToolbarBase.cpp:198
Scope (from outer to inner):
file
function static FFormatNamedArguments GetScreenPercentageFormatArguments
Source code excerpt:
static auto CVarEditorViewportDefaultScreenPercentageVRMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.VR"));
static auto CVarEditorViewportDefaultScreenPercentagePathTracerMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.PathTracer"));
static auto CVarEditorViewportDefaultScreenPercentageMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.NonRealTime"));
const UEditorPerformanceProjectSettings* EditorProjectSettings = GetDefault<UEditorPerformanceProjectSettings>();
const UEditorPerformanceSettings* EditorUserSettings = GetDefault<UEditorPerformanceSettings>();
const FEngineShowFlags& EngineShowFlags = ViewportClient.EngineShowFlags;
const EViewStatusForScreenPercentage ViewportRenderingMode = ViewportClient.GetViewStatusForScreenPercentage();
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SCommonEditorViewportToolbarBase.cpp:249
Scope (from outer to inner):
file
function static FFormatNamedArguments GetScreenPercentageFormatArguments
Source code excerpt:
ProjectSetting = EditorProjectSettings->NonRealtimeScreenPercentageMode;
UserPreference = EditorUserSettings->NonRealtimeScreenPercentageMode;
CVarDefaultScreenPercentage = CVarEditorViewportDefaultScreenPercentageMode;
}
else
{
unimplemented();
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:10
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarEditorViewportDefaultScreenPercentageMode(
TEXT("r.Editor.Viewport.ScreenPercentageMode.RealTime"), int32(EScreenPercentageMode::BasedOnDisplayResolution),
TEXT("Controls the default screen percentage mode for realtime editor viewports using desktop renderer."),
ECVF_Default);
TAutoConsoleVariable<int32> CVarEditorViewportDefaultMobileScreenPercentageMode(
TEXT("r.Editor.Viewport.ScreenPercentageMode.Mobile"), int32(EScreenPercentageMode::BasedOnDPIScale),
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:290
Scope (from outer to inner):
file
function void UEditorPerformanceProjectSettings::ExportResolutionValuesToConsoleVariables
Source code excerpt:
const UEditorPerformanceProjectSettings* EditorProjectSettings = GetDefault<UEditorPerformanceProjectSettings>();
CVarEditorViewportDefaultScreenPercentageMode->Set(int32(EditorProjectSettings->RealtimeScreenPercentageMode), ECVF_SetByProjectSetting);
CVarEditorViewportDefaultMobileScreenPercentageMode->Set(int32(EditorProjectSettings->MobileScreenPercentageMode), ECVF_SetByProjectSetting);
CVarEditorViewportDefaultVRScreenPercentageMode->Set(int32(EditorProjectSettings->VRScreenPercentageMode), ECVF_SetByProjectSetting);
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);
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:322
Scope (from outer to inner):
file
function void UEditorPerformanceProjectSettings::ExportResolutionValuesToConsoleVariables
Source code excerpt:
};
OverrideCVarModeWithEditorUserSettings(CVarEditorViewportDefaultScreenPercentageMode, EditorUserSettings->RealtimeScreenPercentageMode);
OverrideCVarModeWithEditorUserSettings(CVarEditorViewportDefaultMobileScreenPercentageMode, EditorUserSettings->MobileScreenPercentageMode);
OverrideCVarModeWithEditorUserSettings(CVarEditorViewportDefaultVRScreenPercentageMode, EditorUserSettings->VRScreenPercentageMode);
OverrideCVarModeWithEditorUserSettings(CVarEditorViewportDefaultPathTracerScreenPercentageMode, EditorUserSettings->PathTracerScreenPercentageMode);
OverrideCVarModeWithEditorUserSettings(CVarEditorViewportNonRealtimeDefaultScreenPercentageMode, EditorUserSettings->NonRealtimeScreenPercentageMode);
if (EditorUserSettings->bOverrideManualScreenPercentage)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:277
Scope: file
Source code excerpt:
static auto CVarEditorViewportDefaultScreenPercentageVRMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.ScreenPercentageMode.VR"));
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)
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:300
Scope: file
Source code excerpt:
else if (ViewStatus == EViewStatusForScreenPercentage::NonRealtime)
{
Mode = EScreenPercentageMode(FMath::Clamp(CVarEditorViewportDefaultScreenPercentageMode->GetInt(), 0, 2));
}
else
{
unimplemented();
}
GlobalResolutionFraction = GetResolutionFraction(CVarEditorViewportDefaultScreenPercentage->GetInt());