r.VolumetricCloud.ShadowMap.TemporalFiltering.NewFrameWeight

r.VolumetricCloud.ShadowMap.TemporalFiltering.NewFrameWeight

#Overview

name: r.VolumetricCloud.ShadowMap.TemporalFiltering.NewFrameWeight

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.VolumetricCloud.ShadowMap.TemporalFiltering.NewFrameWeight is to control the temporal filtering of volumetric cloud shadows in the rendering system. This setting variable is used to determine the weight of the current frame’s contribution in the temporal filtering process for volumetric cloud shadows.

This setting variable is primarily used in the Unreal Engine’s rendering subsystem, specifically in the volumetric cloud rendering module. It is defined and utilized in the VolumetricCloudRendering.cpp file, which is part of the Renderer module.

The value of this variable is set as a console variable (CVar) with a default value of 1.0f. It can be modified at runtime through the console or programmatically.

The associated variable CVarVolumetricCloudShadowTemporalFilteringNewFrameWeight interacts directly with r.VolumetricCloud.ShadowMap.TemporalFiltering.NewFrameWeight. They share the same value and purpose.

Developers must be aware of several important aspects when using this variable:

  1. It is experimental and may require further refinement.
  2. The valid range for this variable is between 0.0 and 1.0.
  3. Lower values can lead to precision issues, causing depth to not converge over time.
  4. When set to 1.0, the temporal filtering is effectively disabled.

Best practices for using this variable include:

  1. Use caution when modifying this value, as it can significantly impact the visual quality and performance of volumetric cloud shadows.
  2. Monitor the results closely when adjusting this value, especially for values close to 0.0.
  3. Consider the trade-off between temporal stability and responsiveness to changes when setting this value.
  4. Use in conjunction with other volumetric cloud rendering settings for optimal results.

Regarding the associated variable CVarVolumetricCloudShadowTemporalFilteringNewFrameWeight:

Developers should treat CVarVolumetricCloudShadowTemporalFilteringNewFrameWeight as the internal representation of the r.VolumetricCloud.ShadowMap.TemporalFiltering.NewFrameWeight setting and use it accordingly in their code when working with volumetric cloud shadow temporal filtering.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:168

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarVolumetricCloudShadowTemporalFilteringNewFrameWeight(
	TEXT("r.VolumetricCloud.ShadowMap.TemporalFiltering.NewFrameWeight"), 1.0f,
	TEXT("Experimental and needs more work so disabled by default. Value between [0.0, 1.0] representing the weight of current frame's contribution. Low values can cause precision issues resulting in depth not converging over time. Disabled when set to 1."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<float> CVarVolumetricCloudShadowTemporalFilteringLightRotationCutHistory(
	TEXT("r.VolumetricCloud.ShadowMap.TemporalFiltering.LightRotationCutHistory"), 10.0f,
	TEXT("When the atmospheric light rotation in degree is larger than that, the temporal accumulation is restarted."),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:167

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<float> CVarVolumetricCloudShadowTemporalFilteringNewFrameWeight(
	TEXT("r.VolumetricCloud.ShadowMap.TemporalFiltering.NewFrameWeight"), 1.0f,
	TEXT("Experimental and needs more work so disabled by default. Value between [0.0, 1.0] representing the weight of current frame's contribution. Low values can cause precision issues resulting in depth not converging over time. Disabled when set to 1."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<float> CVarVolumetricCloudShadowTemporalFilteringLightRotationCutHistory(
	TEXT("r.VolumetricCloud.ShadowMap.TemporalFiltering.LightRotationCutHistory"), 10.0f,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:1584

Scope (from outer to inner):

file
function     void FSceneRenderer::InitVolumetricCloudsForViews

Source code excerpt:

		const float MetersToKilometers = 1.0f / KilometersToMeters;

		const float CloudShadowTemporalWeight = FMath::Min(FMath::Max(CVarVolumetricCloudShadowTemporalFilteringNewFrameWeight.GetValueOnRenderThread(), 0.0f), 1.0f);
		const bool CloudShadowTemporalEnabled = CloudShadowTemporalWeight < 1.0f;

		// Initialise the cloud common parameters
		{
			FVolumetricCloudCommonShaderParameters& CloudGlobalShaderParams = CloudInfo.GetVolumetricCloudCommonShaderParameters();
			float PlanetRadiusKm = CloudProxy.PlanetRadiusKm;