Massive Skeletal animation boost: easy bug fix

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Massive Skeletal animation boost: easy bug fix

Post by omaremad »

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
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())
{
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
CuteAlien
Admin
Posts: 9643
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Massive Skeletal animation boost: easy bug fix

Post by CuteAlien »

Sorry, I don't understand. The code is not in the loop. It's just behind the if check. So unless I misunderstand your change all do you is add a calculation when nothing has to be calculated.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply