r.Shadow.ForceSingleSampleShadowingFromStationary
r.Shadow.ForceSingleSampleShadowingFromStationary
#Overview
name: r.Shadow.ForceSingleSampleShadowingFromStationary
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to force all components to act as if they have bSingleSampleShadowFromStationaryLights enabled. Useful for scalability when dynamic shadows are disabled.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shadow.ForceSingleSampleShadowingFromStationary
is to control shadow rendering behavior for stationary lights. It is used in the rendering system, specifically for shadow calculations.
This setting variable is primarily used in the Engine module, as evidenced by its location in the PrimitiveSceneProxy.cpp
file within the Engine source directory.
The value of this variable is set through a console variable (CVar) system, allowing it to be changed at runtime. It is initialized with a default value of 0.
This variable interacts with the CVarForceSingleSampleShadowingFromStationary
CVar, which is directly associated with it. They share the same value and purpose.
Developers must be aware that this variable affects the shadow rendering behavior of all components, potentially overriding individual component settings. It’s particularly useful for scalability purposes when dynamic shadows are disabled.
Best practices when using this variable include:
- Use it for performance optimization in scenarios where dynamic shadows are disabled.
- Be cautious when enabling it, as it may affect the visual quality of shadows in the scene.
- Consider the impact on different hardware configurations, as it’s marked with the
ECVF_Scalability
flag.
Regarding the associated variable CVarForceSingleSampleShadowingFromStationary
:
This is the actual CVar object that stores and manages the value of r.Shadow.ForceSingleSampleShadowingFromStationary
. It is defined as an integer CVar, initialized with a value of 0.
The purpose of this CVar is to provide a way to force all components to act as if they have the bSingleSampleShadowFromStationaryLights
property enabled. This can be useful for scalability when dynamic shadows are disabled.
This CVar is used in the UseSingleSampleShadowFromStationaryLights()
function of the FPrimitiveSceneProxy
class to determine whether single sample shadowing should be used.
Developers should be aware that this CVar is marked as render thread safe (ECVF_RenderThreadSafe
), meaning it can be safely accessed from the render thread. It’s also marked for scalability (ECVF_Scalability
), indicating its potential impact on performance across different hardware configurations.
When using this CVar, developers should consider its performance implications and use it in conjunction with other shadow and lighting settings to achieve the desired balance between visual quality and performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PrimitiveSceneProxy.cpp:35
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarForceSingleSampleShadowingFromStationary(
TEXT("r.Shadow.ForceSingleSampleShadowingFromStationary"),
0,
TEXT("Whether to force all components to act as if they have bSingleSampleShadowFromStationaryLights enabled. Useful for scalability when dynamic shadows are disabled."),
ECVF_RenderThreadSafe | ECVF_Scalability
);
static TAutoConsoleVariable<bool> CVarOptimizedWPOAffectNonNaniteShaderSelection(
#Associated Variable and Callsites
This variable is associated with another variable named CVarForceSingleSampleShadowingFromStationary
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PrimitiveSceneProxy.cpp:34
Scope: file
Source code excerpt:
#endif
static TAutoConsoleVariable<int32> CVarForceSingleSampleShadowingFromStationary(
TEXT("r.Shadow.ForceSingleSampleShadowingFromStationary"),
0,
TEXT("Whether to force all components to act as if they have bSingleSampleShadowFromStationaryLights enabled. Useful for scalability when dynamic shadows are disabled."),
ECVF_RenderThreadSafe | ECVF_Scalability
);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PrimitiveSceneProxy.cpp:981
Scope (from outer to inner):
file
function bool FPrimitiveSceneProxy::UseSingleSampleShadowFromStationaryLights
Source code excerpt:
{
return bSingleSampleShadowFromStationaryLights
|| CVarForceSingleSampleShadowingFromStationary.GetValueOnRenderThread() != 0
|| LightmapType == ELightmapType::ForceVolumetric;
}
#if ENABLE_DRAW_DEBUG
void FPrimitiveSceneProxy::SetDebugMassData(const TArray<FDebugMassData>& InDebugMassData)
{