r.CapsuleDirectShadows
r.CapsuleDirectShadows
#Overview
name: r.CapsuleDirectShadows
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to allow capsule direct shadowing on skinned components with bCastCapsuleDirectShadow enabled.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.CapsuleDirectShadows is to control whether capsule direct shadowing is allowed on skinned components that have bCastCapsuleDirectShadow enabled. This setting is part of the rendering system, specifically related to shadow rendering for character models.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, as evidenced by its location in the CapsuleShadowRendering.cpp and CapsuleShadowRendering.h files within the Runtime/Renderer directory.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands. It is initialized with a default value of 1 (enabled).
The associated variable GCapsuleDirectShadows interacts directly with r.CapsuleDirectShadows. They share the same value, with GCapsuleDirectShadows being the actual integer variable used in the code, while r.CapsuleDirectShadows is the console variable name used to modify it.
Developers should be aware that this variable affects performance and visual quality. Enabling capsule direct shadows can provide more accurate shadows for character models but may have a performance cost.
Best practices when using this variable include:
- Consider the performance impact when enabling it, especially on lower-end hardware.
- Use it in conjunction with the bCastCapsuleDirectShadow property on skinned components for fine-grained control.
- Test the visual and performance differences with it enabled and disabled to find the right balance for your project.
Regarding the associated variable GCapsuleDirectShadows:
- Its purpose is to store the actual value of the r.CapsuleDirectShadows setting within the engine’s code.
- It is used in the Renderer module, specifically in functions that determine whether capsule direct shadows are supported for a given shader platform.
- Its value is set by the r.CapsuleDirectShadows console variable.
- It interacts with other capsule shadow-related variables like GCapsuleShadows and GCapsuleIndirectShadows.
- Developers should be aware that modifying GCapsuleDirectShadows directly in code is not recommended; instead, they should use the r.CapsuleDirectShadows console variable.
- Best practice is to treat GCapsuleDirectShadows as a read-only variable in code and rely on the console variable system for modifications.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CapsuleShadowRendering.cpp:42
Scope: file
Source code excerpt:
int32 GCapsuleDirectShadows = 1;
FAutoConsoleVariableRef CVarCapsuleDirectShadows(
TEXT("r.CapsuleDirectShadows"),
GCapsuleDirectShadows,
TEXT("Whether to allow capsule direct shadowing on skinned components with bCastCapsuleDirectShadow enabled."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GCapsuleIndirectShadows = 1;
#Associated Variable and Callsites
This variable is associated with another variable named GCapsuleDirectShadows
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CapsuleShadowRendering.cpp:40
Scope: file
Source code excerpt:
);
int32 GCapsuleDirectShadows = 1;
FAutoConsoleVariableRef CVarCapsuleDirectShadows(
TEXT("r.CapsuleDirectShadows"),
GCapsuleDirectShadows,
TEXT("Whether to allow capsule direct shadowing on skinned components with bCastCapsuleDirectShadow enabled."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GCapsuleIndirectShadows = 1;
FAutoConsoleVariableRef CVarCapsuleIndirectShadows(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CapsuleShadowRendering.h:10
Scope: file
Source code excerpt:
extern int32 GCapsuleShadows;
extern int32 GCapsuleDirectShadows;
extern int32 GCapsuleIndirectShadows;
inline bool SupportsCapsuleShadows(FStaticShaderPlatform ShaderPlatform)
{
return GCapsuleShadows
&& FDataDrivenShaderPlatformInfo::GetSupportsCapsuleShadows(ShaderPlatform);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CapsuleShadowRendering.h:21
Scope (from outer to inner):
file
function inline bool SupportsCapsuleDirectShadows
Source code excerpt:
inline bool SupportsCapsuleDirectShadows(FStaticShaderPlatform ShaderPlatform)
{
return GCapsuleDirectShadows && SupportsCapsuleShadows(ShaderPlatform);
}
inline bool SupportsCapsuleIndirectShadows(FStaticShaderPlatform ShaderPlatform)
{
return GCapsuleIndirectShadows && SupportsCapsuleShadows(ShaderPlatform);
}