r.ContactShadows.OverrideLength
r.ContactShadows.OverrideLength
#Overview
name: r.ContactShadows.OverrideLength
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows overriding the contact shadow length for all directional lights.\nDisabled when < 0.\nShould generally be left disabled outside of debugging.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ContactShadows.OverrideLength is to allow overriding the contact shadow length for all directional lights in Unreal Engine 5. This setting is primarily used for the rendering system, specifically for contact shadow calculations.
This setting variable is utilized by the Renderer module of Unreal Engine, as evident from its location in the LightRendering.cpp file within the Runtime/Renderer directory.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of -1.0f, which means it’s disabled by default.
The associated variable CVarContactShadowsOverrideLength directly interacts with r.ContactShadows.OverrideLength. They share the same value and purpose.
Developers must be aware that this variable is intended for debugging purposes and should generally be left disabled in production builds. When enabled (value >= 0), it overrides the contact shadow length for all directional lights, which may not be desirable in most gameplay scenarios.
Best practices for using this variable include:
- Only enable it for debugging or specific visual testing scenarios.
- Remember to disable it (set to < 0) when not actively debugging.
- Be cautious when using it in conjunction with other lighting and shadow settings, as it may interfere with intended lighting behavior.
Regarding the associated variable CVarContactShadowsOverrideLength:
- It serves the same purpose as r.ContactShadows.OverrideLength.
- It’s used in the GetLightContactShadowParameters function to potentially override the contact shadow length.
- When using this variable, developers should be aware that it affects all directional lights in the scene.
- Best practices include using it sparingly and in controlled environments, as it can significantly alter the visual appearance of shadows in the game.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:147
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarContactShadowsOverrideLength(
TEXT("r.ContactShadows.OverrideLength"),
-1.0f,
TEXT("Allows overriding the contact shadow length for all directional lights.\n")
TEXT("Disabled when < 0.\n")
TEXT("Should generally be left disabled outside of debugging."),
ECVF_RenderThreadSafe);
#Associated Variable and Callsites
This variable is associated with another variable named CVarContactShadowsOverrideLength
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:146
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarContactShadowsOverrideLength(
TEXT("r.ContactShadows.OverrideLength"),
-1.0f,
TEXT("Allows overriding the contact shadow length for all directional lights.\n")
TEXT("Disabled when < 0.\n")
TEXT("Should generally be left disabled outside of debugging."),
ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:242
Scope (from outer to inner):
file
function void GetLightContactShadowParameters
Source code excerpt:
OutNonCastingIntensity = Proxy->GetContactShadowNonCastingIntensity();
if (CVarContactShadowsOverrideLength.GetValueOnAnyThread() >= 0.0f)
{
OutLength = CVarContactShadowsOverrideLength.GetValueOnAnyThread();
bOutLengthInWS = CVarContactShadowsOverrideLengthInWS.GetValueOnAnyThread();
}
if (CVarContactShadowsOverrideShadowCastingIntensity.GetValueOnAnyThread() >= 0.0f)
{
OutCastingIntensity = CVarContactShadowsOverrideShadowCastingIntensity.GetValueOnAnyThread();