r.Translucency.DynamicRes.TimeBudget

r.Translucency.DynamicRes.TimeBudget

#Overview

name: r.Translucency.DynamicRes.TimeBudget

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.TimeBudget is to set the frame’s time budget for translucency rendering in milliseconds. This setting variable is part of Unreal Engine’s dynamic resolution system for translucent rendering.

This setting variable is primarily used in the Renderer module of Unreal Engine, specifically in the translucent rendering subsystem. Based on the callsites, it’s clear that this variable is used to configure the dynamic resolution settings for translucency.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of DynamicRenderScaling::FHeuristicSettings::kBudgetMsDisabled, which suggests that it’s disabled by default.

The associated variable CVarTranslucencyTimeBudget interacts directly with r.Translucency.DynamicRes.TimeBudget. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the performance and quality of translucent rendering. Setting a lower time budget may improve performance but could potentially reduce the quality of translucent effects.

Best practices when using this variable include:

  1. Carefully balancing performance and visual quality.
  2. Testing different values to find the optimal setting for your specific game or application.
  3. Considering the target hardware capabilities when setting this value.
  4. Using it in conjunction with other translucency-related settings for best results.

Regarding the associated variable CVarTranslucencyTimeBudget:

The purpose of CVarTranslucencyTimeBudget is to provide a programmatic way to access and modify the r.Translucency.DynamicRes.TimeBudget setting within the C++ code.

This variable is used in the Renderer module, specifically in the function GetDynamicTranslucencyResolutionSettings, which suggests it’s part of the dynamic resolution system for translucency.

The value of CVarTranslucencyTimeBudget is set through the CVar system and can be accessed using the GetValueOnAnyThread() method.

CVarTranslucencyTimeBudget interacts directly with r.Translucency.DynamicRes.TimeBudget and other translucency-related settings in the dynamic resolution system.

Developers should be aware that changes to this variable will directly affect the translucency rendering performance and quality.

Best practices for using CVarTranslucencyTimeBudget include:

  1. Using it to dynamically adjust the translucency time budget based on runtime conditions.
  2. Ensuring thread-safety when accessing its value, as indicated by the ECVF_RenderThreadSafe flag.
  3. Considering the impact on overall rendering performance when modifying this value.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarTranslucencyTimeBudget(
	TEXT("r.Translucency.DynamicRes.TimeBudget"),
	DynamicRenderScaling::FHeuristicSettings::kBudgetMsDisabled,
	TEXT("Frame's time budget for translucency rendering in milliseconds."),
	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<float> CVarTranslucencyTargetedHeadRoomPercentage(
	TEXT("r.Translucency.DynamicRes.TargetedHeadRoomPercentage"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<float> CVarTranslucencyTimeBudget(
	TEXT("r.Translucency.DynamicRes.TimeBudget"),
	DynamicRenderScaling::FHeuristicSettings::kBudgetMsDisabled,
	TEXT("Frame's time budget for translucency rendering in milliseconds."),
	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<float> CVarTranslucencyTargetedHeadRoomPercentage(

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

Scope (from outer to inner):

file
function     DynamicRenderScaling::FHeuristicSettings GetDynamicTranslucencyResolutionSettings

Source code excerpt:

	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;
}