Animating a mesh with .bvh data

Hello All,

There are a few questions here about using Three.js to animate a mesh character (or characters) with .bvh files. I’m no expert, but this was really exciting to me and I wished to post at least one way to do it here for discussion.

Basically, a few things have to be set up:

a. You need to have models with a bone hierarchy that matches (mostly) the hierarchy of the .bvh files that you want to use.

b. The BVHLoader returns a Skeleton and an AnimationClip. You’ll want to use the AnimationClip but not the supplied Skeleton.

b. Even with matching names in your files, you may need to change the track names in the provided AnimationClip. The names provided work fine for simpler models but don’t seem to find the bones in a model that’s nested in objects and groups.

Fiddle is here: The “model” is not very complex :robot: and is just made of primatives but the same method works for OBJ and GLTF humanoid models and more complicated .bvh files. Simpler might be better for demonstration anyway, but (importantly) I can’t seem to get Blender to export a suitable rigged mesh…

Let me know what you think!

1 Like

Hi, Thank you so much for this post! I’ve been spending weeks trying to get this to happen and this was the first thread that helped me. Really appreciate the help.

I’m so glad if this helped! You may have moved on or figured this out already, but after posting here I tried a bunch of different ways to develop a more robust pattern for this …and eventually found that the key was in SkeletonUtils. I had only seen SkeletonUtils.retargetClip used with sea3d models before and thought somehow that it might not provide a general solution (and I don’t really understand the code :grimacing:) but it does just the thing I was looking for (or almost). Here’s a newer fiddle using this method to apply two BVH animations to a gltf model:

Right now (r135) it looks like there is still no official example for retargeting an animation. I’d love to submit an example like this for the library if it would be welcome, but believe some things could use hashing out beforehand…especially a concern I have with the animation timing (the lines right after special note in the fiddle).

I’d look forward to any further discussion on this!