r.Shadow.Denoiser.PreConvolution
r.Shadow.Denoiser.PreConvolution
#Overview
name: r.Shadow.Denoiser.PreConvolution
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of pre-convolution passes (default = 1).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shadow.Denoiser.PreConvolution is to control the number of pre-convolution passes in the shadow denoising process. This setting variable is part of Unreal Engine 5’s rendering system, specifically the screen space denoising subsystem.
Based on the details in the Callsites section, this setting variable is primarily used in the Renderer module of Unreal Engine, particularly in the screen space denoising functionality for shadows.
The value of this variable is set through a console variable (CVar) named CVarShadowPreConvolutionCount. It’s initialized with a default value of 1, but can be changed at runtime through console commands or programmatically.
This variable interacts with several other variables related to shadow denoising, such as CVarShadowTemporalAccumulation, CVarShadowReconstructionSampleCount, and CVarShadowHistoryConvolutionSampleCount. These variables collectively control various aspects of the shadow denoising process.
Developers must be aware that changing this variable affects the quality and performance of shadow rendering. Increasing the number of pre-convolution passes may improve shadow quality but at the cost of increased rendering time.
Best practices when using this variable include:
- Experimenting with different values to find the optimal balance between shadow quality and performance for your specific use case.
- Consider the target hardware when setting this value, as higher values may impact performance on less powerful devices.
- Use in conjunction with other shadow denoising settings for best results.
Regarding the associated variable CVarShadowPreConvolutionCount:
The purpose of CVarShadowPreConvolutionCount is to store and provide access to the r.Shadow.Denoiser.PreConvolution setting value within the C++ code.
This variable is used in the Renderer module, specifically in the FDefaultScreenSpaceDenoiser class, which is part of the screen space denoising system.
The value of CVarShadowPreConvolutionCount is set when the r.Shadow.Denoiser.PreConvolution console variable is initialized or changed.
It interacts directly with the r.Shadow.Denoiser.PreConvolution setting and is used to retrieve the current value of the setting in the rendering code.
Developers should be aware that this variable is accessed on the render thread, so any modifications should be done carefully to avoid race conditions.
Best practices for using CVarShadowPreConvolutionCount include:
- Use the GetValueOnRenderThread() method to safely retrieve the current value in render thread code.
- Avoid directly modifying this variable; instead, change the r.Shadow.Denoiser.PreConvolution console variable.
- Consider caching the value if it’s accessed frequently in performance-critical code sections.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:28
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarShadowPreConvolutionCount(
TEXT("r.Shadow.Denoiser.PreConvolution"), 1,
TEXT("Number of pre-convolution passes (default = 1)."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarShadowTemporalAccumulation(
TEXT("r.Shadow.Denoiser.TemporalAccumulation"), 1,
TEXT(""),
#Associated Variable and Callsites
This variable is associated with another variable named CVarShadowPreConvolutionCount
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:27
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarShadowPreConvolutionCount(
TEXT("r.Shadow.Denoiser.PreConvolution"), 1,
TEXT("Number of pre-convolution passes (default = 1)."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarShadowTemporalAccumulation(
TEXT("r.Shadow.Denoiser.TemporalAccumulation"), 1,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:2265
Scope (from outer to inner):
file
class class FDefaultScreenSpaceDenoiser : public IScreenSpaceDenoiser
function virtual void DenoiseShadowVisibilityMasks
Source code excerpt:
Settings.InputResolutionFraction = 1.0f;
Settings.ReconstructionSamples = FMath::Clamp(CVarShadowReconstructionSampleCount.GetValueOnRenderThread(), 1, kStackowiakMaxSampleCountPerSet);
Settings.PreConvolutionCount = CVarShadowPreConvolutionCount.GetValueOnRenderThread();
Settings.bUseTemporalAccumulation = CVarShadowTemporalAccumulation.GetValueOnRenderThread() != 0;
Settings.HistoryConvolutionSampleCount = CVarShadowHistoryConvolutionSampleCount.GetValueOnRenderThread();
Settings.SignalBatchSize = InputParameterCount;
for (int32 BatchedSignalId = 0; BatchedSignalId < InputParameterCount; BatchedSignalId++)
{