r.SkinCache.DefaultBehavior
r.SkinCache.DefaultBehavior
#Overview
name: r.SkinCache.DefaultBehavior
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Default behavior if all skeletal meshes are included/excluded from the skin cache. If Support Ray Tracing is enabled on a mesh, will force inclusive behavior on that mesh.\n Exclusive ( 0): All skeletal meshes are excluded from the skin cache. Each must opt in individually.\n Inclusive ( 1): All skeletal meshes are included into the skin cache. Each must opt out individually. (default)
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SkinCache.DefaultBehavior is to control the default behavior of the GPU Skin Cache system for skeletal meshes in Unreal Engine 5. It determines whether all skeletal meshes are included in or excluded from the skin cache by default.
This setting variable is primarily used by the rendering system, specifically the GPU Skin Cache subsystem. It is part of the Engine module and affects the behavior of SkinnedMeshComponents.
The value of this variable is set through the console variable system. It is defined as a TAutoConsoleVariable with a default value of 1 (Inclusive).
The associated variable CVarDefaultGPUSkinCacheBehavior directly interacts with r.SkinCache.DefaultBehavior. They share the same value and purpose.
Developers must be aware that:
- This variable affects all skeletal meshes in the project by default.
- It has two possible values: 0 (Exclusive) and 1 (Inclusive).
- When set to Inclusive (1), all skeletal meshes are included in the skin cache by default, and individual meshes must opt-out if needed.
- When set to Exclusive (0), all skeletal meshes are excluded from the skin cache by default, and individual meshes must opt-in if needed.
- The setting can be overridden for individual meshes that have “Support Ray Tracing” enabled, which forces inclusive behavior for those meshes.
Best practices when using this variable include:
- Consider the performance implications of including all meshes in the skin cache versus excluding them.
- Use this global setting in conjunction with per-mesh settings for fine-grained control over which meshes use the skin cache.
- Be aware of how this setting interacts with ray tracing support on individual meshes.
- Monitor performance and adjust the setting based on the specific needs of your project.
Regarding the associated variable CVarDefaultGPUSkinCacheBehavior:
- It serves the same purpose as r.SkinCache.DefaultBehavior.
- It is used internally by the engine to access and modify the skin cache default behavior.
- Developers should use the console command r.SkinCache.DefaultBehavior to modify this setting rather than directly manipulating CVarDefaultGPUSkinCacheBehavior.
- The variable is used in various parts of the engine, including the SkinnedMeshComponent and GPUSkinCache systems, to determine the default behavior of the skin cache.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:129, section: [/Script/Engine.RendererSettings]
- INI Section:
/Script/Engine.RendererSettings
- Raw value:
0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GPUSkinCache.cpp:108
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDefaultGPUSkinCacheBehavior(
TEXT("r.SkinCache.DefaultBehavior"),
(int32)ESkinCacheDefaultBehavior::Inclusive,
TEXT("Default behavior if all skeletal meshes are included/excluded from the skin cache. If Support Ray Tracing is enabled on a mesh, will force inclusive behavior on that mesh.\n")
TEXT(" Exclusive ( 0): All skeletal meshes are excluded from the skin cache. Each must opt in individually.\n")
TEXT(" Inclusive ( 1): All skeletal meshes are included into the skin cache. Each must opt out individually. (default)")
);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkinnedMeshComponent.cpp:2046
Scope (from outer to inner):
file
function bool USkinnedMeshComponent::IsSkinCacheAllowed
Source code excerpt:
bool USkinnedMeshComponent::IsSkinCacheAllowed(int32 LodIdx) const
{
static const IConsoleVariable* CVarDefaultGPUSkinCacheBehavior = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SkinCache.DefaultBehavior"));
const bool bGlobalDefault = CVarDefaultGPUSkinCacheBehavior && ESkinCacheDefaultBehavior(CVarDefaultGPUSkinCacheBehavior->GetInt()) == ESkinCacheDefaultBehavior::Inclusive;
if (GetMeshDeformerInstance() != nullptr)
{
// Disable skin cache if a mesh deformer is in use.
// Any animation buffers are expected to be owned by the MeshDeformer.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GPUSkinCache.cpp:207
Scope (from outer to inner):
file
function static inline bool IsGPUSkinCacheInclusive
Source code excerpt:
static inline bool IsGPUSkinCacheInclusive(EShaderPlatform Platform)
{
static FShaderPlatformCachedIniValue<int32> PerPlatformCVar(TEXT("r.SkinCache.DefaultBehavior"));
return (PerPlatformCVar.Get(Platform) != 0);
}
bool ShouldWeCompileGPUSkinVFShaders(EShaderPlatform Platform, ERHIFeatureLevel::Type FeatureLevel)
{
// If the skin cache is not available on this platform we need to compile GPU Skin VF shaders.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:7636
Scope (from outer to inner):
file
function bool UEngine::HandleSkeletalMeshReportCommand
Source code excerpt:
};
static const IConsoleVariable* DefaultGPUSkinCacheBehavior = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SkinCache.DefaultBehavior"));
bool bSkinCacheGlobalDefault = DefaultGPUSkinCacheBehavior && ESkinCacheDefaultBehavior(DefaultGPUSkinCacheBehavior->GetInt()) == ESkinCacheDefaultBehavior::Inclusive;
int32 NumMeshes = 0;
FRHIResourceInfo ResourceInfo;
for (TObjectIterator<USkeletalMesh> It; It; ++It)
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarDefaultGPUSkinCacheBehavior
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkinnedMeshComponent.cpp:2046
Scope (from outer to inner):
file
function bool USkinnedMeshComponent::IsSkinCacheAllowed
Source code excerpt:
bool USkinnedMeshComponent::IsSkinCacheAllowed(int32 LodIdx) const
{
static const IConsoleVariable* CVarDefaultGPUSkinCacheBehavior = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SkinCache.DefaultBehavior"));
const bool bGlobalDefault = CVarDefaultGPUSkinCacheBehavior && ESkinCacheDefaultBehavior(CVarDefaultGPUSkinCacheBehavior->GetInt()) == ESkinCacheDefaultBehavior::Inclusive;
if (GetMeshDeformerInstance() != nullptr)
{
// Disable skin cache if a mesh deformer is in use.
// Any animation buffers are expected to be owned by the MeshDeformer.
return false;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GPUSkinCache.cpp:107
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarDefaultGPUSkinCacheBehavior(
TEXT("r.SkinCache.DefaultBehavior"),
(int32)ESkinCacheDefaultBehavior::Inclusive,
TEXT("Default behavior if all skeletal meshes are included/excluded from the skin cache. If Support Ray Tracing is enabled on a mesh, will force inclusive behavior on that mesh.\n")
TEXT(" Exclusive ( 0): All skeletal meshes are excluded from the skin cache. Each must opt in individually.\n")
TEXT(" Inclusive ( 1): All skeletal meshes are included into the skin cache. Each must opt out individually. (default)")
);