r.GPUSkin.AlwaysUseDeformerForUnlimitedBoneInfluences
r.GPUSkin.AlwaysUseDeformerForUnlimitedBoneInfluences
#Overview
name: r.GPUSkin.AlwaysUseDeformerForUnlimitedBoneInfluences
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Any meshes using Unlimited Bone Influences will always be rendered with a Mesh Deformer. This reduces the number of shader permutations needed for skeletal mesh materials, saving memory at the cost of performance. Has no effect if either Unlimited Bone Influences or Deformer Graph is disabled. Cannot be changed at runtime.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.GPUSkin.AlwaysUseDeformerForUnlimitedBoneInfluences is to control whether meshes using Unlimited Bone Influences are always rendered with a Mesh Deformer. This setting is primarily used in the GPU skinning system of Unreal Engine 5.
This setting variable is utilized by the GPU skinning subsystem within Unreal Engine’s rendering module. Specifically, it’s referenced in the GPUSkinVertexFactory implementation, which is responsible for handling vertex processing for skeletal meshes.
The value of this variable is set through the console variable system. It’s defined as a read-only console variable, meaning its value cannot be changed at runtime. The initial value is set to false.
This variable interacts with other settings related to GPU skinning and mesh deformation, particularly those concerning Unlimited Bone Influences and the Mesh Deformer system. It works in conjunction with the r.GPUSkin.UnlimitedBoneInfluences setting (referenced as UBICVar in the code).
Developers must be aware that:
- This setting only has an effect if both Unlimited Bone Influences and Deformer Graph features are enabled.
- Enabling this option reduces the number of shader permutations needed for skeletal mesh materials, which can save memory but may impact performance.
- The setting cannot be changed at runtime, so it must be set appropriately before launching the application.
Best practices when using this variable include:
- Carefully consider the trade-off between memory savings and potential performance impact before enabling this setting.
- Ensure that both Unlimited Bone Influences and Deformer Graph features are enabled if you intend to use this setting.
- Test thoroughly with this setting both enabled and disabled to determine the optimal configuration for your specific use case.
- Be aware that this setting may affect shader compilation times and the overall size of your shader cache.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GPUSkinVertexFactory.cpp:64
Scope: file
Source code excerpt:
static bool GCVarAlwaysUseDeformerForUnlimitedBoneInfluences = false;
static FAutoConsoleVariableRef CVarAlwaysUseDeformerForUnlimitedBoneInfluences(
TEXT("r.GPUSkin.AlwaysUseDeformerForUnlimitedBoneInfluences"),
GCVarAlwaysUseDeformerForUnlimitedBoneInfluences,
TEXT("Any meshes using Unlimited Bone Influences will always be rendered with a Mesh Deformer. This reduces the number of shader permutations needed for skeletal mesh materials, saving memory at the cost of performance. Has no effect if either Unlimited Bone Influences or Deformer Graph is disabled. Cannot be changed at runtime."),
ECVF_ReadOnly);
static TAutoConsoleVariable<bool> CVarMobileEnableCloth(
TEXT("r.Mobile.EnableCloth"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GPUSkinVertexFactory.cpp:498
Scope (from outer to inner):
file
function bool FGPUBaseSkinVertexFactory::GetAlwaysUseDeformerForUnlimitedBoneInfluences
lambda-function
Source code excerpt:
auto InnerFunc = [](EShaderPlatform Platform)
{
static FShaderPlatformCachedIniValue<bool> UseDeformerForUBICVar(TEXT("r.GPUSkin.AlwaysUseDeformerForUnlimitedBoneInfluences"));
const IMeshDeformerProvider* MeshDeformerProvider = IMeshDeformerProvider::Get();
return MeshDeformerProvider && MeshDeformerProvider->IsSupported(Platform) && UseDeformerForUBICVar.Get(Platform);
};
#if WITH_EDITOR
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GPUSkinVertexFactory.cpp:565
Scope (from outer to inner):
file
function bool TGPUSkinVertexFactory<BoneInfluenceType>::ShouldCompilePermutation
Source code excerpt:
const bool bUseUBI = UBICVar.Get(Parameters.Platform) != 0;
static FShaderPlatformCachedIniValue<bool> UseDeformerForUBICVar(TEXT("r.GPUSkin.AlwaysUseDeformerForUnlimitedBoneInfluences"));
const bool bUseDeformerForUBI = UseDeformerForUBICVar.Get(Parameters.Platform);
// Compile the shader for UBI if UBI is enabled and we're not forcing the use of a deformer for all UBI meshes
const bool bUnlimitedBoneInfluences = BoneInfluenceType == UnlimitedBoneInfluence && bUseUBI && !bUseDeformerForUBI;
return ShouldWeCompileGPUSkinVFShaders(Parameters.Platform, Parameters.MaterialParameters.FeatureLevel) &&