Massive Skeletal animation boost: easy bug fix
Posted: Tue Feb 15, 2022 1:14 am
Hi guys I hope we are all alive and well.
Here is a small fix for my irrlicht family
the skeletal animation code unesscarly computes the pull matrix for every joint and every vertex it affects, it only needs to be done once per joint, results in a MASSIVE boost for high poly meshes
old code
new code
Here is a small fix for my irrlicht family
the skeletal animation code unesscarly computes the pull matrix for every joint and every vertex it affects, it only needs to be done once per joint, results in a MASSIVE boost for high poly meshes
old code
void CSkinnedMesh::skinJoint(SJoint *joint, SJoint *parentJoint)
{
if (joint->Weights.size())
{
//Find this joints pull on vertices...
core::matrix4 jointVertexPull(core::matrix4::EM4CONST_NOTHING);
jointVertexPull.setbyproduct(joint->GlobalAnimatedMatrix, joint->GlobalInversedMatrix); //////<-why is this done so many times per vertex
new code
void CSkinnedMesh::skinJoint(SJoint *joint, SJoint *parentJoint)
{
//Find this joints pull on vertices... moved out of the loop
core::matrix4 jointVertexPull(core::matrix4::EM4CONST_NOTHING);
jointVertexPull.setbyproduct(joint->GlobalAnimatedMatrix, joint->GlobalInversedMatrix);
if (joint->Weights.size())
{