r.CapsuleShadows
r.CapsuleShadows
#Overview
name: r.CapsuleShadows
The value of this variable can be defined or overridden in .ini config files. 5
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to allow capsule shadowing on skinned components with bCastCapsuleDirectShadow or bCastCapsuleIndirectShadow enabled.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.CapsuleShadows is to control whether capsule shadowing is allowed on skinned components that have either bCastCapsuleDirectShadow or bCastCapsuleIndirectShadow enabled. This setting variable is primarily used in the rendering system, specifically for shadow rendering.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evident from the file location (CapsuleShadowRendering.cpp in the Renderer/Private directory).
The value of this variable is set through the console variable system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime using the console command “r.CapsuleShadows”.
This variable interacts with two other variables: GCapsuleDirectShadows and GCapsuleIndirectShadows. These variables work together to control different aspects of capsule shadow rendering.
Developers must be aware that this variable affects performance and visual quality. Enabling capsule shadows can provide more accurate shadowing for skinned components but may have a performance cost.
Best practices when using this variable include:
- Consider the performance implications when enabling capsule shadows, especially on lower-end hardware.
- Use in conjunction with bCastCapsuleDirectShadow and bCastCapsuleIndirectShadow on skinned components for fine-grained control.
- Test the visual and performance impact with different settings to find the optimal balance for your project.
Regarding the associated variable GCapsuleShadows:
The purpose of GCapsuleShadows is to serve as the internal representation of the r.CapsuleShadows console variable. It’s used directly in the code to check whether capsule shadows are enabled.
This variable is used in the Renderer module, specifically in the capsule shadow rendering system.
The value of GCapsuleShadows is set by the console variable system when r.CapsuleShadows is modified.
GCapsuleShadows interacts with GCapsuleDirectShadows and GCapsuleIndirectShadows to determine the overall capsule shadow rendering behavior.
Developers should be aware that modifying GCapsuleShadows directly in code is not recommended. Instead, they should use the r.CapsuleShadows console variable to change its value.
Best practices for GCapsuleShadows include:
- Use it for conditional checks in rendering code to determine if capsule shadows should be processed.
- Avoid modifying it directly; use the console variable system instead.
- Consider its value when optimizing rendering performance, as it can significantly impact the shadow rendering workload.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:140, section: [ShadowQuality@0]
- INI Section:
ShadowQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:164, section: [ShadowQuality@1]
- INI Section:
ShadowQuality@1
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:191, section: [ShadowQuality@2]
- INI Section:
ShadowQuality@2
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:218, section: [ShadowQuality@3]
- INI Section:
ShadowQuality@3
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:245, section: [ShadowQuality@Cine]
- INI Section:
ShadowQuality@Cine
- Raw value:
1
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CapsuleShadowRendering.cpp:34
Scope: file
Source code excerpt:
int32 GCapsuleShadows = 1;
FAutoConsoleVariableRef CVarCapsuleShadows(
TEXT("r.CapsuleShadows"),
GCapsuleShadows,
TEXT("Whether to allow capsule shadowing on skinned components with bCastCapsuleDirectShadow or bCastCapsuleIndirectShadow enabled."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GCapsuleDirectShadows = 1;
#Associated Variable and Callsites
This variable is associated with another variable named GCapsuleShadows
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CapsuleShadowRendering.cpp:32
Scope: file
Source code excerpt:
DECLARE_GPU_STAT_NAMED(CapsuleShadows, TEXT("Capsule Shadows"));
int32 GCapsuleShadows = 1;
FAutoConsoleVariableRef CVarCapsuleShadows(
TEXT("r.CapsuleShadows"),
GCapsuleShadows,
TEXT("Whether to allow capsule shadowing on skinned components with bCastCapsuleDirectShadow or bCastCapsuleIndirectShadow enabled."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GCapsuleDirectShadows = 1;
FAutoConsoleVariableRef CVarCapsuleDirectShadows(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CapsuleShadowRendering.h:9
Scope: file
Source code excerpt:
#include "DataDrivenShaderPlatformInfo.h"
extern int32 GCapsuleShadows;
extern int32 GCapsuleDirectShadows;
extern int32 GCapsuleIndirectShadows;
inline bool SupportsCapsuleShadows(FStaticShaderPlatform ShaderPlatform)
{
return GCapsuleShadows
&& FDataDrivenShaderPlatformInfo::GetSupportsCapsuleShadows(ShaderPlatform);
}
inline bool SupportsCapsuleDirectShadows(FStaticShaderPlatform ShaderPlatform)
{
return GCapsuleDirectShadows && SupportsCapsuleShadows(ShaderPlatform);