r.Editor.Viewport.ScreenPercentageMode.Mobile

r.Editor.Viewport.ScreenPercentageMode.Mobile

#Overview

name: r.Editor.Viewport.ScreenPercentageMode.Mobile

This variable is created as a Console Variable (cvar).

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Editor.Viewport.ScreenPercentageMode.Mobile is to control the default screen percentage mode for realtime editor viewports using the mobile renderer in Unreal Engine 5.

This setting variable is primarily used by the editor’s viewport system, specifically for mobile rendering. It’s part of the UnrealEd module, which is responsible for the Unreal Engine editor functionality.

The value of this variable is set in multiple places:

  1. It’s initialized with a default value of EScreenPercentageMode::BasedOnDPIScale when the console variable is created.
  2. It can be set through project settings in the UEditorPerformanceProjectSettings class.
  3. It can be overridden by user settings in the UEditorPerformanceSettings class.

This variable interacts closely with other screen percentage mode variables for different rendering scenarios (realtime, VR, path tracing, non-realtime). It’s part of a group of settings that control viewport rendering quality and performance.

Developers should be aware that:

  1. This setting specifically affects mobile rendering in the editor viewport.
  2. It’s part of a larger system of screen percentage controls, and changes to this variable should be considered in the context of other rendering settings.
  3. The value can be overridden by both project and user settings, so the actual applied value may differ from the default.

Best practices when using this variable include:

  1. Consider the target mobile devices when adjusting this setting.
  2. Balance between performance and visual quality, especially for mobile rendering which may have more constraints.
  3. Test the impact of changes across various mobile devices to ensure consistent results.

Regarding the associated variable CVarEditorViewportDefaultMobileScreenPercentageMode:

When working with either of these variables, it’s important to consider the overall impact on mobile rendering performance and quality in the editor viewport.

#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:16

Scope: file

Source code excerpt:


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."),
	ECVF_Default);

TAutoConsoleVariable<int32> CVarEditorViewportDefaultVRScreenPercentageMode(
	TEXT("r.Editor.Viewport.ScreenPercentageMode.VR"), int32(EScreenPercentageMode::Manual),
	TEXT("Controls the default screen percentage mode for VR editor viewports."),

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/SCommonEditorViewportToolbarBase.cpp:195

Scope (from outer to inner):

file
function     static FFormatNamedArguments GetScreenPercentageFormatArguments

Source code excerpt:

{
	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>();
	const UEditorPerformanceSettings* EditorUserSettings = GetDefault<UEditorPerformanceSettings>();

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

Scope: file

Source code excerpt:

{
	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"));
	static auto CVarEditorViewportDefaultMaxRenderingResolution = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Editor.Viewport.MaxRenderingResolution"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:15

Scope: file

Source code excerpt:

	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."),
	ECVF_Default);

TAutoConsoleVariable<int32> CVarEditorViewportDefaultVRScreenPercentageMode(
	TEXT("r.Editor.Viewport.ScreenPercentageMode.VR"), int32(EScreenPercentageMode::Manual),

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:291

Scope (from outer to inner):

file
function     void UEditorPerformanceProjectSettings::ExportResolutionValuesToConsoleVariables

Source code excerpt:


		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);
		CVarEditorViewportDefaultMaxRenderingResolution->Set(EditorProjectSettings->MaxViewportRenderingResolution, ECVF_SetByProjectSetting);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:323

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