r.HLOD.ForceDisableCastDynamicShadow

r.HLOD.ForceDisableCastDynamicShadow

#Overview

name: r.HLOD.ForceDisableCastDynamicShadow

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.HLOD.ForceDisableCastDynamicShadow is to control the dynamic shadow casting behavior of LODActors (Level of Detail Actors) in the rendering system. This setting variable is part of Unreal Engine’s HLOD (Hierarchical Level of Detail) system, which is used to optimize rendering performance for complex scenes.

This setting variable is primarily used by the rendering system and the HLOD subsystem within Unreal Engine. It’s specifically referenced in the Engine module, as seen in the LODActor.cpp file.

The value of this variable is set through a console variable (CVar) using the TAutoConsoleVariable template. It’s initialized with a default value of 0, meaning the feature is disabled by default.

The associated variable CVarHLODForceDisableCastDynamicShadow directly interacts with r.HLOD.ForceDisableCastDynamicShadow. They share the same value and purpose.

Developers must be aware that when this variable is set to a non-zero value, it will forcibly disable dynamic shadow casting for all LODActors, regardless of the shadow casting settings of their subactors. This can have a significant impact on the visual quality and performance of the game or application.

Best practices when using this variable include:

  1. Use it cautiously, as it affects all LODActors globally.
  2. Consider the visual impact of disabling dynamic shadows before enabling this feature.
  3. Use it as a performance optimization tool when dynamic shadows from LODActors are not crucial for the visual quality of the scene.
  4. Test thoroughly after changing this setting to ensure the desired balance between performance and visual quality is achieved.

Regarding the associated variable CVarHLODForceDisableCastDynamicShadow:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LODActor.cpp:67

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHLODForceDisableCastDynamicShadow(
	TEXT("r.HLOD.ForceDisableCastDynamicShadow"),
	0,
	TEXT("If non-zero, will set bCastDynamicShadow to false for all LODActors, regardless of the shadowing setting of their subactors."),
	ECVF_ReadOnly);

ENGINE_API TArray<float> ALODActor::HLODDistances;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LODActor.cpp:66

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHLODForceDisableCastDynamicShadow(
	TEXT("r.HLOD.ForceDisableCastDynamicShadow"),
	0,
	TEXT("If non-zero, will set bCastDynamicShadow to false for all LODActors, regardless of the shadowing setting of their subactors."),
	ECVF_ReadOnly);

ENGINE_API TArray<float> ALODActor::HLODDistances;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LODActor.cpp:263

Scope (from outer to inner):

file
function     void ALODActor::PostLoad

Source code excerpt:


	// Force disabled dynamic shadow casting if requested from CVar
	if (CVarHLODForceDisableCastDynamicShadow.GetValueOnAnyThread() != 0)
	{
		StaticMeshComponent->bCastDynamicShadow = false;
	}

#if WITH_EDITOR
	if (bRequiresLODScreenSizeConversion)