r.AmbientOcclusion.Denoiser.ReconstructionSamples
r.AmbientOcclusion.Denoiser.ReconstructionSamples
#Overview
name: r.AmbientOcclusion.Denoiser.ReconstructionSamples
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Maximum number of samples for the reconstruction pass (default = 16).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.AmbientOcclusion.Denoiser.ReconstructionSamples is to control the maximum number of samples used in the reconstruction pass of the Ambient Occlusion (AO) denoiser in Unreal Engine 5’s rendering system.
This setting variable is primarily used within the rendering system, specifically in the screen space denoising module. It’s part of the post-processing pipeline that improves the quality of ambient occlusion effects.
The value of this variable is set through a console variable (CVarAOReconstructionSampleCount) in the ScreenSpaceDenoise.cpp file. It has a default value of 16 samples.
The associated variable CVarAOReconstructionSampleCount directly interacts with r.AmbientOcclusion.Denoiser.ReconstructionSamples. They essentially represent the same setting, with CVarAOReconstructionSampleCount being the C++ representation used in the engine code.
Developers should be aware that this variable affects the quality and performance of the ambient occlusion denoising process. A higher value will result in better quality but may impact performance.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your project, balancing quality and performance.
- Testing different values to find the optimal setting for your scene.
- Considering the target hardware when setting this value, as higher values may be more demanding on less powerful systems.
Regarding the associated variable CVarAOReconstructionSampleCount:
The purpose of CVarAOReconstructionSampleCount is to provide a programmatic way to access and modify the r.AmbientOcclusion.Denoiser.ReconstructionSamples setting within the engine’s C++ code.
This variable is used in the rendering system, specifically in the FDefaultScreenSpaceDenoiser class when denoising ambient occlusion.
The value of CVarAOReconstructionSampleCount is set when the console variable is created, but it can be modified at runtime through console commands or code.
CVarAOReconstructionSampleCount interacts directly with other denoising settings in the DenoiseAmbientOcclusion function, where it’s used to set the ReconstructionSamples parameter.
Developers should be aware that changes to CVarAOReconstructionSampleCount will directly affect the ambient occlusion denoising process. It’s clamped between 1 and the maximum sample count defined by kStackowiakMaxSampleCountPerSet.
Best practices for using CVarAOReconstructionSampleCount include:
- Accessing its value using GetValueOnRenderThread() to ensure thread-safety.
- Considering the performance implications when modifying this value, especially in performance-critical sections of code.
- Using it in conjunction with other ambient occlusion and denoising settings for optimal results.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:67
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarAOReconstructionSampleCount(
TEXT("r.AmbientOcclusion.Denoiser.ReconstructionSamples"), 16,
TEXT("Maximum number of samples for the reconstruction pass (default = 16)."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarAOPreConvolutionCount(
TEXT("r.AmbientOcclusion.Denoiser.PreConvolution"), 2,
TEXT("Number of pre-convolution passes (default = 1)."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarAOReconstructionSampleCount
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:66
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarAOReconstructionSampleCount(
TEXT("r.AmbientOcclusion.Denoiser.ReconstructionSamples"), 16,
TEXT("Maximum number of samples for the reconstruction pass (default = 16)."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarAOPreConvolutionCount(
TEXT("r.AmbientOcclusion.Denoiser.PreConvolution"), 2,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:2653
Scope (from outer to inner):
file
class class FDefaultScreenSpaceDenoiser : public IScreenSpaceDenoiser
function FAmbientOcclusionOutputs DenoiseAmbientOcclusion
Source code excerpt:
Settings.SignalProcessing = ESignalProcessing::AmbientOcclusion;
Settings.InputResolutionFraction = RayTracingConfig.ResolutionFraction;
Settings.ReconstructionSamples = FMath::Clamp(CVarAOReconstructionSampleCount.GetValueOnRenderThread(), 1, kStackowiakMaxSampleCountPerSet);
Settings.PreConvolutionCount = CVarAOPreConvolutionCount.GetValueOnRenderThread();
Settings.KernelSpreadFactor = CVarAOKernelSpreadFactor.GetValueOnRenderThread();
Settings.bUseTemporalAccumulation = CVarAOTemporalAccumulation.GetValueOnRenderThread() != 0;
Settings.HistoryConvolutionSampleCount = CVarAOHistoryConvolutionSampleCount.GetValueOnRenderThread();
Settings.HistoryConvolutionKernelSpreadFactor = CVarAOHistoryConvolutionKernelSpreadFactor.GetValueOnRenderThread();
Settings.MaxInputSPP = RayTracingConfig.RayCountPerPixel;