r.ForceLODShadow
r.ForceLODShadow
#Overview
name: r.ForceLODShadow
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
LOD level to force for the shadow map generation only, -1 is off.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ForceLODShadow is to force a specific Level of Detail (LOD) for shadow map generation in the rendering system. This setting allows developers to control the LOD used for shadow mapping independently of the main object rendering.
This setting variable is primarily used by Unreal Engine’s rendering subsystem, specifically in the shadow mapping component of the renderer. It’s defined in the RenderCore module, which is a core part of the engine’s rendering pipeline.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of -1, which means the feature is off by default. Developers can change this value at runtime using console commands or through configuration files.
The associated variable CVarForceLODShadow is the actual console variable object that stores and manages the r.ForceLODShadow setting. They share the same value and purpose.
Developers must be aware that:
- This variable affects only shadow map generation, not the overall LOD of objects in the scene.
- Setting a value other than -1 will force all shadow maps to use that specific LOD level, which may impact performance and visual quality.
- This setting is marked as scalable and render thread safe, meaning it can be adjusted for different quality settings and can be safely modified during rendering.
Best practices when using this variable include:
- Use it primarily for debugging or specific optimization scenarios.
- Be cautious when setting it to a non-default value in production, as it may impact performance or visual quality unexpectedly.
- When adjusting this value, also consider its impact on overall rendering performance and shadow quality.
Regarding the associated variable CVarForceLODShadow:
- It’s an instance of TAutoConsoleVariable
, which is Unreal Engine’s type for integer console variables. - It’s used to get the current value of the setting in different contexts (render thread or any thread) through GetValueOnRenderThread() and GetValueOnAnyThread() methods.
- When working with this variable in C++ code, developers should use the appropriate getter method based on which thread they’re operating on to ensure thread safety.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderCore.cpp:216
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarForceLODShadow(
TEXT("r.ForceLODShadow"),
-1,
TEXT("LOD level to force for the shadow map generation only, -1 is off."),
ECVF_Scalability | ECVF_Default | ECVF_RenderThreadSafe
);
#endif // EXPOSE_FORCE_LOD
#Associated Variable and Callsites
This variable is associated with another variable named CVarForceLODShadow
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderCore.cpp:215
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarForceLODShadow(
TEXT("r.ForceLODShadow"),
-1,
TEXT("LOD level to force for the shadow map generation only, -1 is off."),
ECVF_Scalability | ECVF_Default | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderCore.cpp:307
Scope (from outer to inner):
file
function int32 GetCVarForceLODShadow
Source code excerpt:
#if EXPOSE_FORCE_LOD
{
Ret = CVarForceLODShadow.GetValueOnRenderThread();
}
#endif // EXPOSE_FORCE_LOD
return Ret;
}
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderCore.cpp:320
Scope (from outer to inner):
file
function int32 GetCVarForceLODShadow_AnyThread
Source code excerpt:
#if EXPOSE_FORCE_LOD
{
Ret = CVarForceLODShadow.GetValueOnAnyThread();
}
#endif // EXPOSE_FORCE_LOD
return Ret;
}