r.CapsuleDirectShadows

r.CapsuleDirectShadows

#Overview

name: r.CapsuleDirectShadows

This variable is created as a Console Variable (cvar).

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:

  1. Consider the performance impact when enabling it, especially on lower-end hardware.
  2. Use it in conjunction with the bCastCapsuleDirectShadow property on skinned components for fine-grained control.
  3. Test the visual and performance differences with it enabled and disabled to find the right balance for your project.

Regarding the associated variable GCapsuleDirectShadows:

#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);
}