r.PathTracing.OutputPostProcessResources
r.PathTracing.OutputPostProcessResources
#Overview
name: r.PathTracing.OutputPostProcessResources
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Output the pathtracing resources to the postprocess passes\n0: off\n1: on (Buffers including, raw/denoised radiance, albedo, normal, and variance)\n
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PathTracing.OutputPostProcessResources is to control the output of path tracing resources to post-processing passes in Unreal Engine 5’s rendering system. This setting variable is primarily used in the path tracing and denoising components of the rendering pipeline.
The Unreal Engine subsystems that rely on this setting variable are primarily the Renderer module, specifically the path tracing and spatial-temporal denoising components. This can be seen from the file locations where the variable is referenced: PathTracing.cpp and PathTracingSpatialTemporalDenoising.cpp.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 (enabled) but can be changed at runtime through console commands or programmatically.
This variable interacts closely with other path tracing and denoising-related variables, such as CVarPathTracingDenoiserPrepassOutputVarianceTexture. It’s also associated with CVarPathTracingOutputPostProcessResources, which shares the same value and purpose.
Developers must be aware that this variable affects the performance and memory usage of the rendering pipeline. When enabled (set to 1), it outputs additional buffers including raw/denoised radiance, albedo, normal, and variance to post-processing passes. This can be useful for debugging or advanced rendering techniques but may impact performance.
Best practices when using this variable include:
- Only enable it when necessary for debugging or specific rendering techniques.
- Be aware of the performance implications, especially on lower-end hardware.
- Consider disabling it in shipping builds unless absolutely necessary.
Regarding the associated variable CVarPathTracingOutputPostProcessResources:
The purpose of CVarPathTracingOutputPostProcessResources is identical to r.PathTracing.OutputPostProcessResources. It’s the actual console variable implementation that controls the behavior.
This variable is used directly in the path tracing code to determine whether to set up and output path tracing resources for post-processing. When enabled, it populates a PathTracingResources structure with various texture references (denoised radiance, radiance, albedo, normal).
The value of this variable is typically accessed using GetValueOnRenderThread() to ensure thread-safety in the rendering pipeline.
Developers should treat this variable the same way as r.PathTracing.OutputPostProcessResources, as they are essentially the same setting exposed through different interfaces (console command vs. programmatic access).
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:347
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarPathTracingOutputPostProcessResources(
TEXT("r.PathTracing.OutputPostProcessResources"),
1,
TEXT("Output the pathtracing resources to the postprocess passes\n")
TEXT("0: off\n")
TEXT("1: on (Buffers including, raw/denoised radiance, albedo, normal, and variance)\n"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:516
Scope (from outer to inner):
file
function static bool ShouldPrepassOutputVarianceTexture
Source code excerpt:
{
static const auto CVarOutputPostProcessResources =
IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.PathTracing.OutputPostProcessResources"));
const bool bOutputPostProcessResources = CVarOutputPostProcessResources ?
(CVarOutputPostProcessResources->GetValueOnRenderThread() != 0) : false;
return CVarPathTracingDenoiserPrepassOutputVarianceTexture.GetValueOnRenderThread() != 0 &&
bOutputPostProcessResources &&
IsPathTracingVarianceTextureRequiredInPostProcessMaterial(View);
#Associated Variable and Callsites
This variable is associated with another variable named CVarPathTracingOutputPostProcessResources
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:346
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarPathTracingOutputPostProcessResources(
TEXT("r.PathTracing.OutputPostProcessResources"),
1,
TEXT("Output the pathtracing resources to the postprocess passes\n")
TEXT("0: off\n")
TEXT("1: on (Buffers including, raw/denoised radiance, albedo, normal, and variance)\n"),
ECVF_RenderThreadSafe
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:3377
Scope: file
Source code excerpt:
// Setup the path tracing resources to be used by post process pass.
if (CVarPathTracingOutputPostProcessResources.GetValueOnRenderThread() != 0)
{
PathTracingResources.bPostProcessEnabled = true;
PathTracingResources.DenoisedRadiance = DenoisedRadianceTexture ? DenoisedRadianceTexture : RadianceTexture;
PathTracingResources.Radiance = RadianceTexture;
PathTracingResources.Albedo = AlbedoTexture;
PathTracingResources.Normal = NormalTexture;