r.Shadow.ResolutionScaleZeroDisablesSm
r.Shadow.ResolutionScaleZeroDisablesSm
#Overview
name: r.Shadow.ResolutionScaleZeroDisablesSm
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
DEPRECATED: If 1 (default) then setting Shadow Resolution Scale to zero disables shadow maps for the light.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shadow.ResolutionScaleZeroDisablesSm is to control whether setting the Shadow Resolution Scale to zero disables shadow maps for a light in Unreal Engine’s rendering system.
This setting variable is primarily used in the rendering system, specifically in the shadow rendering subsystem of Unreal Engine. It is referenced in the ShadowSetup.cpp file, which is part of the Renderer module.
The value of this variable is set using a TAutoConsoleVariable, which means it can be changed at runtime through console commands. It is initialized with a default value of 1.
The associated variable CVarResolutionScaleZeroDisablesSm directly interacts with r.Shadow.ResolutionScaleZeroDisablesSm. They share the same value and purpose.
Developers must be aware that:
- This variable is marked as DEPRECATED, indicating it may be removed in future versions of Unreal Engine.
- It affects the behavior of shadow map generation when the Shadow Resolution Scale is set to zero.
- The variable is checked on the render thread, which means changes to it will take effect immediately without requiring a engine restart.
Best practices when using this variable:
- Given its deprecated status, developers should look for alternative methods to control shadow map generation in newer versions of Unreal Engine.
- Use this variable cautiously, as disabling shadow maps can significantly affect the visual quality of the scene.
- When changing this variable, consider the performance implications, as enabling or disabling shadow maps can impact rendering performance.
Regarding the associated variable CVarResolutionScaleZeroDisablesSm:
The purpose of CVarResolutionScaleZeroDisablesSm is identical to r.Shadow.ResolutionScaleZeroDisablesSm. It is the actual console variable that controls the behavior described.
This variable is used in the CreateWholeSceneProjectedShadow function of the FSceneRenderer class. It’s checked to determine whether to early out of shadow creation when the shadow resolution scale is zero.
The value of this variable is set through the TAutoConsoleVariable constructor, with a default value of 1.
Developers should be aware that:
- This variable directly controls the behavior of shadow map generation when resolution scale is zero.
- It’s accessed on the render thread, which means changes take effect immediately.
Best practices for using CVarResolutionScaleZeroDisablesSm:
- Use this variable for quick testing or debugging of shadow rendering behavior.
- Be cautious when changing its value in a shipping game, as it can affect both visual quality and performance.
- Consider creating a user-facing setting that indirectly controls this variable if dynamic control over this behavior is needed in the final product.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowSetup.cpp:167
Scope: file
Source code excerpt:
*/
static TAutoConsoleVariable<int32> CVarResolutionScaleZeroDisablesSm(
TEXT("r.Shadow.ResolutionScaleZeroDisablesSm"),
1,
TEXT("DEPRECATED: If 1 (default) then setting Shadow Resolution Scale to zero disables shadow maps for the light."),
ECVF_RenderThreadSafe
);
#Associated Variable and Callsites
This variable is associated with another variable named CVarResolutionScaleZeroDisablesSm
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowSetup.cpp:166
Scope: file
Source code excerpt:
* This allows a quick hot-fix to disable the change if need be.
*/
static TAutoConsoleVariable<int32> CVarResolutionScaleZeroDisablesSm(
TEXT("r.Shadow.ResolutionScaleZeroDisablesSm"),
1,
TEXT("DEPRECATED: If 1 (default) then setting Shadow Resolution Scale to zero disables shadow maps for the light."),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowSetup.cpp:4045
Scope (from outer to inner):
file
function void FSceneRenderer::CreateWholeSceneProjectedShadow
Source code excerpt:
// early out if shadow resoluion scale is zero
if (CVarResolutionScaleZeroDisablesSm.GetValueOnRenderThread() != 0 && LightSceneInfo->Proxy->GetShadowResolutionScale() <= 0.0f)
{
return;
}
// Try to create a whole-scene projected shadow initializer for the light.
TArray<FWholeSceneProjectedShadowInitializer, TInlineAllocator<6> > ProjectedShadowInitializers;