Apply a skeletal animation from a BVH to a GLTF file with same skeleton

I have a GLB model that contains a skeleton and in a separate BVH file, an animation of the same skeleton.

It is possible to load both and apply the animation to the model?

My experiments so far:
1/ Load the model and display skeleton
2/ Load the animation and display skeleton animating

Apologies for not using a Pen or a Fiddle - I realize that makes things much easier but I don’t know how to overcome CORS limitations and refer to the GLB/BVF files that way.

I suspect it’d be difficult and error-prone to use two different formats for skinned mesh data. They may represent it in different and incompatible ways. But I don’t know enough about BVH to be sure of that. Can you use GLB for both? One workflow would be to include one GLB with the skinned mesh, and separate GLBs for each animation (which contain just the animation and a copy of the skeleton, without the skinned mesh).

Understood and that seems to be the case - thank you.

I eventually gave up with code, installed Blender, imported both the GLB and BVH but the learning curve was too steep trying to discover how to export the combined result. Ultimately, I got some help and exported the GLB with a hand-rolled animation.

Works well but I would still like to be able to apply different BVH files to the base so I will revisit and continue to poke.

I am tending towards a slightly different approach now. I load the animated GLB and play the idle animation then later on, I received a list of new positions/rotations/scales for some or all of the bones in my skinned mesh.

Iterating over the model nodes, looking for objects of type “Bone” doesn’t seem to result in what I would expect (many more than I expected) and in any case, making test modifications to position/scale appears to not do anything when the model is displayed.

Is there something in three.js that helps me do this or what piece of knowledge am I missing?

Bones are almost always animated by rotation, rather than position or scale. I’m not sure why there would be more bones than you expect though, three.js does not change the number.

Understood - the experiment I am working on takes the base skinned mesh and applies a modified set of bones (pso/scale/rotation) to it.

Iterating over the skinned mesh (GLB file) after it is loaded and randomly changing values appears to have no effect so I imagine I am changing the wrong copy or else there is a flag I need to set to tell three.js to update.

I have been poking at matrixAutoUpdate / matrixWorldNeedsUpdate / updateMatrix() for various components but that too also has no discernible effect.

What am I missing?

I know it’s always useful to provide a CodePen/JSFiddle so I tracked down a CORS compliant version of the three.js Soldier.glb and made one: Edit fiddle - JSFiddle - Code Playground

I noticed that my scale changes do take effect when I comment out the line to update the animation mixer in the render loop.

I imagine that is expected behavior - is there a way to retrain the animation and apply it to an updated set of bones?

I see – yes, animation keyframes will overwrite whatever position is currently on the bone. There is an additive blending system for allowing one animation to apply on top of other animations, but I’m not sure if that is compatible with custom application code updating bone positions or not.

Got it - thank you.