r.HLOD.ForceDisableCastDynamicShadow
r.HLOD.ForceDisableCastDynamicShadow
#Overview
name: r.HLOD.ForceDisableCastDynamicShadow
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If non-zero, will set bCastDynamicShadow to false for all LODActors, regardless of the shadowing setting of their subactors.
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:
- Use it cautiously, as it affects all LODActors globally.
- Consider the visual impact of disabling dynamic shadows before enabling this feature.
- Use it as a performance optimization tool when dynamic shadows from LODActors are not crucial for the visual quality of the scene.
- Test thoroughly after changing this setting to ensure the desired balance between performance and visual quality is achieved.
Regarding the associated variable CVarHLODForceDisableCastDynamicShadow:
- Its purpose is identical to r.HLOD.ForceDisableCastDynamicShadow.
- It’s used in the Engine module, specifically in the LODActor class.
- Its value is set and accessed using the GetValueOnAnyThread() method.
- It directly affects the bCastDynamicShadow property of the StaticMeshComponent in LODActors.
- Developers should be aware that this variable is marked as ECVF_ReadOnly, meaning it should not be modified at runtime.
- Best practices include using this variable for performance profiling and optimization, and ensuring it’s set before the game begins, as changing it during runtime may not have the intended effect due to its read-only nature.
#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)