r.GPUSkin.UnlimitedBoneInfluences

r.GPUSkin.UnlimitedBoneInfluences

#Overview

name: r.GPUSkin.UnlimitedBoneInfluences

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).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.GPUSkin.UnlimitedBoneInfluences is to control whether unlimited bone influences are used instead of the default 4 or 8 bone influences for GPU skinning in Unreal Engine’s rendering system.

This setting variable is primarily used in the GPU skinning subsystem of Unreal Engine’s rendering module. It affects the behavior of the GPUSkinVertexFactory, which is responsible for processing skeletal mesh vertices on the GPU.

The value of this variable is set through the console variable system (CVarUnlimitedBoneInfluences) and is marked as read-only, meaning it cannot be changed at runtime. It’s typically set in the engine configuration files or through command-line arguments.

This variable interacts with other related variables, such as GCVarUnlimitedBoneInfluencesThreshold, which sets the threshold for when unlimited bone influences are used.

Developers must be aware that:

  1. This setting cannot be changed at runtime.
  2. Enabling unlimited bone influences may have performance implications, especially on lower-end hardware.
  3. It affects the compilation of vertex factory shaders.
  4. It can impact the maximum number of bone influences reported in asset registry tags for skeletal meshes.

Best practices when using this variable include:

  1. Carefully consider the performance impact before enabling unlimited bone influences.
  2. Test thoroughly on target hardware to ensure acceptable performance.
  3. Use in conjunction with the UnlimitedBoneInfluencesThreshold to fine-tune the behavior.
  4. Be aware that enabling this may increase memory usage and shader compilation times.
  5. Consider the target platforms and their capabilities when deciding to enable this feature.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:128, section: [/Script/Engine.RendererSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GPUSkinVertexFactory.cpp:50

Scope: file

Source code excerpt:

static int32 GCVarUnlimitedBoneInfluences = 0;
static FAutoConsoleVariableRef CVarUnlimitedBoneInfluences(
	TEXT("r.GPUSkin.UnlimitedBoneInfluences"),
	GCVarUnlimitedBoneInfluences,
	TEXT("Whether to use unlimited bone influences instead of default 4/8 for GPU skinning. Cannot be changed at runtime."),
	ECVF_ReadOnly);

static int32 GCVarUnlimitedBoneInfluencesThreshold = EXTRA_BONE_INFLUENCES;
static FAutoConsoleVariableRef CVarUnlimitedBoneInfluencesThreshold(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GPUSkinVertexFactory.cpp:562

Scope (from outer to inner):

file
function     bool TGPUSkinVertexFactory<BoneInfluenceType>::ShouldCompilePermutation

Source code excerpt:

bool TGPUSkinVertexFactory<BoneInfluenceType>::ShouldCompilePermutation(const FVertexFactoryShaderPermutationParameters& Parameters)
{
	static FShaderPlatformCachedIniValue<int32> UBICVar(TEXT("r.GPUSkin.UnlimitedBoneInfluences"));
	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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SkeletalMesh.cpp:3817

Scope (from outer to inner):

file
function     void USkeletalMesh::GetAssetRegistryTags

Source code excerpt:

		{
			// Note that this value is clamped to FGPUBaseSkinVertexFactory::GetMaxGPUSkinBones, so it's affected
			// by project settings such as r.GPUSkin.UnlimitedBoneInfluences.
			MaxBoneInfluencesString = FString::FromInt(MaxBoneInfluencesLODModel->GetMaxBoneInfluences());
		}
	}

	// The tag must be added unconditionally, because some code calls this function on the CDO to find out what
	// tags are available.