r.DynamicRes.MinResolutionChangePeriod
r.DynamicRes.MinResolutionChangePeriod
#Overview
name: r.DynamicRes.MinResolutionChangePeriod
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Minimal number of frames between resolution changes, important to avoid input sample position interferences in TAA upsample.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DynamicRes.MinResolutionChangePeriod is to control the minimum number of frames that must pass between resolution changes in Unreal Engine’s dynamic resolution system. This setting is crucial for maintaining visual stability and avoiding artifacts in temporal anti-aliasing (TAA) upsampling.
This setting variable is primarily used in the rendering system, specifically in the dynamic resolution subsystem of Unreal Engine 5. Based on the callsites, it’s clear that this variable is utilized within the Engine module, particularly in the DynamicResolution.cpp file.
The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It’s initialized with a default value of 8 frames, but can be changed during runtime or through configuration files.
The variable interacts closely with the associated variable CVarFrameChangePeriod, which directly references the console variable. This associated variable is used to retrieve the current value of the setting in the render thread.
Developers must be aware that changing this value too frequently or setting it too low can lead to visual instability or artifacts, especially when using temporal anti-aliasing. It’s important to balance between responsiveness of the dynamic resolution system and visual quality.
Best practices when using this variable include:
- Avoid setting it too low, as rapid resolution changes can cause noticeable visual disruptions.
- Consider the relationship between this setting and the game’s target frame rate.
- Test thoroughly with different values to find the optimal balance between performance and visual stability for your specific game.
Regarding the associated variable CVarFrameChangePeriod:
- Its purpose is to provide a thread-safe way to access the value of r.DynamicRes.MinResolutionChangePeriod in the render thread.
- It’s used within the FDynamicResolutionHeuristicProxy class to determine if a resolution change is allowed based on the number of frames since the last change.
- The value is retrieved using the GetValueOnRenderThread() method, ensuring thread-safe access in the render thread.
- Developers should be aware that this variable directly reflects the console variable and should be used when accessing the setting in render thread operations.
- Best practice is to use this variable instead of directly accessing the console variable in render thread code to ensure thread safety and proper engine integration.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:103
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarFrameChangePeriod(
TEXT("r.DynamicRes.MinResolutionChangePeriod"),
8,
TEXT("Minimal number of frames between resolution changes, important to avoid input ")
TEXT("sample position interferences in TAA upsample."),
ECVF_RenderThreadSafe | ECVF_Default);
static TAutoConsoleVariable<float> CVarIncreaseAmortizationFactor(
#Associated Variable and Callsites
This variable is associated with another variable named CVarFrameChangePeriod
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:102
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Default);
static TAutoConsoleVariable<int32> CVarFrameChangePeriod(
TEXT("r.DynamicRes.MinResolutionChangePeriod"),
8,
TEXT("Minimal number of frames between resolution changes, important to avoid input ")
TEXT("sample position interferences in TAA upsample."),
ECVF_RenderThreadSafe | ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:277
Scope (from outer to inner):
file
function void FDynamicResolutionHeuristicProxy::RefreshCurrentFrameResolutionFraction_RenderThread
Source code excerpt:
const int32 MaxConsecutiveOverBudgetGPUFrameCount = FMath::Max(CVarMaxConsecutiveOverBudgetGPUFrameCount.GetValueOnRenderThread(), 2);
const bool bCanChangeResolution = NumberOfFramesSinceScreenPercentageChange >= CVarFrameChangePeriod.GetValueOnRenderThread();
#if COMPILE_DYNAMIC_FRAME_TIME
float MinGlobalFrameTime = 0.0f;
if (CVarDynamicFrameTimeEnable.GetValueOnRenderThread())
{
static const IConsoleVariable* VSyncCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.VSync"));