mirror of
https://github.com/godotengine/FBX2glTF.git
synced 2026-01-06 02:09:48 +03:00
Fix skinning weight normalization. Previous code would call Normalized() on a Vec4f containing the weights. This normalizes the vector, i.e. makes the length of the vector equal to 1.0. For skinning weights what we want is the sum of the weights to be 1.0, which is a different. This commit fixes that.
This commit is contained in:
@@ -75,7 +75,8 @@ FbxSkinningAccess::FbxSkinningAccess(const FbxMesh* pMesh, FbxScene* pScene, Fbx
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < controlPointCount; i++) {
|
||||
vertexJointWeights[i] = vertexJointWeights[i].Normalized();
|
||||
const float weightSumRcp = 1.0 / (vertexJointWeights[i][0] + vertexJointWeights[i][1] + vertexJointWeights[i][2] + vertexJointWeights[i][3]);
|
||||
vertexJointWeights[i] *= weightSumRcp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user