r.ContactShadows.OverrideShadowCastingIntensity
r.ContactShadows.OverrideShadowCastingIntensity
#Overview
name: r.ContactShadows.OverrideShadowCastingIntensity
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows overriding the contact shadow casting intensity 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.OverrideShadowCastingIntensity is to override the contact shadow casting intensity for all directional lights in the rendering system of Unreal Engine 5.
This setting variable is primarily used by the Renderer module, specifically in the light rendering subsystem. It’s defined in the LightRendering.cpp file, which is part of the core rendering functionality.
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 CVarContactShadowsOverrideShadowCastingIntensity interacts directly with r.ContactShadows.OverrideShadowCastingIntensity. 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 casting intensity for all directional lights, which could significantly impact the visual quality and performance of the rendering.
Best practices for using this variable include:
- Only enable it for debugging specific lighting issues.
- Always reset it to its default value (-1.0f) after debugging.
- Be cautious when using it in performance-sensitive scenarios, as it affects all directional lights.
Regarding the associated variable CVarContactShadowsOverrideShadowCastingIntensity:
It’s a console variable of type float, created using TAutoConsoleVariable. It’s used to actually store and retrieve the value of r.ContactShadows.OverrideShadowCastingIntensity.
The variable is checked in the GetLightContactShadowParameters function. If its value is greater than or equal to 0.0f, it overrides the OutCastingIntensity parameter, which likely controls the intensity of contact shadows for directional lights.
Developers should be aware that this variable is accessed using GetValueOnAnyThread(), which means it can be safely read from any thread. However, changing its value might have immediate effects on the rendering, so it should be used cautiously, especially in multi-threaded environments.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:161
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarContactShadowsOverrideShadowCastingIntensity(
TEXT("r.ContactShadows.OverrideShadowCastingIntensity"),
-1.0f,
TEXT("Allows overriding the contact shadow casting intensity 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 CVarContactShadowsOverrideShadowCastingIntensity
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:160
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarContactShadowsOverrideShadowCastingIntensity(
TEXT("r.ContactShadows.OverrideShadowCastingIntensity"),
-1.0f,
TEXT("Allows overriding the contact shadow casting intensity 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:248
Scope (from outer to inner):
file
function void GetLightContactShadowParameters
Source code excerpt:
}
if (CVarContactShadowsOverrideShadowCastingIntensity.GetValueOnAnyThread() >= 0.0f)
{
OutCastingIntensity = CVarContactShadowsOverrideShadowCastingIntensity.GetValueOnAnyThread();
}
if (CVarContactShadowsOverrideNonShadowCastingIntensity.GetValueOnAnyThread() >= 0.0f)
{
OutNonCastingIntensity = CVarContactShadowsOverrideNonShadowCastingIntensity.GetValueOnAnyThread();
}