r.Reflections.Denoiser.TemporalAccumulation
r.Reflections.Denoiser.TemporalAccumulation
#Overview
name: r.Reflections.Denoiser.TemporalAccumulation
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Accumulates the samples over multiple frames.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Reflections.Denoiser.TemporalAccumulation is to control the temporal accumulation of samples for the reflections denoiser in Unreal Engine 5’s rendering system. This setting variable is used to improve the quality of reflections by accumulating samples over multiple frames, which can help reduce noise and improve overall image quality.
This setting variable is primarily used in the rendering system, specifically in the screen space denoising subsystem. It is part of the reflections denoising process, which is crucial for improving the visual quality of reflections in real-time rendering.
The value of this variable is set through a console variable (CVarReflectionTemporalAccumulation) in the ScreenSpaceDenoise.cpp file. It is initialized with a default value of 1, which means temporal accumulation is enabled by default.
The associated variable CVarReflectionTemporalAccumulation interacts directly with r.Reflections.Denoiser.TemporalAccumulation. This console variable is used to access and modify the setting’s value at runtime.
Developers should be aware that this variable affects the performance-quality trade-off in reflection rendering. Enabling temporal accumulation (value set to 1) can improve reflection quality but may have a slight performance impact. Disabling it (value set to 0) might improve performance at the cost of potentially noisier reflections.
Best practices when using this variable include:
- Testing different values to find the optimal balance between performance and visual quality for your specific project.
- Considering the target hardware when deciding whether to enable or disable temporal accumulation.
- Using it in conjunction with other reflection and denoising settings for best results.
Regarding the associated variable CVarReflectionTemporalAccumulation:
- It is a TAutoConsoleVariable
used to control the r.Reflections.Denoiser.TemporalAccumulation setting. - It is defined in the ScreenSpaceDenoise.cpp file and is used to get the current value of the setting in the rendering thread.
- The variable is accessed in the DenoiseReflections and DenoiseWaterReflections functions of the FDefaultScreenSpaceDenoiser class to determine whether temporal accumulation should be used in the denoising process.
- Developers can modify this variable at runtime using console commands, allowing for dynamic adjustment of the reflection denoising behavior.
When working with CVarReflectionTemporalAccumulation, developers should be mindful of its impact on both regular reflections and water reflections, as it is used in the denoising process for both types of reflections.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:62
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarReflectionTemporalAccumulation(
TEXT("r.Reflections.Denoiser.TemporalAccumulation"), 1,
TEXT("Accumulates the samples over multiple frames."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarAOReconstructionSampleCount(
TEXT("r.AmbientOcclusion.Denoiser.ReconstructionSamples"), 16,
TEXT("Maximum number of samples for the reconstruction pass (default = 16)."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarReflectionTemporalAccumulation
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:61
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarReflectionTemporalAccumulation(
TEXT("r.Reflections.Denoiser.TemporalAccumulation"), 1,
TEXT("Accumulates the samples over multiple frames."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarAOReconstructionSampleCount(
TEXT("r.AmbientOcclusion.Denoiser.ReconstructionSamples"), 16,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:2561
Scope (from outer to inner):
file
class class FDefaultScreenSpaceDenoiser : public IScreenSpaceDenoiser
function FReflectionsOutputs DenoiseReflections
Source code excerpt:
Settings.ReconstructionSamples = CVarReflectionReconstructionSampleCount.GetValueOnRenderThread();
Settings.PreConvolutionCount = CVarReflectionPreConvolutionCount.GetValueOnRenderThread();
Settings.bUseTemporalAccumulation = CVarReflectionTemporalAccumulation.GetValueOnRenderThread() != 0;
Settings.MaxInputSPP = RayTracingConfig.RayCountPerPixel;
TStaticArray<FScreenSpaceDenoiserHistory*, IScreenSpaceDenoiser::kMaxBatchSize> PrevHistories;
TStaticArray<FScreenSpaceDenoiserHistory*, IScreenSpaceDenoiser::kMaxBatchSize> NewHistories;
PrevHistories[0] = &PreviousViewInfos->ReflectionsHistory;
NewHistories[0] = View.ViewState ? &View.ViewState->PrevFrameViewInfo.ReflectionsHistory : nullptr;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:2610
Scope (from outer to inner):
file
class class FDefaultScreenSpaceDenoiser : public IScreenSpaceDenoiser
function FReflectionsOutputs DenoiseWaterReflections
Source code excerpt:
Settings.ReconstructionSamples = CVarReflectionReconstructionSampleCount.GetValueOnRenderThread();
Settings.PreConvolutionCount = CVarReflectionPreConvolutionCount.GetValueOnRenderThread();
Settings.bUseTemporalAccumulation = CVarReflectionTemporalAccumulation.GetValueOnRenderThread() != 0;
Settings.MaxInputSPP = RayTracingConfig.RayCountPerPixel;
TStaticArray<FScreenSpaceDenoiserHistory*, IScreenSpaceDenoiser::kMaxBatchSize> PrevHistories;
TStaticArray<FScreenSpaceDenoiserHistory*, IScreenSpaceDenoiser::kMaxBatchSize> NewHistories;
PrevHistories[0] = &PreviousViewInfos->WaterReflectionsHistory;
NewHistories[0] = View.ViewState ? &View.ViewState->PrevFrameViewInfo.WaterReflectionsHistory : nullptr;