r.DiffuseIndirect.Denoiser
r.DiffuseIndirect.Denoiser
#Overview
name: r.DiffuseIndirect.Denoiser
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Denoising options (default = 1)
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DiffuseIndirect.Denoiser is to control the denoising options for diffuse indirect lighting in Unreal Engine’s rendering system. This setting variable is primarily used in the rendering subsystem, specifically for managing indirect lighting and denoising processes.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evidenced by its usage in the IndirectLightRendering.cpp file.
The value of this variable is set through a console variable (CVar) named CVarDiffuseIndirectDenoiser. It is initialized with a default value of 1, indicating that denoising is enabled by default.
The associated variable CVarDiffuseIndirectDenoiser interacts directly with r.DiffuseIndirect.Denoiser, as they share the same value and purpose.
Developers must be aware of the following when using this variable:
- It affects the quality and performance of indirect lighting in the scene.
- The variable accepts integer values, with 1 being the default (enabled) state.
- It is marked as ECVF_RenderThreadSafe, meaning it can be safely modified on the render thread.
Best practices when using this variable include:
- Experiment with different values to find the optimal balance between visual quality and performance for your specific project.
- Consider the impact on different hardware configurations, as denoising can be computationally expensive.
- Use in conjunction with other lighting and rendering settings for best results.
Regarding the associated variable CVarDiffuseIndirectDenoiser:
- Its purpose is to provide programmatic access to the r.DiffuseIndirect.Denoiser setting within the C++ code.
- It is used in the Renderer module to determine the denoiser mode for various indirect lighting methods, such as SSGI (Screen Space Global Illumination) and plugin-based global illumination.
- The value is typically retrieved using GetValueOnRenderThread() method, ensuring thread-safe access.
- Developers should be aware that changes to this variable will directly affect the behavior of the r.DiffuseIndirect.Denoiser setting.
- Best practice is to use this variable for reading the current denoiser state rather than modifying it directly in code, unless specific runtime adjustments are required.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:63
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDiffuseIndirectDenoiser(
TEXT("r.DiffuseIndirect.Denoiser"), 1,
TEXT("Denoising options (default = 1)"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDenoiseSSR(
TEXT("r.SSR.ExperimentalDenoiser"), 0,
TEXT("Replace SSR's TAA pass with denoiser."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarDiffuseIndirectDenoiser
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:62
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDiffuseIndirectDenoiser(
TEXT("r.DiffuseIndirect.Denoiser"), 1,
TEXT("Denoising options (default = 1)"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarDenoiseSSR(
TEXT("r.SSR.ExperimentalDenoiser"), 0,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:478
Scope: file
Source code excerpt:
{
DiffuseIndirectMethod = EDiffuseIndirectMethod::SSGI;
DiffuseIndirectDenoiser = IScreenSpaceDenoiser::GetDenoiserMode(CVarDiffuseIndirectDenoiser);
}
else if (ShouldRenderPluginGlobalIllumination(View))
{
DiffuseIndirectMethod = EDiffuseIndirectMethod::Plugin;
DiffuseIndirectDenoiser = IScreenSpaceDenoiser::GetDenoiserMode(CVarDiffuseIndirectDenoiser);
}
const bool bLumenWantsSSAO = DiffuseIndirectMethod == EDiffuseIndirectMethod::Lumen && ShouldRenderAOWithLumenGI();
if (DiffuseIndirectMethod == EDiffuseIndirectMethod::SSGI)
{
AmbientOcclusionMethod = EAmbientOcclusionMethod::SSGI;
DiffuseIndirectDenoiser = IScreenSpaceDenoiser::GetDenoiserMode(CVarDiffuseIndirectDenoiser);
}
else if (DiffuseIndirectMethod != EDiffuseIndirectMethod::Lumen || bLumenWantsSSAO)
{
extern bool ShouldRenderScreenSpaceAmbientOcclusion(const FViewInfo& View, bool bLumenWantsSSAO);
if (ShouldRenderRayTracingAmbientOcclusion(View) && (Views.Num() == 1) && !bLumenWantsSSAO)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:987
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderDiffuseIndirectAndAmbientOcclusion
Source code excerpt:
}
int32 DenoiseMode = CVarDiffuseIndirectDenoiser.GetValueOnRenderThread();
// Setup the common diffuse parameter for this view.
FCommonParameters CommonDiffuseParameters;
SetupCommonDiffuseIndirectParameters(GraphBuilder, SceneTextureParameters, View, /* out */ CommonDiffuseParameters);
// Update old ray tracing config for the denoiser.