r.Shadow.Denoiser.HistoryConvolutionSamples

r.Shadow.Denoiser.HistoryConvolutionSamples

#Overview

name: r.Shadow.Denoiser.HistoryConvolutionSamples

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.Shadow.Denoiser.HistoryConvolutionSamples is to control the number of samples used to convolve the history over time in the shadow denoising process. This setting is part of Unreal Engine’s rendering system, specifically the shadow denoising functionality.

This setting variable is primarily used in the Renderer module of Unreal Engine, particularly in the screen space denoising subsystem. Based on the callsites, it’s utilized in the ScreenSpaceDenoise.cpp file, which is responsible for denoising various screen space effects, including shadows.

The value of this variable is set through a console variable (CVar) system, allowing it to be adjusted at runtime. It’s defined with a default value of 1, but can be changed through console commands or project settings.

The associated variable CVarShadowHistoryConvolutionSampleCount directly interacts with r.Shadow.Denoiser.HistoryConvolutionSamples. They share the same value and are used interchangeably in the code.

Developers should be aware that this variable affects the quality and performance of shadow denoising. A higher value may result in smoother shadows over time but could potentially impact performance.

Best practices when using this variable include:

  1. Balancing between quality and performance based on the target hardware.
  2. Testing different values to find the optimal setting for your specific use case.
  3. Consider the interaction with other shadow and denoising settings for the best overall result.

Regarding the associated variable CVarShadowHistoryConvolutionSampleCount:

This is an internal representation of the r.Shadow.Denoiser.HistoryConvolutionSamples console variable. It’s used within the C++ code to access the current value of the setting. The purpose and usage are identical to r.Shadow.Denoiser.HistoryConvolutionSamples.

It’s primarily used in the FDefaultScreenSpaceDenoiser class, specifically in the DenoiseShadowVisibilityMasks function. This function is responsible for denoising shadow visibility masks, which is a crucial part of the shadow rendering pipeline.

The value is retrieved using the GetValueOnRenderThread() method, ensuring thread-safe access to the current setting.

Developers should treat this variable as they would r.Shadow.Denoiser.HistoryConvolutionSamples, as they represent the same setting. Any changes to one will affect the other.

Best practices for using CVarShadowHistoryConvolutionSampleCount include:

  1. Accessing it through the provided CVar system rather than modifying it directly in code.
  2. Being aware of its impact on the shadow denoising process when optimizing rendering performance.
  3. Considering its interaction with other shadow and denoising settings for cohesive adjustments to the rendering pipeline.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:38

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarShadowHistoryConvolutionSampleCount(
	TEXT("r.Shadow.Denoiser.HistoryConvolutionSamples"), 1,
	TEXT("Number of samples to use to convolve the history over time."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarUseReflectionDenoiser(
	TEXT("r.Reflections.Denoiser"),
	2,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:37

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarShadowHistoryConvolutionSampleCount(
	TEXT("r.Shadow.Denoiser.HistoryConvolutionSamples"), 1,
	TEXT("Number of samples to use to convolve the history over time."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarUseReflectionDenoiser(
	TEXT("r.Reflections.Denoiser"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceDenoise.cpp:2267

Scope (from outer to inner):

file
class        class FDefaultScreenSpaceDenoiser : public IScreenSpaceDenoiser
function     virtual void DenoiseShadowVisibilityMasks

Source code excerpt:

		Settings.PreConvolutionCount = CVarShadowPreConvolutionCount.GetValueOnRenderThread();
		Settings.bUseTemporalAccumulation = CVarShadowTemporalAccumulation.GetValueOnRenderThread() != 0;
		Settings.HistoryConvolutionSampleCount = CVarShadowHistoryConvolutionSampleCount.GetValueOnRenderThread();
		Settings.SignalBatchSize = InputParameterCount;

		for (int32 BatchedSignalId = 0; BatchedSignalId < InputParameterCount; BatchedSignalId++)
		{
			Settings.MaxInputSPP = FMath::Max(Settings.MaxInputSPP, InputParameters[BatchedSignalId].RayTracingConfig.RayCountPerPixel);
		}