Description

In SkeletalRenderNanite.cpp / FDynamicSkelMeshObjectDataNanite::UpdateBonesRemovedByLOD, bone indices are of type FBoneIndexType (defined as uint16 from BoneIndices.h), instead of int32.

On line 181, the value of ChildBoneIndex is 65535, because RefSkeleton.FindBoneIndex(RemovedBone.BoneName); (line 173) can return INDEX_NONE (-1, which was converted to 65535 after the cast to FBoneIndexType==uint16).

Since *INDEX_NONE *is -1, the condition *ParentIndex == INDEX_NONE *will never be met and the root bone will have index 65535 instead of -1, causing a RangeCheck error.

This pattern of comparing FBoneIndextType to INDEX_NONE exists in various places in the engine, but in this case it can lead to a crash, other examples include  AnimNode_IKRig.cpp:343 and AnimNode_RetargetPoseFromMesh.cpp:51.

Steps to Reproduce

Steps to Reproduce

Right-click and click Enable Nanite on a skeletal mesh with different bones in each LOD.

Callstack

> [Inline Frame] UnrealEditor-Engine-Win64-Debug.dll!TArray<FMeshBoneInfo,TSizedDefaultAllocator<32>>::RangeCheck(int Index) Line 783 C++
[Inline Frame] UnrealEditor-Engine-Win64-Debug.dll!TArray<FMeshBoneInfo,TSizedDefaultAllocator<32>>::operator[](int Index) Line 874 C++
UnrealEditor-Engine-Win64-Debug.dll!FReferenceSkeleton::GetParentIndexInternal(const int BoneIndex, const TArray<FMeshBoneInfo,TSizedDefaultAllocator<32>> & BoneInfo) Line 181 C++
UnrealEditor-Engine-Win64-Debug.dll!FReferenceSkeleton::GetParentIndex(const int BoneIndex) Line 349 C++
UnrealEditor-Engine-Win64-Debug.dll!FDynamicSkelMeshObjectDataNanite::UpdateBonesRemovedByLOD(TArray<UE::Math::TMatrix<float>,TSizedDefaultAllocator<32>> & PoseBuffer, USkinnedMeshComponent * InComponent, FDynamicSkelMeshObjectDataNanite::ETransformsToUpdate CurrentOrPrevious) Line 181 C++
UnrealEditor-Engine-Win64-Debug.dll!FDynamicSkelMeshObjectDataNanite::FDynamicSkelMeshObjectDataNanite(USkinnedMeshComponent * InComponent, FSkeletalMeshRenderData * InRenderData, int InLODIndex, EPreviousBoneTransformUpdateMode InPreviousBoneTransformUpdateMode, FSkeletalMeshObjectNanite * InMeshObject) Line 48 C++
UnrealEditor-Engine-Win64-Debug.dll!FSkeletalMeshObjectNanite::Update(int LODIndex, USkinnedMeshComponent * InComponent, const TMap<const UMorphTarget *,int,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<const UMorphTarget *,int,0>> & InActiveMorphTargets, const TArray<float,TSizedDefaultAllocator<32>> & MorphTargetWeights, EPreviousBoneTransformUpdateMode PreviousBoneTransformUpdateMode, const FExternalMorphWeightData & InExternalMorphWeightData) Line 340 C++
UnrealEditor-Engine-Win64-Debug.dll!USkinnedMeshComponent::CreateRenderState_Concurrent(FRegisterComponentContext * Context) Line 1117 C++
UnrealEditor-Engine-Win64-Debug.dll!FRenderStateRecreator::~FRenderStateRecreator() Line 2141 C++
UnrealEditor-Engine-Win64-Debug.dll!USkeletalMeshComponent::SetSkeletalMesh(USkeletalMesh * InSkelMesh, bool bReinitPose) Line 3157 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!FSkeletalMeshThumbnailScene::SetSkeletalMesh(USkeletalMesh * InSkeletalMesh) Line 447 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!USkeletalMeshThumbnailRenderer::Draw(UObject * Object, int X, int Y, unsigned int Width, unsigned int Height, FRenderTarget * RenderTarget, FCanvas * Canvas, bool bAdditionalViewFamily) Line 22 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!ThumbnailTools::RenderThumbnail(UObject * InObject, const unsigned int InImageWidth, const unsigned int InImageHeight, ThumbnailTools::EThumbnailTextureFlushMode::Type InFlushMode, FTextureRenderTargetResource * InTextureRenderTargetResource, FObjectThumbnail * OutThumbnail) Line 5258 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!FAssetThumbnailPool::LoadThumbnail::<lambda_0>::operator()() Line 1870 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!FAssetThumbnailPool::LoadThumbnail(TSharedRef<FAssetThumbnailPool::FThumbnailInfo,1> ThumbnailInfo, bool & bIsAssetStillCompiling, const FAssetData & CustomAssetToRender) Line 1885 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!FAssetThumbnailPool::Tick(float DeltaTime) Line 1765 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!FTickableEditorObject::TickObjects::<lambda_1>::operator()(FTickableObjectBase * TickableObject) Line 34 C++
[Inline Frame] UnrealEditor-UnrealEd-Win64-Debug.dll!Invoke(FTickableEditorObject::TickObjects::<lambda_1> & Func, FTickableObjectBase * && Args) Line 47 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!UE::Core::Private::Function::TFunctionRefCaller<`lambda at Editor\UnrealEd\Public\TickableEditorObject.h:30:30',void,FTickableObjectBase *>::Call(void * Obj, FTickableObjectBase * & Params) Line 321 C++
UnrealEditor-Engine-Win64-Debug.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::FFunctionRefStoragePolicy,void (FTickableObjectBase *)>::operator()(FTickableObjectBase * Params) Line 470 C++
UnrealEditor-Engine-Win64-Debug.dll!FTickableObjectBase::SimpleTickObjects(FTickableObjectBase::FTickableStatics & Statics, TFunctionRef<void (FTickableObjectBase *)> TickFunc) Line 119 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!FTickableEditorObject::TickObjects(const float DeltaSeconds) Line 30 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1898 C++
UnrealEditor-UnrealEd-Win64-Debug.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 550 C++
UnrealEditor-Win64-Debug.exe!FEngineLoop::Tick() Line 5889 C++
UnrealEditor-Win64-Debug.exe!EngineTick() Line 70 C++
UnrealEditor-Win64-Debug.exe!GuardedMain(const wchar_t * CmdLine) Line 190 C++
UnrealEditor-Win64-Debug.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char *, int nCmdShow, const wchar_t * CmdLine) Line 266 C++
UnrealEditor-Win64-Debug.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 317 C++
[Inline Frame] UnrealEditor-Win64-Debug.exe!invoke_main() Line 102 C++
UnrealEditor-Win64-Debug.exe!__scrt_common_main_seh() Line 288 C++

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-254318 in the post.

0
Login to Vote

Unresolved
ComponentUE - Graphics Features - Nanite
Affects Versions5.5
Target Fix5.6
CreatedMar 6, 2025
UpdatedMar 6, 2025
View Jira Issue