I am currently struggling with an animation I made that I would like applied to multiple models, all different, but from the same vertices. I already have a custom gltf importer ready but I need to polish my exporter. Hence the question.

The first model has been exported to gltf and is fine.

My question is: is there a simple, programmatic, way to edit this GLTF file to place the bones of the next model at different locations (that I know) to still benefit from a correct animation or not? That would be easier/faster than manual adjustments.

I played with vertices position inside the GLTF, but the result is a distorted model. Tried to modify the animation matrices directly as well: same ugly result (this is just an excerpt showing that I push all ancestors and then start from the root, down to my bone of choice):

while ( 1 ){
        chain.push_back( node_idx );

        if ( armature[node_idx].parent == CONDITION_STOP ){



        node_idx = armature[node_idx].parent;


for ( auto curr = chain.rbegin(), curr_end = chain.rend(); curr != curr_end; ++curr ){

        u32 node_idx = *curr;
        // skipped: select the right animation indices, then:
        mat4 mmat_current = compose( translation, rotation, scale);

        mat = multiply( mat, mmat_current );
        // keep going with mat


Maybe there is something to try with the inversebindmatrix[i] but I really need a pointer here. So, what are my options please? What did I get wrong?


Edit: picture of the problem. The skeleton is the same size, despite the model being different: enter image description here

How on earth can I drag the bone to their 3D position (I know the final 3D position in the global world each bone should have) ?

I tried to only play with translation matrices: fail.

  • \$\begingroup\$ There are a lot of different things that you could be trying to do here, that would all match the description you've given so far. Can you walk us through one concrete example, showing us the original model and its bones, the model you want to apply them to, and the locations that you "know" the bones should go? You may also be looking for the key phrase "animation retargeting". \$\endgroup\$
    – DMGregory
    Commented May 17, 2022 at 15:17
  • \$\begingroup\$ @DMGregory: I will prepare an example and a picture immediately so that you see the issue \$\endgroup\$
    – Kroma
    Commented May 17, 2022 at 15:19
  • \$\begingroup\$ @DMGregory Would two gltf files help or not? I replace my anim with Mixamo and we should be good to go \$\endgroup\$
    – Kroma
    Commented May 17, 2022 at 15:48

1 Answer 1


I ran into a very similar problem. But using very different tools. The solution for me was something like this:

1: set skeleton/meshes to standard T pose. 2: import mesh of 2nd body (tall person). 3: copy skeleton of first body to tall body 4: set bone coordinates to known world coordinates. I made sure the T pose meant that world coordinates = vertex coordinates. 5: re-set the “bind poses” for the mesh. This is what they were called in the tools I was using. But it’s referring to the stored offsets between the vertexes and the bones they are associated to.

Then, once that was complete, the new rig was done and ready to animate. My apologies, it’s been a few years so I don’t remember every detail.

The reason the meshes looked so bad for me was due to the linear blendskinning being applied to the bones with the wrong offsets when the joints were moved. So for example it thought that the elbows were bent way more than they actually were. Resetting the bind poses made it understand the correct offsets to use.

For #4, I accomplished this by reading up on how my tool was doing the bones. It was a set of nodes in a tree graph. Similar to Transforms in Unity. I found a way to edit this set Of matrices manually to match the new person’s T pose.

The keyword for me to read up on was Bind poses. I know some tools call them different things. But that really was the key to figuring out the whole process of transferring skeletons to other bodies.

If you want to look into how I did it a bit more it was for an open source tool that does exactly what you’re doing. Unfortunately only for non-commercial use. But you can still take a look at the code for inspiration. https://biomotionlab.github.io/SUP/

Hope that helps in your scenario.

  • \$\begingroup\$ Thanks, I actually did that but my animation now has my modified silhouette targeted to the original animations. I also need to modify the animation, and this is where it is complicated.. \$\endgroup\$
    – Kroma
    Commented Jun 2, 2022 at 16:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .