r.ManyLights.Temporal.MaxFramesAccumulated
r.ManyLights.Temporal.MaxFramesAccumulated
#Overview
name: r.ManyLights.Temporal.MaxFramesAccumulated
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Max history length when accumulating frames. Lower values have less ghosting, but more noise.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ManyLights.Temporal.MaxFramesAccumulated is to control the maximum number of frames accumulated in the temporal history for the Many Lights rendering system in Unreal Engine 5. This setting is specifically used for managing the trade-off between reducing ghosting artifacts and minimizing noise in the rendered image.
This setting variable is primarily used by the Renderer module, specifically within the Many Lights rendering system. Based on the callsites, it’s clear that this variable is utilized in the FDeferredShadingSceneRenderer class, which is responsible for deferred shading calculations.
The value of this variable is set through a console variable (CVar) system, allowing it to be modified at runtime. The default value is set to 8 frames, as seen in the source code.
The associated variable CVarManyLightsTemporalMaxFramesAccumulated directly interacts with r.ManyLights.Temporal.MaxFramesAccumulated. They share the same value and purpose.
Developers should be aware that:
- Lower values will result in less ghosting artifacts but more noise in the final image.
- Higher values will produce smoother results but may introduce more ghosting.
- The value is clamped to be non-negative in the code (FMath::Max(…, 0.0f)).
Best practices when using this variable include:
- Adjusting the value based on the specific needs of the scene and the desired balance between image stability and responsiveness to changes.
- Testing different values to find the optimal setting for your particular use case.
- Considering the performance impact of higher values, as they may require more memory to store the temporal history.
Regarding the associated variable CVarManyLightsTemporalMaxFramesAccumulated:
- Its purpose is identical to r.ManyLights.Temporal.MaxFramesAccumulated.
- It’s used in the Renderer module, specifically in the Many Lights system.
- The value is set through the console variable system.
- It directly interacts with r.ManyLights.Temporal.MaxFramesAccumulated, serving as the actual storage for the setting.
- Developers should be aware that modifying this variable will directly affect the Many Lights rendering system’s temporal accumulation behavior.
- Best practices include using the r.ManyLights.Temporal.MaxFramesAccumulated console command to modify this value rather than directly manipulating the C++ variable, as this ensures proper synchronization and thread safety.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLights.cpp:47
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarManyLightsTemporalMaxFramesAccumulated(
TEXT("r.ManyLights.Temporal.MaxFramesAccumulated"),
8,
TEXT("Max history length when accumulating frames. Lower values have less ghosting, but more noise."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<float> CVarManyLightsTemporalNeighborhoodClampScale(
#Associated Variable and Callsites
This variable is associated with another variable named CVarManyLightsTemporalMaxFramesAccumulated
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLights.cpp:46
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarManyLightsTemporalMaxFramesAccumulated(
TEXT("r.ManyLights.Temporal.MaxFramesAccumulated"),
8,
TEXT("Max history length when accumulating frames. Lower values have less ghosting, but more noise."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLights.cpp:762
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderManyLights
Source code excerpt:
ManyLightsParameters.TileDataStride = TileDataStride;
ManyLightsParameters.DownsampledTileDataStride = DownsampledTileDataStride;
ManyLightsParameters.TemporalMaxFramesAccumulated = FMath::Max(CVarManyLightsTemporalMaxFramesAccumulated.GetValueOnRenderThread(), 0.0f);
ManyLightsParameters.TemporalNeighborhoodClampScale = CVarManyLightsTemporalNeighborhoodClampScale.GetValueOnRenderThread();
ManyLightsParameters.TemporalAdvanceFrame = View.ViewState && !View.bStatePrevViewInfoIsReadOnly ? 1 : 0;
ManyLightsParameters.DebugMode = ManyLights::GetDebugMode();
ManyLightsParameters.DebugLightId = INDEX_NONE;
if (bDebug)