r.AmbientOcclusion.Denoiser.HistoryConvolution.SampleCount
r.AmbientOcclusion.Denoiser.HistoryConvolution.SampleCount
#Overview
name: r.AmbientOcclusion.Denoiser.HistoryConvolution.SampleCount
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of samples to use for history post filter (default = 16).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.AmbientOcclusion.Denoiser.HistoryConvolution.SampleCount is to control the number of samples used for the history post-filter in the Ambient Occlusion (AO) denoising process. This setting variable is part of Unreal Engine 5’s rendering system, specifically the screen space denoising subsystem.
This setting variable is primarily used in the Renderer module, particularly in the screen space denoising component. It’s employed in the ambient occlusion denoising process to improve the quality of the final rendered image by reducing noise artifacts.
The value of this variable is set through a console variable (CVar) system. It’s defined using TAutoConsoleVariable, which allows it to be changed at runtime. The default value is set to 1, but the comment suggests that 16 is a more typical value.
The associated variable CVarAOHistoryConvolutionSampleCount directly interacts with this setting. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable affects the performance-quality trade-off in the AO denoising process. A higher sample count will likely produce better quality results but at the cost of increased computational overhead.
Best practices when using this variable include:
- Experimenting with different values to find the optimal balance between image quality and performance for your specific use case.
- Consider the target hardware when setting this value, as higher-end systems may be able to handle higher sample counts.
- Use in conjunction with other AO denoising settings for best results.
Regarding the associated variable CVarAOHistoryConvolutionSampleCount:
- Its purpose is identical to r.AmbientOcclusion.Denoiser.HistoryConvolution.SampleCount.
- It’s used in the same Renderer module and screen space denoising subsystem.
- Its value is set through the same CVar system and can be accessed using GetValueOnRenderThread().
- It directly interacts with the Settings.HistoryConvolutionSampleCount in the DenoiseAmbientOcclusion function of the FDefaultScreenSpaceDenoiser class.
- Developers should treat it as they would the original variable, being aware of its impact on performance and image quality.
- Best practices remain the same as for the original variable.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:87
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarAOHistoryConvolutionSampleCount(
TEXT("r.AmbientOcclusion.Denoiser.HistoryConvolution.SampleCount"), 1,
TEXT("Number of samples to use for history post filter (default = 16)."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarAOHistoryConvolutionKernelSpreadFactor(
TEXT("r.AmbientOcclusion.Denoiser.HistoryConvolution.KernelSpreadFactor"), 7,
TEXT("Multiplication factor applied on the kernel sample offset (default = 7)."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarAOHistoryConvolutionSampleCount
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:86
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarAOHistoryConvolutionSampleCount(
TEXT("r.AmbientOcclusion.Denoiser.HistoryConvolution.SampleCount"), 1,
TEXT("Number of samples to use for history post filter (default = 16)."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarAOHistoryConvolutionKernelSpreadFactor(
TEXT("r.AmbientOcclusion.Denoiser.HistoryConvolution.KernelSpreadFactor"), 7,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:2657
Scope (from outer to inner):
file
class class FDefaultScreenSpaceDenoiser : public IScreenSpaceDenoiser
function FAmbientOcclusionOutputs DenoiseAmbientOcclusion
Source code excerpt:
Settings.KernelSpreadFactor = CVarAOKernelSpreadFactor.GetValueOnRenderThread();
Settings.bUseTemporalAccumulation = CVarAOTemporalAccumulation.GetValueOnRenderThread() != 0;
Settings.HistoryConvolutionSampleCount = CVarAOHistoryConvolutionSampleCount.GetValueOnRenderThread();
Settings.HistoryConvolutionKernelSpreadFactor = CVarAOHistoryConvolutionKernelSpreadFactor.GetValueOnRenderThread();
Settings.MaxInputSPP = RayTracingConfig.RayCountPerPixel;
TStaticArray<FScreenSpaceDenoiserHistory*, IScreenSpaceDenoiser::kMaxBatchSize> PrevHistories;
TStaticArray<FScreenSpaceDenoiserHistory*, IScreenSpaceDenoiser::kMaxBatchSize> NewHistories;
PrevHistories[0] = &PreviousViewInfos->AmbientOcclusionHistory;