r.Reflections.Denoiser.ReconstructionSamples
r.Reflections.Denoiser.ReconstructionSamples
#Overview
name: r.Reflections.Denoiser.ReconstructionSamples
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Maximum number of samples for the reconstruction pass (default = 8).
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Reflections.Denoiser.ReconstructionSamples is to control the maximum number of samples used in the reconstruction pass of the reflection denoiser in Unreal Engine’s rendering system.
This setting variable is primarily used by the rendering subsystem, specifically in the screen space denoising module. It’s part of the ray tracing and reflection rendering pipeline.
The value of this variable is set through a console variable (CVarReflectionReconstructionSampleCount) with a default value of 8. It can be changed at runtime through console commands or project settings.
The associated variable CVarReflectionReconstructionSampleCount directly interacts with r.Reflections.Denoiser.ReconstructionSamples. They essentially represent the same setting, with the CVar being the programmatic interface to access and modify the value.
Developers should be aware that this variable affects the quality and performance of reflection denoising. A higher value will potentially produce better quality reflections but at the cost of increased computational overhead.
Best practices when using this variable include:
- Balancing between visual quality and performance based on target hardware.
- Testing different values to find the optimal setting for specific scenes or use cases.
- Considering adjusting this in conjunction with other reflection and denoising settings for best results.
Regarding the associated variable CVarReflectionReconstructionSampleCount:
This is an auto console variable of type int32, which allows for easy runtime modification and access of the r.Reflections.Denoiser.ReconstructionSamples setting. It’s used in the DenoiseReflections and DenoiseWaterReflections functions of the FDefaultScreenSpaceDenoiser class to set the ReconstructionSamples parameter of the denoising settings.
Developers should note that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag. This means that modifications will be applied safely without causing threading issues in the rendering pipeline.
When working with CVarReflectionReconstructionSampleCount, developers can use GetValueOnRenderThread() to retrieve its current value within render thread operations. This ensures that the most up-to-date setting is always used in the denoising process.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:52
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarReflectionReconstructionSampleCount(
TEXT("r.Reflections.Denoiser.ReconstructionSamples"), 8,
TEXT("Maximum number of samples for the reconstruction pass (default = 8)."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarReflectionPreConvolutionCount(
TEXT("r.Reflections.Denoiser.PreConvolution"), 1,
TEXT("Number of pre-convolution passes (default = 1)."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarReflectionReconstructionSampleCount
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:51
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarReflectionReconstructionSampleCount(
TEXT("r.Reflections.Denoiser.ReconstructionSamples"), 8,
TEXT("Maximum number of samples for the reconstruction pass (default = 8)."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarReflectionPreConvolutionCount(
TEXT("r.Reflections.Denoiser.PreConvolution"), 1,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:2559
Scope (from outer to inner):
file
class class FDefaultScreenSpaceDenoiser : public IScreenSpaceDenoiser
function FReflectionsOutputs DenoiseReflections
Source code excerpt:
Settings.SignalProcessing = ESignalProcessing::Reflections;
Settings.InputResolutionFraction = RayTracingConfig.ResolutionFraction;
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;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:2608
Scope (from outer to inner):
file
class class FDefaultScreenSpaceDenoiser : public IScreenSpaceDenoiser
function FReflectionsOutputs DenoiseWaterReflections
Source code excerpt:
Settings.SignalProcessing = ESignalProcessing::Reflections; // TODO: water reflection to denoise only water pixels
Settings.InputResolutionFraction = RayTracingConfig.ResolutionFraction;
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;