(This is a translation of a [Japanese [Content removed] by Kitamura Toshihide.)
Thank you for your continued support.
It seems that there is an issue in UpdateRefToLocalMatricesInner(), which updates motion matrices. The issue is that unnecessary calculations of matrices are performed in the function.
In the function, RequiredBoneIndices and necessary bone indices are passed, and status checks such as Hide are performed. However, ultimately, in the following code, as all the bones included in the skeleton are used, unnecessary matrix multiplications are performed.
`const int32 NumReferenceToLocal = ReferenceToLocal.Num();
for (int32 ThisBoneIndex = 0; ThisBoneIndex < NumReferenceToLocal; ++ThisBoneIndex)
{
VectorMatrixMultiply(&ReferenceToLocal[ThisBoneIndex], &(*RefBasesInvMatrix)[ThisBoneIndex], &ReferenceToLocal[ThisBoneIndex]);
}`
ReferenceToLocal is initialized as the Identity based on the number of RefBasesInvMatrix in UpdateRefToLocalMatrices(). (In UE4, it was not initialized and contained NaNs). I think the final multiplication should be performed only for bones included in the render mesh to be updated. I’d be grateful if you could check this.
Also, I think it is not so necessary to update a matrix when Hide specified. However, since the parent’s matrix has a scale of zero assigned, it is updated.
Additionally, the handling of ExtraRequiredBoneIndices should be a problem. This may include bone indices that are the same as those of LOD.ActiveBoneIndices. In such cases, calculations are redundantly performed.
I have attached modified code for your review.
(For MasterPose, it seems necessary to update all the bones in the skeleton here, so it also copies all the bones.)