r.Translucency.DynamicRes.MinScreenPercentage

r.Translucency.DynamicRes.MinScreenPercentage

#Overview

name: r.Translucency.DynamicRes.MinScreenPercentage

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.MinScreenPercentage is to set the minimal screen percentage for translucency in Unreal Engine’s dynamic resolution system for rendering translucent objects.

This setting variable is primarily used in the rendering system, specifically for the dynamic resolution scaling of translucent objects. It’s part of Unreal Engine’s renderer module, as evidenced by its location in the TranslucentRendering.cpp file.

The Unreal Engine subsystem that relies on this setting variable is the renderer, particularly the translucency rendering system. It’s used in conjunction with other related variables to control the dynamic resolution scaling of translucent objects.

The value of this variable is set as a console variable (CVar) in the engine. It’s initialized with a default value derived from DynamicRenderScaling::FHeuristicSettings::kDefaultMinResolutionFraction, converted to a percentage.

This variable interacts with several other variables related to translucency rendering, such as:

Developers must be aware that this variable sets a lower bound for the screen percentage of translucent objects. It directly affects the rendering quality and performance of translucent objects in the scene.

Best practices when using this variable include:

  1. Balancing it with the MaxScreenPercentage for optimal performance and visual quality.
  2. Considering its impact on overall rendering performance, especially in scenes with many translucent objects.
  3. Testing different values to find the right balance between performance and visual quality for your specific game or application.

Regarding the associated variable CVarTranslucencyMinScreenPercentage:

The purpose of CVarTranslucencyMinScreenPercentage is to store and provide access to the r.Translucency.DynamicRes.MinScreenPercentage console variable within the C++ code.

This variable is used in the renderer module, specifically in the dynamic resolution scaling system for translucent objects.

The value of this variable is set when the console variable is initialized, and it can be changed at runtime through console commands.

CVarTranslucencyMinScreenPercentage interacts directly with the r.Translucency.DynamicRes.MinScreenPercentage console variable, essentially serving as its C++ representation.

Developers should be aware that this is an internal variable used by the engine to access the console variable’s value. It’s not intended to be modified directly in code, but rather through the console variable system.

Best practices for using this variable include:

  1. Using it to read the current value of the minimum screen percentage for translucency when needed in C++ code.
  2. Not modifying it directly, but instead changing the value through the console variable system.
  3. Being aware of its thread-safe nature (ECVF_RenderThreadSafe flag) when accessing it from different threads.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarTranslucencyMinScreenPercentage(
	TEXT("r.Translucency.DynamicRes.MinScreenPercentage"),
	DynamicRenderScaling::FractionToPercentage(DynamicRenderScaling::FHeuristicSettings::kDefaultMinResolutionFraction),
	TEXT("Minimal screen percentage for translucency."),
	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<float> CVarTranslucencyMaxScreenPercentage(
	TEXT("r.Translucency.DynamicRes.MaxScreenPercentage"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_Scalability | ECVF_Default);

static TAutoConsoleVariable<float> CVarTranslucencyMinScreenPercentage(
	TEXT("r.Translucency.DynamicRes.MinScreenPercentage"),
	DynamicRenderScaling::FractionToPercentage(DynamicRenderScaling::FHeuristicSettings::kDefaultMinResolutionFraction),
	TEXT("Minimal screen percentage for translucency."),
	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<float> CVarTranslucencyMaxScreenPercentage(

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

Scope (from outer to inner):

file
function     DynamicRenderScaling::FHeuristicSettings GetDynamicTranslucencyResolutionSettings

Source code excerpt:

	BucketSetting.Model = DynamicRenderScaling::EHeuristicModel::Quadratic;
	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;