r.PathTracing.TemporalDenoiser.kappa

r.PathTracing.TemporalDenoiser.kappa

#Overview

name: r.PathTracing.TemporalDenoiser.kappa

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.TemporalDenoiser.kappa is to control the scaling parameter for the temporal denoiser in the path tracing system of Unreal Engine 5. It determines how quickly the history weight falls and the cutting point to zero in the denoising process.

This setting variable is primarily used by the rendering system, specifically within the path tracing and denoising subsystem of Unreal Engine 5. Based on the callsites, it’s part of the Renderer module, as evidenced by its location in the “Runtime/Renderer/Private” directory.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of -1.0f, but can be changed at runtime through console commands or programmatically.

The variable interacts closely with other denoising parameters, particularly ’eta’ and ‘alpha’. These three variables (kappa, eta, and alpha) are used together in the GetBlendingFactor function to determine the blending behavior of the temporal denoiser.

Developers should be aware that:

  1. If the value is set to -1, the system will use DeltaE to derive the kappa value automatically.
  2. This variable affects the quality and performance of the path tracing denoiser, so adjusting it can impact both visual results and rendering speed.
  3. It’s a render thread safe variable, meaning it can be safely modified from the render thread.

Best practices when using this variable include:

  1. Experiment with different values to find the optimal balance between denoising quality and performance for your specific scene.
  2. Consider using the default value (-1) to allow the system to automatically derive an appropriate value unless you have specific reasons to override it.
  3. When manually setting the value, make small adjustments and observe the results, as drastic changes can significantly affect the denoising process.

Regarding the associated variable CVarPathTracingTemporalDenoiserKappa: This is the actual console variable object that holds the value of r.PathTracing.TemporalDenoiser.kappa. It’s used internally by the engine to store and retrieve the current value of the setting. The GetValueOnRenderThread() method is used to safely access this value from the render thread, as seen in the GetBlendingFactor function. Developers typically don’t need to interact with this variable directly, as they can modify the setting through the r.PathTracing.TemporalDenoiser.kappa console command instead.

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


	TAutoConsoleVariable<float> CVarPathTracingTemporalDenoiserKappa(
		TEXT("r.PathTracing.TemporalDenoiser.kappa"),
		-1.0f,
		TEXT("Scaling parameter to determine how fast the history weight falls and the cutting point to zero. Use DeltaE to derive kappa if -1\n"),
		ECVF_RenderThreadSafe
	);

	TAutoConsoleVariable<float> CVarPathTracingTemporalDenoiserEta(

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	);

	TAutoConsoleVariable<float> CVarPathTracingTemporalDenoiserKappa(
		TEXT("r.PathTracing.TemporalDenoiser.kappa"),
		-1.0f,
		TEXT("Scaling parameter to determine how fast the history weight falls and the cutting point to zero. Use DeltaE to derive kappa if -1\n"),
		ECVF_RenderThreadSafe
	);

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

Scope (from outer to inner):

file
function     static void GetBlendingFactor

Source code excerpt:

static void GetBlendingFactor(float& Kappa, float& Eta, float& Alpha)
{
	Kappa = CVarPathTracingTemporalDenoiserKappa.GetValueOnRenderThread();
	Eta = CVarPathTracingTemporalDenoiserEta.GetValueOnRenderThread();
	Alpha = CVarPathTracingTemporalDenoiserAlpha.GetValueOnRenderThread();

	if (Eta == -1)
	{
		// Eta is set to 1 JND (just noticeable difference).