r.Shadow.Virtual.ResolutionLodBiasLocalMoving

r.Shadow.Virtual.ResolutionLodBiasLocalMoving

#Overview

name: r.Shadow.Virtual.ResolutionLodBiasLocalMoving

The value of this variable can be defined or overridden in .ini config files. 5 .ini config files referencing this setting variable.

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.Virtual.ResolutionLodBiasLocalMoving is to control the resolution of virtual shadow maps for local moving lights in Unreal Engine 5’s rendering system. This setting variable allows developers to adjust the level of detail (LOD) for shadows cast by moving lights, affecting the visual quality and performance of shadow rendering.

This setting variable is primarily used by the Renderer module, specifically within the shadow rendering subsystem. It is defined and utilized in the ShadowSceneRenderer.cpp file, which is responsible for handling shadow rendering in the engine.

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

This variable interacts with CVarResolutionLodBiasLocal, which is used for non-moving local lights. The system smoothly transitions between these two values based on the light’s movement state.

Developers should be aware that:

  1. The bias value affects shadow resolution: negative values increase resolution, while positive values decrease it.
  2. The setting is scalable and can be adjusted for different performance targets.
  3. It’s render thread safe, meaning it can be modified without causing thread safety issues.

Best practices when using this variable include:

  1. Carefully balancing visual quality and performance by adjusting the bias value.
  2. Testing the impact of different values on various hardware configurations.
  3. Considering the interaction with other shadow-related settings, such as ‘r.Shadow.Scene.LightActiveFrameCount’.

Regarding the associated variable CVarResolutionLodBiasLocalMoving: This is the actual console variable that stores and provides access to the r.Shadow.Virtual.ResolutionLodBiasLocalMoving value. It is used internally by the engine to retrieve the current setting value, particularly in the GetResolutionLODBiasLocal function. Developers typically don’t need to interact with this variable directly, as they can modify the setting through the r.Shadow.Virtual.ResolutionLodBiasLocalMoving console command or related engine interfaces.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:145, section: [ShadowQuality@0]

Location: <Workspace>/Engine/Config/BaseScalability.ini:169, section: [ShadowQuality@1]

Location: <Workspace>/Engine/Config/BaseScalability.ini:196, section: [ShadowQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:223, section: [ShadowQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:250, section: [ShadowQuality@Cine]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Shadows/ShadowSceneRenderer.cpp:70

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarResolutionLodBiasLocalMoving(
	TEXT("r.Shadow.Virtual.ResolutionLodBiasLocalMoving"),
	1.0f,
	TEXT("Bias applied to LOD calculations for local lights that are moving. -1.0 doubles resolution, 1.0 halves it and so on.\n")
	TEXT("The bias transitions smoothly back to ResolutionLodBiasLocal as the light transitions to non-moving, see 'r.Shadow.Scene.LightActiveFrameCount'."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Shadows/ShadowSceneRenderer.cpp:69

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<float> CVarResolutionLodBiasLocalMoving(
	TEXT("r.Shadow.Virtual.ResolutionLodBiasLocalMoving"),
	1.0f,
	TEXT("Bias applied to LOD calculations for local lights that are moving. -1.0 doubles resolution, 1.0 halves it and so on.\n")
	TEXT("The bias transitions smoothly back to ResolutionLodBiasLocal as the light transitions to non-moving, see 'r.Shadow.Scene.LightActiveFrameCount'."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Shadows/ShadowSceneRenderer.cpp:186

Scope (from outer to inner):

file
function     static float GetResolutionLODBiasLocal

Source code excerpt:

	return FVirtualShadowMapArray::InterpolateResolutionBias(
		CVarResolutionLodBiasLocal.GetValueOnRenderThread(),
		CVarResolutionLodBiasLocalMoving.GetValueOnRenderThread(),
		LightMobilityFactor) + LightLODBias;
}

FVirtualShadowMapProjectionShaderData FShadowSceneRenderer::GetLocalLightProjectionShaderData(
	float ResolutionLODBiasLocal,
	const FProjectedShadowInfo* ProjectedShadowInfo,