I am not sure if this is the right place to ask this question but this forum has been very helpful to me in the past so I am hoping that some of you more experienced with skeletal animation can help me figure this out.
I followed several tutorials to implement my animation engine with assimp and opengl. I downloaded a mixamo fbx model + walking animation. I have been able to load the static model and texture it without issues.
But when I go to animate it the model “explodes”. I can see the “cadence” of the walk and can even make out some semblance of human structure walking … but the polygons are stretched out in every direction and basically it’s unrecognizable garbage from the first frame.
I don’t think the problem is in my code though. I re-implemented this animation algorithm in 3 different ways following 3 different tutorials with completely different approaches. I even swapped the assignment of the bones from model to meshes back to model … in other words, i gutted my logic (including the shader logic) several times and the model explodes in the exact same way every single time no matter what i change.
I tracked back the issue (I think! I am not sure … ) to this:
1.000000, -0.000000, 0.000000, 0.000000,
0.000000, 1.000000, 0.000000, -150.028214,
-0.000000, -0.000000, 1.000000, 2.682794,
0.000000, 0.000000, 0.000000, 1.000000
The above is the one of the bone offset transforms coming straight from assimp mapped into neck bone.
Take notice of the “y” component of the translation section of the matrix. It’s equal to -150. The biggest vertex y value I have in the model is +15. If my math is right this would shift the neck upwards by about 10 times the height of the model …
That doesn’t even end there of course since all the offsets are off: if the y translation is not out of whack, the z translation or the x translation are. In other words I feel that the offset matrix of the bone array coming from assimp has disproportionately big translation section.
Which means that the final transformation (which gets compounded as you get lower and lower into the bone hierarchy) is absurdly big … in the thousands (the translation section at least). The rest of the transforms seem to be ok.
Just so you know … if I take that exact same FBX file and play it either in Maya or in Blender … they work just fine and the model walks without issues.
So … assuming that the code from my custom bone structure to the shader is correct and that the FBX model is ok … the thing in between must be the issue: either assimp is doing something wacky or I am not getting the offset matrix correctly from it.
As anyone experience anything like this before?
Any help would be appreciated … I’ve been struggling with this for the past week.
Thanks!!