r.PathTracing.TemporalDenoiser.EnableSubPixelOffset
r.PathTracing.TemporalDenoiser.EnableSubPixelOffset
#Overview
name: r.PathTracing.TemporalDenoiser.EnableSubPixelOffset
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable subpixel offset when merging\n-1: inherit from PostProcessVolume\n0: disable denoiser\n1: enable denoiser (if a denoiser plugin is active)\n
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PathTracing.TemporalDenoiser.EnableSubPixelOffset is to control the subpixel offset feature in the temporal denoiser for path tracing in Unreal Engine 5’s rendering system.
This setting variable is primarily used in the Renderer module, specifically within the path tracing and temporal denoising subsystem. It’s part of the engine’s advanced rendering features, focusing on improving the quality of path-traced images.
The value of this variable is set through a console variable (CVarPathTracingTemporalDenoiserEnableSubPixelOffset) with a default value of 1. It can be changed at runtime through console commands or project settings.
Several other variables interact with it, including:
- CVarPathTracingTemporalDenoiserMotionOperation
- CVarPathTracingTemporalDenoiserSubPixelOffsetStartMip
- CVarPathTracingTemporalDenoiserTotalVariation
Developers must be aware that:
- This variable affects the quality and performance of path-traced renders.
- It has three possible values: -1 (inherit from PostProcessVolume), 0 (disable), and 1 (enable).
- Its effect is tied to the presence of an active denoiser plugin.
Best practices when using this variable include:
- Only enable it when using path tracing with a temporal denoiser.
- Consider the performance impact, especially on lower-end hardware.
- Test different settings to find the optimal balance between image quality and performance.
Regarding the associated variable CVarPathTracingTemporalDenoiserEnableSubPixelOffset:
This is the actual console variable that controls the r.PathTracing.TemporalDenoiser.EnableSubPixelOffset setting. It’s defined and used in the same context as the setting variable, within the path tracing and temporal denoising system of the Renderer module.
The purpose of this variable is to provide a runtime-configurable way to enable or disable the subpixel offset feature in the temporal denoiser.
It’s used in several functions within the path tracing system to determine whether certain rendering techniques should be applied, such as:
- Determining if self subpixel offset should be removed
- Deciding whether to use total variation
- Controlling whether subpixel offset should be enabled for a specific mip level
Developers should be aware that changing this variable at runtime can have immediate effects on the rendering output and performance. It’s important to consider the interaction with other related variables and the overall impact on the rendering pipeline when modifying this setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:116
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarPathTracingTemporalDenoiserEnableSubPixelOffset(
TEXT("r.PathTracing.TemporalDenoiser.EnableSubPixelOffset"),
1,
TEXT("Enable subpixel offset when merging\n")
TEXT("-1: inherit from PostProcessVolume\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 CVarPathTracingTemporalDenoiserEnableSubPixelOffset
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:115
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarPathTracingTemporalDenoiserEnableSubPixelOffset(
TEXT("r.PathTracing.TemporalDenoiser.EnableSubPixelOffset"),
1,
TEXT("Enable subpixel offset when merging\n")
TEXT("-1: inherit from PostProcessVolume\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:427
Scope (from outer to inner):
file
function static bool ShouldRemoveSelfSubpixelOffset
Source code excerpt:
bool bRemoveSelfSubpixelOffset = CVarPathTracingTemporalDenoiserMotionOperation.GetValueOnRenderThread() == 1
&& MipLevel <= CVarPathTracingTemporalDenoiserSubPixelOffsetStartMip.GetValueOnRenderThread()
&& CVarPathTracingTemporalDenoiserEnableSubPixelOffset.GetValueOnAnyThread() != 0;
return bRemoveSelfSubpixelOffset;
}
static float GetErrorDistanceBasedOnDeltaE(float DeltaE)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:501
Scope (from outer to inner):
file
function static bool ShouldUseTotalVariation
Source code excerpt:
return CVarPathTracingTemporalDenoiserTotalVariation.GetValueOnRenderThread() != 0.0f &&
(MipLevel == 0) &&
CVarPathTracingTemporalDenoiserEnableSubPixelOffset.GetValueOnAnyThread() != 0.0f;
}
static bool ShouldEnableSubpixelOffset(uint32 MipLevel)
{
uint32 PixelOffsetStartMip = CVarPathTracingTemporalDenoiserSubPixelOffsetStartMip.GetValueOnRenderThread();
bool bShouldEnableSubpixelOffset = (MipLevel <= PixelOffsetStartMip) &&
CVarPathTracingTemporalDenoiserEnableSubPixelOffset.GetValueOnAnyThread() != 0;
return bShouldEnableSubpixelOffset;
}
static bool ShouldPrepassOutputVarianceTexture(const FViewInfo& View)
{