r.PathTracing.SpatialDenoiser.Type

r.PathTracing.SpatialDenoiser.Type

#Overview

name: r.PathTracing.SpatialDenoiser.Type

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.PathTracing.SpatialDenoiser.Type is to control the type of spatial denoiser used in the path tracing rendering system of Unreal Engine 5. It specifically determines whether to use a spatial denoiser only plugin or a spatial denoiser plugin that also provides temporal denoising.

This setting variable is primarily used by the Renderer module of Unreal Engine 5, specifically in the path tracing and denoising subsystem. It’s referenced in the file PathTracingSpatialTemporalDenoising.cpp, which suggests it’s part of the engine’s advanced rendering capabilities.

The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It’s initialized with a default value of 0, meaning it uses the spatial denoiser only plugin by default.

The associated variable CVarPathTracingSpatialDenoiserType directly interacts with r.PathTracing.SpatialDenoiser.Type. They share the same value and purpose, with CVarPathTracingSpatialDenoiserType being the actual C++ variable that stores and provides access to the setting.

Developers must be aware that this variable affects the rendering quality and performance of path-traced scenes. Changing this setting can impact the visual output and potentially the rendering performance.

Best practices when using this variable include:

  1. Understanding the performance implications of each option.
  2. Testing the visual quality differences between the two denoiser types in various scenarios.
  3. Considering the target hardware capabilities when choosing between the options.
  4. Using the appropriate option based on whether temporal stability is a priority for the specific use case.

Regarding the associated variable CVarPathTracingSpatialDenoiserType:

When working with CVarPathTracingSpatialDenoiserType, developers should be mindful of thread safety (it’s marked as ECVF_RenderThreadSafe) and ensure they’re accessing it correctly in render thread contexts.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:72

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


	TAutoConsoleVariable<int32> CVarPathTracingSpatialDenoiserType(
		TEXT("r.PathTracing.SpatialDenoiser.Type"),
		0,
		TEXT("The type of spatial denoiser\n")
		TEXT("0: Use spatial denoiser only plugin\n")
		TEXT("1: Use spatial denoiser plugin that also provides temporal denoising\n"),
		ECVF_RenderThreadSafe
	);

#Associated Variable and Callsites

This variable is associated with another variable named CVarPathTracingSpatialDenoiserType. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:71

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	);

	TAutoConsoleVariable<int32> CVarPathTracingSpatialDenoiserType(
		TEXT("r.PathTracing.SpatialDenoiser.Type"),
		0,
		TEXT("The type of spatial denoiser\n")
		TEXT("0: Use spatial denoiser only plugin\n")
		TEXT("1: Use spatial denoiser plugin that also provides temporal denoising\n"),
		ECVF_RenderThreadSafe

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracingSpatialTemporalDenoising.cpp:334

Scope (from outer to inner):

file
function     ESpatialDenoiserType GetSpatialDenosierType

Source code excerpt:

ESpatialDenoiserType GetSpatialDenosierType()
{
	int32 Type = CVarPathTracingSpatialDenoiserType.GetValueOnRenderThread();

	Type = FMath::Clamp(Type,
		static_cast<int32>(ESpatialDenoiserType::NONE) + 1,
		static_cast<int32>(ESpatialDenoiserType::MAX) - 1);

	ESpatialDenoiserType DenoiserType = static_cast<ESpatialDenoiserType>(Type);