r.PathTracing.TemporalDenoiser
r.PathTracing.TemporalDenoiser
#Overview
name: r.PathTracing.TemporalDenoiser
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable temporal denoising of the path traced output\n-1: inherit from PostProcessVolume (TODO when out of experimental phase)\n0: disable denoiser\n1: enable denoiser (if a denoiser plugin is active)\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PathTracing.TemporalDenoiser is to control the temporal denoising of path traced output in Unreal Engine’s rendering system. It is specifically related to the path tracing feature, which is an advanced rendering technique used for creating high-quality, realistic images.
This setting variable is primarily used in the Renderer module of Unreal Engine, particularly in the path tracing and denoising subsystems. It’s referenced in the file PathTracingSpatialTemporalDenoising.cpp, which suggests it’s part of the spatial-temporal denoising implementation for path tracing.
The value of this variable is set through a console variable (CVar) system, which allows it to be changed at runtime. It’s initialized with a default value of 0, meaning the denoiser is disabled by default.
The variable interacts with the rendering system, specifically the path tracing and denoising components. It’s used in conjunction with other rendering-related variables and systems to determine whether temporal denoising should be applied to the path traced output.
Developers must be aware that this variable has three possible values:
- -1: Inherit from PostProcessVolume (noted as TODO, suggesting this feature might not be fully implemented yet)
- 0: Disable denoiser
- 1: Enable denoiser (if a denoiser plugin is active)
Best practices when using this variable include:
- Ensure a denoiser plugin is active when enabling the denoiser (setting to 1).
- Be aware of the performance implications of enabling the denoiser, as it can be computationally expensive.
- Use this in conjunction with other path tracing settings for optimal results.
- Consider the visual quality vs. performance trade-off when deciding whether to enable or disable the denoiser.
Regarding the associated variable CVarPathTracingTemporalDenoiser:
This is the actual console variable object that represents r.PathTracing.TemporalDenoiser in the code. It’s an instance of TAutoConsoleVariable
The purpose of CVarPathTracingTemporalDenoiser is to provide a programmatic interface to access and modify the r.PathTracing.TemporalDenoiser setting within the engine’s code.
It’s used in the ShouldApplyTemporalDenoiser function to determine whether temporal denoising should be applied based on the current value of the variable.
Developers should be aware that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag.
Best practices for using CVarPathTracingTemporalDenoiser include:
- Use GetValueOnAnyThread() to safely read the value from any thread.
- Be cautious about frequently changing this value, as it can impact rendering performance.
- Consider exposing this setting in user interfaces for advanced users or developers to tweak as needed.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:81
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarPathTracingTemporalDenoiser(
TEXT("r.PathTracing.TemporalDenoiser"),
0,
TEXT("Enable temporal denoising of the path traced output\n")
TEXT("-1: inherit from PostProcessVolume (TODO when out of experimental phase)\n")
TEXT("0: disable denoiser\n")
TEXT("1: enable denoiser (if a denoiser plugin is active)\n"),
ECVF_RenderThreadSafe
#Associated Variable and Callsites
This variable is associated with another variable named CVarPathTracingTemporalDenoiser
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:80
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarPathTracingTemporalDenoiser(
TEXT("r.PathTracing.TemporalDenoiser"),
0,
TEXT("Enable temporal denoising of the path traced output\n")
TEXT("-1: inherit from PostProcessVolume (TODO when out of experimental phase)\n")
TEXT("0: disable denoiser\n")
TEXT("1: enable denoiser (if a denoiser plugin is active)\n"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:362
Scope (from outer to inner):
file
function static bool ShouldApplyTemporalDenoiser
Source code excerpt:
{
const bool bApplyTemporalDenoiser =
(CVarPathTracingTemporalDenoiser.GetValueOnAnyThread() == 1) &&
DenoisingContext.LastDenoisedRadianceTexture &&
DenoisingContext.LastDenoisedRadianceTexture != DenoisingContext.RadianceTexture;
return bApplyTemporalDenoiser;
}