r.Tonemapper.Quality

r.Tonemapper.Quality

#Overview

name: r.Tonemapper.Quality

The value of this variable can be defined or overridden in .ini config files. 13 .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.Tonemapper.Quality is to control the quality of the tonemapping process in Unreal Engine’s rendering pipeline. Tonemapping is a crucial step in post-processing that maps high dynamic range (HDR) colors to a lower dynamic range suitable for display devices.

This setting variable is primarily used by the rendering system, specifically the post-processing subsystem of Unreal Engine. It’s referenced in the SceneView.cpp file, which is part of the Engine module.

The value of this variable is set through a console variable (CVar) named CVarTonemapperQuality. It’s initialized with a default value of 5, which represents the highest quality setting. The value can be changed at runtime through console commands or programmatically.

The CVarTonemapperQuality interacts directly with r.Tonemapper.Quality, as they share the same value. This variable affects the shader permutations used for tonemapping, with higher values enabling more features.

Developers should be aware that:

  1. The quality setting ranges from 0 to 5.
  2. Lower quality settings may result in faster performance but fewer visual features.
  3. The quality setting affects which post-processing effects are enabled:
    • 0: Only basic tonemapping (lowest quality)
    • 2: Adds vignette effect
    • 4: Adds film grain effect
    • 5: Highest quality (default)

Best practices when using this variable include:

  1. Consider performance implications when setting higher quality levels.
  2. Use lower quality settings for performance-critical scenarios or on less powerful hardware.
  3. Test visual quality at different settings to find the right balance between performance and visual fidelity.

Regarding the associated variable CVarTonemapperQuality:

The purpose of CVarTonemapperQuality is to provide a console-accessible way to control the r.Tonemapper.Quality setting. It’s a TAutoConsoleVariable that directly corresponds to the r.Tonemapper.Quality setting.

This variable is used in the Engine module, specifically within the post-processing and scene view systems. Its value is set at engine initialization but can be modified at runtime through console commands.

CVarTonemapperQuality interacts directly with r.Tonemapper.Quality, as they represent the same setting. It’s also used in the FSceneView::EndFinalPostprocessSettings function to adjust post-processing settings based on the quality level.

Developers should be aware that changes to CVarTonemapperQuality will immediately affect the tonemapper quality. They should also note that certain post-processing effects may be disabled at lower quality settings.

Best practices for using CVarTonemapperQuality include:

  1. Use it for dynamic quality adjustments during gameplay or in response to performance metrics.
  2. Consider exposing it as a user-configurable setting for players to balance performance and visual quality.
  3. Be cautious when modifying it frequently, as it may cause visual inconsistencies if changed too rapidly.

#Setting Variables

#References In INI files

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

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

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

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

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

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:89, section: [PostProcessQuality@0]

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:99, section: [PostProcessQuality@1]

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:109, section: [PostProcessQuality@2]

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:119, section: [PostProcessQuality@3]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:89, section: [PostProcessQuality@0]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:99, section: [PostProcessQuality@1]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:109, section: [PostProcessQuality@2]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:119, section: [PostProcessQuality@3]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:269

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarTonemapperQuality(
	TEXT("r.Tonemapper.Quality"),
	5,
	TEXT("Defines the Tonemapper Quality in the range 0..5\n")
	TEXT("Depending on the used settings we might pick a faster shader permutation\n")
	TEXT(" 0: basic tonemapper only, lowest quality\n")
	TEXT(" 2: + Vignette\n")
	TEXT(" 4: + Grain\n")

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:268

Scope: file

Source code excerpt:

	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarTonemapperQuality(
	TEXT("r.Tonemapper.Quality"),
	5,
	TEXT("Defines the Tonemapper Quality in the range 0..5\n")
	TEXT("Depending on the used settings we might pick a faster shader permutation\n")
	TEXT(" 0: basic tonemapper only, lowest quality\n")
	TEXT(" 2: + Vignette\n")

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:2084

Scope (from outer to inner):

file
function     void FSceneView::EndFinalPostprocessSettings

Source code excerpt:

	// scale down tone mapper shader permutation
	{
		int32 Quality = CVarTonemapperQuality.GetValueOnGameThread();

		if(Quality < 2)
		{
			FinalPostProcessSettings.VignetteIntensity = 0;
		}