r.VolumetricCloud.ShadowMap.TemporalFiltering.LightRotationCutHistory

r.VolumetricCloud.ShadowMap.TemporalFiltering.LightRotationCutHistory

#Overview

name: r.VolumetricCloud.ShadowMap.TemporalFiltering.LightRotationCutHistory

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.LightRotationCutHistory is to control the threshold for restarting temporal accumulation in volumetric cloud shadow rendering based on atmospheric light rotation.

This setting variable is used in the rendering system, specifically in the volumetric cloud rendering subsystem of Unreal Engine 5. It is part of the temporal filtering mechanism for cloud shadows.

The value of this variable is set through a console variable (CVar) in the Unreal Engine’s rendering module. It is initialized with a default value of 10.0 degrees.

The associated variable CVarVolumetricCloudShadowTemporalFilteringLightRotationCutHistory directly interacts with it, as they share the same value and purpose.

Developers must be aware that this variable affects the performance and visual quality of volumetric cloud shadows. A lower value will result in more frequent restarts of temporal accumulation, potentially reducing ghosting artifacts but increasing computation cost. A higher value may improve performance but could lead to more noticeable artifacts when the light direction changes rapidly.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of the scene and the rate of light direction changes.
  2. Testing different values to find the optimal balance between visual quality and performance.
  3. Considering the target hardware capabilities when setting this value, as it can impact rendering performance.

Regarding the associated variable CVarVolumetricCloudShadowTemporalFilteringLightRotationCutHistory:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


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."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

////////////////////////////////////////////////////////////////////////// Lighting component controls

static TAutoConsoleVariable<int32> CVarVolumetricCloudEnableAerialPerspectiveSampling(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	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."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

////////////////////////////////////////////////////////////////////////// Lighting component controls

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

Scope (from outer to inner):

file
lambda-function

Source code excerpt:

							if(CloudShadowTemporalEnabled && ViewInfo.ViewState)
							{
								const float LightRotationCutCosAngle = FMath::Cos(FMath::DegreesToRadians(CVarVolumetricCloudShadowTemporalFilteringLightRotationCutHistory.GetValueOnAnyThread()));

								FCloudShadowTemporalProcessCS::FPermutationDomain Permutation;
								TShaderMapRef<FCloudShadowTemporalProcessCS> ComputeShader(GetGlobalShaderMap(ViewInfo.GetFeatureLevel()), Permutation);

								FTemporalRenderTargetState& CloudShadowTemporalRT = ViewInfo.ViewState->VolumetricCloudShadowRenderTarget[LightIndex];
								FRDGTextureRef CurrentShadowTexture = CloudShadowTemporalRT.GetOrCreateCurrentRT(GraphBuilder);