r.Translucency.DynamicRes.MaxScreenPercentage

r.Translucency.DynamicRes.MaxScreenPercentage

#Overview

name: r.Translucency.DynamicRes.MaxScreenPercentage

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.Translucency.DynamicRes.MaxScreenPercentage is to set the maximum screen percentage for dynamic resolution scaling of translucency rendering in Unreal Engine 5. This setting is part of the rendering system, specifically targeting the translucency pass.

This setting variable is primarily used in the Renderer module of Unreal Engine 5, as evidenced by its location in the TranslucentRendering.cpp file.

The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value derived from DynamicRenderScaling::FHeuristicSettings::kDefaultMaxResolutionFraction, converted to a percentage.

The variable interacts closely with other translucency-related settings, such as CVarTranslucencyMinScreenPercentage, CVarTranslucencyTimeBudget, and others within the same dynamic resolution scaling system for translucency.

Developers should be aware that this variable affects the upper limit of resolution for translucent objects when dynamic resolution scaling is in effect. It’s part of a performance optimization system that can scale the resolution of translucent objects separately from the main scene.

Best practices when using this variable include:

  1. Balancing it with the minimum screen percentage to ensure a good range for dynamic scaling.
  2. Considering its impact on visual quality versus performance, especially on lower-end hardware.
  3. Testing thoroughly across different hardware configurations to ensure optimal settings.

Regarding the associated variable CVarTranslucencyMaxScreenPercentage:

This is the actual console variable that stores and provides access to the r.Translucency.DynamicRes.MaxScreenPercentage setting. It’s defined as a TAutoConsoleVariable, which means it’s a float value that can be changed at runtime through the console.

The purpose of CVarTranslucencyMaxScreenPercentage is to provide a programmatic interface to get and set the maximum screen percentage for translucency dynamic resolution scaling.

This variable is used within the Renderer module, specifically in the function GetDynamicTranslucencyResolutionSettings, where it’s used to configure the dynamic resolution settings for translucency.

The value of CVarTranslucencyMaxScreenPercentage is typically set through the console or configuration files, but it can also be modified programmatically if needed.

When using CVarTranslucencyMaxScreenPercentage, developers should:

  1. Access its value using the GetValueOnAnyThread() method when needed in rendering code.
  2. Be aware that changes to this value will affect the upper bound of translucency resolution scaling.
  3. Consider the interaction between this and other related variables when tuning performance and visual quality.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:56

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarTranslucencyMaxScreenPercentage(
	TEXT("r.Translucency.DynamicRes.MaxScreenPercentage"),
	DynamicRenderScaling::FractionToPercentage(DynamicRenderScaling::FHeuristicSettings::kDefaultMaxResolutionFraction),
	TEXT("Maximal screen percentage for translucency."),
	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<float> CVarTranslucencyTimeBudget(
	TEXT("r.Translucency.DynamicRes.TimeBudget"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:55

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<float> CVarTranslucencyMaxScreenPercentage(
	TEXT("r.Translucency.DynamicRes.MaxScreenPercentage"),
	DynamicRenderScaling::FractionToPercentage(DynamicRenderScaling::FHeuristicSettings::kDefaultMaxResolutionFraction),
	TEXT("Maximal screen percentage for translucency."),
	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<float> CVarTranslucencyTimeBudget(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:117

Scope (from outer to inner):

file
function     DynamicRenderScaling::FHeuristicSettings GetDynamicTranslucencyResolutionSettings

Source code excerpt:

	BucketSetting.bModelScalesWithPrimaryScreenPercentage = CVarTranslucencyScreenPercentageBasis.GetValueOnAnyThread() != 1;
	BucketSetting.MinResolutionFraction = DynamicRenderScaling::GetPercentageCVarToFraction(CVarTranslucencyMinScreenPercentage);
	BucketSetting.MaxResolutionFraction = DynamicRenderScaling::GetPercentageCVarToFraction(CVarTranslucencyMaxScreenPercentage);
	BucketSetting.BudgetMs              = CVarTranslucencyTimeBudget.GetValueOnAnyThread();
	BucketSetting.ChangeThreshold       = DynamicRenderScaling::GetPercentageCVarToFraction(CVarTranslucencyChangeThreshold);
	BucketSetting.TargetedHeadRoom      = DynamicRenderScaling::GetPercentageCVarToFraction(CVarTranslucencyTargetedHeadRoomPercentage);
	BucketSetting.UpperBoundQuantization = CVarTranslucencyUpperBoundQuantization.GetValueOnAnyThread();
	return BucketSetting;
}