@starot found the trick here: How to get TRUE bone index by vertex in 5.1.1 <3
Have to works with Lod RenderSections and BoneMap
// Iterate over all sections
for (const FSkelMeshRenderSection& SkelMeshSection : LODData.RenderSections)
{
const TArray<FBoneIndexType>& BoneMap = SkelMeshSection.BoneMap;
// Retrieve vertex indices for this section
TArray<uint32> SectionVertexIndices;
LODData.MultiSizeIndexContainer.GetIndexBuffer(SectionVertexIndices);
for (uint32 i = SkelMeshSection.BaseIndex; i < static_cast<uint32>(SkelMeshSection.BaseIndex + SkelMeshSection.NumTriangles * 3); i++)
{
int32 VertexIndex = SectionVertexIndices[i];
for (int32 InfluenceIdx = 0; InfluenceIdx < MaxInfluences; InfluenceIdx++)
{
int32 LocalBoneIndex = SkinWeightVertexBuffer.GetBoneIndex(VertexIndex, InfluenceIdx);
if (LocalBoneIndex >= BoneMap.Num()) continue; // Ensure we are within bounds
int32 GlobalBoneIndex = BoneMap[LocalBoneIndex];
float BoneWeight = SkinWeightVertexBuffer.GetBoneWeight(VertexIndex, InfluenceIdx) / 65535.0f;
FName CurrentBoneName = SkeletalMeshComponent->GetBoneName(GlobalBoneIndex);
if (GlobalBoneIndex == BoneIndexInRefSkeleton && BoneWeight > 0)
{
FVector VertexWorldPosition = Locations[VertexIndex];
FLinearColor A = FLinearColor::Blue;
FLinearColor B = FLinearColor::Red;
FLinearColor VertexColor = A + BoneWeight * (B - A);
DrawDebugPoint(SkeletalMeshComponent->GetWorld(), VertexWorldPosition, Size, VertexColor.ToFColor(false), false, Duration);
}
}
}
}