MaxSkinBones
MaxSkinBones
#Overview
name: MaxSkinBones
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MaxSkinBones is to control the maximum number of bones that can influence a vertex in GPU-based skin deformation for character animation in Unreal Engine 5. This setting is part of the rendering system, specifically related to skeletal mesh rendering and GPU skinning.
MaxSkinBones is primarily used by the Engine’s rendering subsystem, particularly in the GPU skinning module. It’s referenced in the RendererSettings class and the GPUSkinVertexFactory implementation.
The value of this variable is set in the URendererSettings constructor, where it’s initialized to FGPUBaseSkinVertexFactory::GHardwareMaxGPUSkinBones. It can be configured per platform through the engine’s configuration system.
This variable interacts with other skinning-related variables, such as GCVarMaxGPUSkinBones, which is a global console variable that can override the MaxSkinBones setting.
Developers should be aware that:
- This setting directly impacts performance and memory usage of skeletal mesh rendering.
- It has a minimum value of 12, as indicated by the ClampMin and UIMin metadata.
- Changing this setting requires restarting the editor, as indicated by the ConfigRestartRequired metadata.
Best practices when using this variable include:
- Set it to the lowest value that still provides acceptable visual quality for your characters.
- Consider platform-specific limitations and set appropriate values for different platforms.
- Be mindful of the performance implications when increasing this value, especially on mobile platforms.
- Use in conjunction with LOD systems to optimize bone influence for distant characters.
- Test thoroughly after changing this value to ensure it doesn’t negatively impact performance or visual quality across all target platforms.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:3428, section: [/Script/Engine.RendererSettings]
- INI Section:
/Script/Engine.RendererSettings
- Raw value:
(Default=65536,PerPlatform=(("Mobile", 256)))
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/RendererSettings.h:1276
Scope (from outer to inner):
file
class class URendererSettings : public UDeveloperSettings
Source code excerpt:
ConfigRestartRequired = true,
ClampMin = "12", UIMin = "12"))
FPerPlatformInt MaxSkinBones;
UPROPERTY(config, EditAnywhere, Category = Mobile, meta = (
ConsoleVariable = "r.Mobile.PlanarReflectionMode", DisplayName = "Planar Reflection Mode",
ToolTip = "The PlanarReflection will work differently on different mode on mobile platform, choose the proper mode as expect. Changing this setting requires restarting the editor.",
ConfigRestartRequired = true))
TEnumAsByte<EMobilePlanarReflectionMode::Type> MobilePlanarReflectionMode;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GPUSkinVertexFactory.cpp:334
Scope (from outer to inner):
file
function int32 FGPUBaseSkinVertexFactory::GetMinimumPerPlatformMaxGPUSkinBonesValue
Source code excerpt:
const bool bUseGlobalMaxGPUSkinBones = (GCVarMaxGPUSkinBones != FGPUBaseSkinVertexFactory::GHardwareMaxGPUSkinBones);
//Use the default value in case there is no valid target platform
int32 MaxGPUSkinBones = GetDefault<URendererSettings>()->MaxSkinBones.GetValue();
#if WITH_EDITORONLY_DATA && WITH_EDITOR
for (const TPair<FName, int32>& PlatformData : GetDefault<URendererSettings>()->MaxSkinBones.PerPlatform)
{
MaxGPUSkinBones = FMath::Min(MaxGPUSkinBones, PlatformData.Value);
}
#endif
if (bUseGlobalMaxGPUSkinBones)
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GPUSkinVertexFactory.cpp:362
Scope (from outer to inner):
file
function int32 FGPUBaseSkinVertexFactory::GetMaxGPUSkinBones
Source code excerpt:
}
//Use the default value in case there is no valid target platform
int32 MaxGPUSkinBones = GetDefault<URendererSettings>()->MaxSkinBones.GetValue();
#if WITH_EDITOR
const ITargetPlatform* TargetPlatformTmp = TargetPlatform;
if (!TargetPlatformTmp)
{
//Get the running platform if the caller did not supply a platform
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GPUSkinVertexFactory.cpp:375
Scope (from outer to inner):
file
function int32 FGPUBaseSkinVertexFactory::GetMaxGPUSkinBones
Source code excerpt:
{
//Get the platform value
MaxGPUSkinBones = GetDefault<URendererSettings>()->MaxSkinBones.GetValueForPlatform(*TargetPlatformTmp->IniPlatformName());
}
#endif
if (bUseGlobalMaxGPUSkinBones)
{
//Make sure we do not go over the global ini console variable GCVarMaxGPUSkinBones
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RendererSettings.cpp:92
Scope (from outer to inner):
file
function URendererSettings::URendererSettings
Source code excerpt:
bEnableRayTracingTextureLOD = 0;
DefaultBoneInfluenceLimit = 0;
MaxSkinBones = FGPUBaseSkinVertexFactory::GHardwareMaxGPUSkinBones;
WorkingColorSpaceChoice = EWorkingColorSpace::sRGB;
RedChromaticityCoordinate = FVector2D::ZeroVector;
GreenChromaticityCoordinate = FVector2D::ZeroVector;
BlueChromaticityCoordinate = FVector2D::ZeroVector;
WhiteChromaticityCoordinate = FVector2D::ZeroVector;
bEnableVirtualTextureOpacityMask = false;