ShowFlag.ContactShadows
ShowFlag.ContactShadows
#Overview
name: ShowFlag.ContactShadows
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to override a specific showflag (works in editor and game, \
It is referenced in 11
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.ContactShadows is to control the visibility of screen space contact shadows in the Unreal Engine rendering system. This setting is part of the lighting features in the engine’s rendering pipeline.
This setting variable is primarily used by the Unreal Engine’s rendering subsystem, specifically in the lighting and shadow components. It’s referenced in various parts of the engine, including the functional testing module and the core rendering module.
The value of this variable is typically set through the engine’s show flags system, which allows developers to toggle various rendering features on and off. It can be manipulated programmatically or through the engine’s user interface.
Several other variables interact with ShowFlag.ContactShadows:
- There’s an associated variable named
ContactShadows
used in various parts of the engine, particularly in the functional testing module. - It interacts with other lighting-related show flags and settings, such as ScreenSpaceAO, DistanceFieldAO, and EyeAdaptation.
Developers should be aware of the following when using this variable:
- Enabling contact shadows can have performance implications, especially on lower-end hardware.
- The effect of this flag depends on other lighting and shadow settings in the engine.
- It’s used in conjunction with a console variable (CVar) for additional control over contact shadow rendering.
Best practices when using this variable include:
- Consider the performance impact when enabling contact shadows, especially for mobile or VR projects.
- Use it in combination with other lighting and shadow techniques for the best visual results.
- Test the visual impact and performance with and without contact shadows enabled to find the right balance for your project.
Regarding the associated variable ContactShadows
:
The purpose of ContactShadows
is to provide a programmatic way to control the contact shadows feature, often used in functional testing and automation scenarios. It’s typically used to enable or disable contact shadows during automated tests or screenshot comparisons.
This variable is primarily used in the FunctionalTesting module of Unreal Engine. It’s often set and restored as part of test setup and teardown processes.
The value of this variable is typically set through the FConsoleVariableSwapperTempl
mechanism, which allows for temporary changes to console variables during testing.
Developers should be aware that changes to this variable may affect the visual output of the engine, which can be crucial for automated testing and screenshot comparisons.
Best practices for using this variable include:
- Always restore the original value after testing to avoid unintended side effects.
- Use it in conjunction with other rendering settings to ensure consistent test environments.
- Be aware of its impact on visual output when interpreting test results.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:149
Scope: file
Source code excerpt:
SHOWFLAG_ALWAYS_ACCESSIBLE(LumenReflections, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "LumenReflectionsSF", "Lumen Reflections"))
/** If Screen space contact shadows are enabled. */
SHOWFLAG_ALWAYS_ACCESSIBLE(ContactShadows, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "ContactShadows", "Screen Space Contact Shadows"))
/** If RTDF shadows are enabled. */
SHOWFLAG_ALWAYS_ACCESSIBLE(RayTracedDistanceFieldShadows, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "RayTracedDistanceFieldShadows", "Distance Field Shadows"))
/** If Capsule shadows are enabled. */
SHOWFLAG_ALWAYS_ACCESSIBLE(CapsuleShadows, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "CapsuleShadows", "Capsule Shadows"))
/** If Screen Space Subsurface Scattering enabled */
SHOWFLAG_FIXED_IN_SHIPPING(1, SubsurfaceScattering, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "SubsurfaceScatteringSF", "Subsurface Scattering (Screen Space)"))
#Associated Variable and Callsites
This variable is associated with another variable named ContactShadows
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:190
Scope (from outer to inner):
file
class class FAutomationViewExtension : public FWorldSceneViewExtension
function virtual void SetupViewFamily
Source code excerpt:
ShowFlags.SetScreenSpaceAO(ViewSettings->ScreenSpaceAO);
ShowFlags.SetDistanceFieldAO(ViewSettings->DistanceFieldAO);
ShowFlags.SetContactShadows(ViewSettings->ContactShadows);
ShowFlags.SetEyeAdaptation(ViewSettings->EyeAdaptation);
ShowFlags.SetBloom(ViewSettings->Bloom);
}
if (Options.bOverride_OverrideTimeTo)
{
#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:245
Scope (from outer to inner):
file
function FAutomationTestScreenshotEnvSetup::FAutomationTestScreenshotEnvSetup
Source code excerpt:
, ScreenSpaceReflectionQuality(TEXT("r.SSR.Quality"))
, EyeAdaptationQuality(TEXT("r.EyeAdaptationQuality"))
, ContactShadows(TEXT("r.ContactShadows"))
, TonemapperGamma(TEXT("r.TonemapperGamma"))
, TonemapperSharpen(TEXT("r.Tonemapper.Sharpen"))
, ScreenPercentage(TEXT("r.ScreenPercentage"))
, DynamicResTestScreenPercentage(TEXT("r.DynamicRes.TestScreenPercentage"))
, DynamicResOperationMode(TEXT("r.DynamicRes.OperationMode"))
, SecondaryScreenPercentage(TEXT("r.SecondaryScreenPercentage.GameViewport"))
#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:272
Scope (from outer to inner):
file
function void FAutomationTestScreenshotEnvSetup::Setup
Source code excerpt:
MotionBlurQuality.Set(0);
ScreenSpaceReflectionQuality.Set(0);
ContactShadows.Set(0);
EyeAdaptationQuality.Set(0);
TonemapperGamma.Set(2.2f);
}
else if (InOutOptions.bDisableTonemapping)
{
EyeAdaptationQuality.Set(0);
#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:330
Scope (from outer to inner):
file
function void FAutomationTestScreenshotEnvSetup::Restore
Source code excerpt:
ScreenSpaceReflectionQuality.Restore();
EyeAdaptationQuality.Restore();
ContactShadows.Restore();
TonemapperGamma.Restore();
//TonemapperSharpen.Restore();
ScreenPercentage.Restore();
DynamicResOperationMode.Restore();
DynamicResTestScreenPercentage.Restore();
SecondaryScreenPercentage.Restore();
#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Public/AutomationBlueprintFunctionLibrary.h:278
Scope (from outer to inner):
file
class class FAutomationTestScreenshotEnvSetup
Source code excerpt:
FConsoleVariableSwapperTempl<int32> ScreenSpaceReflectionQuality;
FConsoleVariableSwapperTempl<int32> EyeAdaptationQuality;
FConsoleVariableSwapperTempl<int32> ContactShadows;
FConsoleVariableSwapperTempl<float> TonemapperGamma;
FConsoleVariableSwapperTempl<float> TonemapperSharpen;
FConsoleVariableSwapperTempl<float> ScreenPercentage;
FConsoleVariableSwapperTempl<int32> DynamicResTestScreenPercentage;
FConsoleVariableSwapperTempl<int32> DynamicResOperationMode;
FConsoleVariableSwapperTempl<float> SecondaryScreenPercentage;
#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Public/AutomationViewSettings.h:21
Scope (from outer to inner):
file
class class UAutomationViewSettings : public UDataAsset
function UAutomationViewSettings
Source code excerpt:
, ScreenSpaceAO(true)
, DistanceFieldAO(true)
, ContactShadows(true)
, EyeAdaptation(true)
, Bloom(true)
{
}
UPROPERTY(EditAnywhere, Category="Rendering")
#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Public/AutomationViewSettings.h:46
Scope (from outer to inner):
file
class class UAutomationViewSettings : public UDataAsset
Source code excerpt:
UPROPERTY(EditAnywhere, Category="Rendering")
bool ContactShadows;
UPROPERTY(EditAnywhere, Category="Rendering")
bool EyeAdaptation;
UPROPERTY(EditAnywhere, Category = "Rendering")
bool Bloom;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:149
Scope: file
Source code excerpt:
SHOWFLAG_ALWAYS_ACCESSIBLE(LumenReflections, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "LumenReflectionsSF", "Lumen Reflections"))
/** If Screen space contact shadows are enabled. */
SHOWFLAG_ALWAYS_ACCESSIBLE(ContactShadows, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "ContactShadows", "Screen Space Contact Shadows"))
/** If RTDF shadows are enabled. */
SHOWFLAG_ALWAYS_ACCESSIBLE(RayTracedDistanceFieldShadows, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "RayTracedDistanceFieldShadows", "Distance Field Shadows"))
/** If Capsule shadows are enabled. */
SHOWFLAG_ALWAYS_ACCESSIBLE(CapsuleShadows, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "CapsuleShadows", "Capsule Shadows"))
/** If Screen Space Subsurface Scattering enabled */
SHOWFLAG_FIXED_IN_SHIPPING(1, SubsurfaceScattering, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "SubsurfaceScatteringSF", "Subsurface Scattering (Screen Space)"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:607
Scope (from outer to inner):
file
function FDeferredLightUniformStruct GetDeferredLightParameters
Source code excerpt:
Out.ContactShadowNonCastingIntensity = 0.0f;
if (ContactShadowsCVar && ContactShadowsCVar->GetValueOnRenderThread() != 0 && View.Family->EngineShowFlags.ContactShadows)
{
float ContactShadowLength;
bool bContactShadowLengthInWS;
float ContactShadowCastingIntensity;
float ContactShadowNonCastingIntensity;
GetLightContactShadowParameters(LightSceneInfo.Proxy, ContactShadowLength, bContactShadowLengthInWS, ContactShadowCastingIntensity, ContactShadowNonCastingIntensity);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Shadows/ScreenSpaceShadows.cpp:475
Scope (from outer to inner):
file
function void RenderScreenSpaceShadows
Source code excerpt:
RDG_EVENT_SCOPE_CONDITIONAL(GraphBuilder, Views.Num() > 1, "View%d", ViewIndex);
if (!View.Family->EngineShowFlags.ContactShadows)
{
continue;
}
FIntRect ScissorRect;
if (!LightSceneProxy->GetScissorRect(ScissorRect, View, View.ViewRect))