r.Upscale.Quality

r.Upscale.Quality

#Overview

name: r.Upscale.Quality

The value of this variable can be defined or overridden in .ini config files. 5 .ini config files 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.Upscale.Quality is to define the quality level for upscaling in the rendering system, specifically for ScreenPercentage and WindowedFullscreen scaling of 3D rendering.

This setting variable is primarily used in the Renderer module of Unreal Engine, particularly in the post-processing subsystem. It’s referenced in the PostProcessUpscale.cpp file, which handles upscaling operations.

The value of this variable is set through a console variable (CVarUpscaleQuality) with a default value of 3. It can be changed at runtime through console commands or programmatically.

The associated variable CVarUpscaleQuality directly interacts with r.Upscale.Quality. They share the same value and purpose.

Developers must be aware that this variable affects the visual quality and performance of the upscaling process. Higher quality settings may result in better visual results but could impact performance.

Best practices when using this variable include:

  1. Choosing an appropriate quality level based on the target hardware and performance requirements.
  2. Testing different quality levels to find the best balance between visual quality and performance for your specific use case.
  3. Considering the impact on different display resolutions and scaling scenarios.

Regarding the associated variable CVarUpscaleQuality:

The purpose of CVarUpscaleQuality is to provide a programmatic interface to control the r.Upscale.Quality setting.

It’s used in the Renderer module, specifically in the GetUpscaleMethod() function, which determines the upscale method based on the current value of CVarUpscaleQuality.

The value is set when the TAutoConsoleVariable is initialized, but can be changed at runtime using console commands or through C++ code.

CVarUpscaleQuality directly interacts with r.Upscale.Quality, as they represent the same setting.

Developers should be aware that changes to CVarUpscaleQuality will immediately affect the upscaling method used in the renderer.

Best practices for using CVarUpscaleQuality include:

  1. Using it to dynamically adjust upscaling quality based on runtime conditions or user preferences.
  2. Clamping the value to ensure it remains within the valid range (0 to 3, or the maximum supported by EUpscaleMethod).
  3. Considering the performance implications when changing this value during gameplay.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:403, section: [PostProcessQuality@0]

Location: <Workspace>/Engine/Config/BaseScalability.ini:423, section: [PostProcessQuality@1]

Location: <Workspace>/Engine/Config/BaseScalability.ini:456, section: [PostProcessQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:491, section: [PostProcessQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:529, section: [PostProcessQuality@Cine]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessUpscale.cpp:42

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<int32> CVarUpscaleQuality(
	TEXT("r.Upscale.Quality"),
	3,
	TEXT("Defines the quality in which ScreenPercentage and WindowedFullscreen scales the 3d rendering.\n")
	TEXT(" 0: Nearest filtering\n")
	TEXT(" 1: Simple Bilinear\n")
	TEXT(" 2: Directional blur with unsharp mask upsample.\n")
	TEXT(" 3: 5-tap Catmull-Rom bicubic, approximating Lanczos 2. (default)\n")

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessUpscale.cpp:41

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarUpscaleQuality(
	TEXT("r.Upscale.Quality"),
	3,
	TEXT("Defines the quality in which ScreenPercentage and WindowedFullscreen scales the 3d rendering.\n")
	TEXT(" 0: Nearest filtering\n")
	TEXT(" 1: Simple Bilinear\n")
	TEXT(" 2: Directional blur with unsharp mask upsample.\n")

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessUpscale.cpp:163

Scope (from outer to inner):

file
function     EUpscaleMethod GetUpscaleMethod

Source code excerpt:

EUpscaleMethod GetUpscaleMethod()
{
	const int32 Value = CVarUpscaleQuality.GetValueOnRenderThread();

	return static_cast<EUpscaleMethod>(FMath::Clamp(Value, 0, static_cast<int32>(EUpscaleMethod::Gaussian)));
}

// static
FScreenPassTexture ISpatialUpscaler::AddDefaultUpscalePass(