I’m writing this to leave a sugestion.
The BVH animation format is WIDELY used! It is actually one of the most used animation format alongside fbx.
So I think there could be a good example at three js website on how to animate a character using a BVH animation.
Currently in the website, there is just an example of loading a bvh animation and playing it on 'bare bones".
Since bvh is an ANIMATION format, not a model format, I’d suggest showing examples of dynamically picking a bvh animation and animating a glb, obj or dae model.
There are too many examples of animating characters that have embed animations or FBX files which have embed animations + models…
People like me who need to have several avatars with the same RIG and dynamic animations being played on the fly on these models (glb, obj or dae) have no example or tutorial!
I’ve swept the known universe and metaverse looking for a way to use a BVHLoader properly instead of simply playing it with it’s rig. But no luck!
The library is awesome by the way! Keep up the good work!
If I understand, what you’re asking for is this:
- load any BVH animation
- load any (humanoid) mesh
- connect animation to mesh
- play animation
Is that correct?
At least as I understand it (I’m not very familiar with BVH format) this doesn’t work. The mesh has to be set up to work with the particular skeleton from the BVH. Once you have a mesh that works this way it should work with all similar BVH animations though.
Otherwise, if you already have a mesh set up to work with the rig/skeleton from the BVH file, this example might help:
If you do need to rig the mesh with the BVH skeleton, I’m not aware of any way to do that in three.js.
You will have to load the non-animated mesh and at least one of your BVH files into a program such as blender and do it there. At that point, you might as well set up all animations there and check that they work correctly since the animation tools in Blender are much easier to work with. Then you can export in glTF format instead of BVH.
If you have several meshes and loads of BVH animations, you might want to keep the animations in BVH format and export the models as glb, then connect them up. This example shows how to do that:
Someone who is more familiar with BVH format may be able to confirm what I’ve said here.
@Mugen87 does this example demonstrate what you mean by animation retargeting?
@naiteon There is a free tool for automatically rigging meshes called mixamo.com However, you are limited to using the animations from their website. The rigged mesh will not work BVH animations.
Yes. Before SEA3D was removed there was a retargeting example in the repository, too:
However, it was related to SEA3D. I’ve asked the original dev at that time to make the example with a
glTF model. However, since he also develops SEA3D, he ignored the request and sticked to his format.
Anyway, I’ve mentioned already here that a new retargeting example would be useful.
More information about the term Animation Retargeting:
BTW: It’s not required that the skeleton of the BVH and the target skinned mesh are equal. Similar bone structures should be sufficient although you get the best results by having equal skeletons. Retargeting also ensures that skinned meshes with different proportions but same skeleton can use the same animations.
At the very least they would have to have the same number of bones, right?
I’m not sure if there’s a standard number of bones for a rigged humanoid mesh. I expect that it’s common for spines, hands, and feet to have different numbers of bones.
I’m not sure about that^^.
Thank you so much! I’ve seen that example in my pursue before but got so depressed when I noticed they used SEA3D =(
That is exactly what I need, I want all avatars to share the same BVH skeleton or NO skeleton at all. Then in-world they can interact with chairs, dance floors stuff like that which will animate their avatar on the fly. Since there will be too many possible interactions, i can’t pre-load the models with all of the possible animations. That is why I need just the mesh or a mesh with bvh rigged skeleton at most!
The example does what I need, but I (a 3d game dev rookie) can’t seem to port on my own that example to Three JS. from SEA3D.
I was very excited with Three JS cause that allowed me to play around easily, i could even animatie glb / gltf models easier than ever!
Problem is there are toooooo many examples on animating animated-models on the web, that it makes it painfully harder to find any hope or resource on my specific need.
I have no idea what to do now, I considered porting that example to Three JS but i gotta reckon it is beyond my current limited knowledge of animation.
Thank you anyway!
Like I said above maybe we can add a new official example that addresses your use case. I’ll try to keep you up to date and post in this topic if there is something to share.
Man that would be SO awesome! The project is intended for poor communities here in Brazil from the ex bar staff and small commerces that are bankrupting. I’m trying to get sponsored google cardboard for them and have an app they can play around. But we understood that animation will be key to the interaction and immersion. On behalf of them I would thank you so much if that could be done.
Thank you so much guys, greetings from Brazil!
I thought about a way to circumvent this, I just need to know if that is possible and if there is any example on this.
- Instead of using the bvh animations, use fxb animations
This is how i thought:
- Rigging all avatars with mixamo fxb rigs and embedding only the basic animations like walk and idle.
- Save one “MOCK” invisible fxb model with all possible animations available from mixamo.
- Load the mock fxb model, Just to serialize these animations individually and save them to my db.
- Then in-game attach an specific fxb animation to a fxb mixamo rigged avatar on the fly, since all avatars will share the same rig.
Is that easier than doing a bvh retargetting? Is there any example close enough to this?
That is the approach I would use, except I would probably use glTF instead of FBX. I don’t know of any example demonstrating this, however.
Oh ok, when you say gltf you mean the models or the animations?
As in, downloading the rigged fxb with animations from mixamo, then converting to gltf (would it keep the rigs and animations? Or change the animations format? ) ?
That would work better indeed, because i could then read all the animations from a gltf mock model, serialize the animations and then find a way to attach them to a gltf model on the fly
I mean everything. I don’t think it’s a good idea to store the animations in a different format than the models (BVH as a possible exception).
@looeee and @Mugen87
Hey guys, i tried my best to achieve this, could you give it a look?
I created an avatar in MakeHuman on tpose with an OpenSim Rig specific for these BVH animations i wanna use. I saved it to Man.dae (having textures in the textures folder), then converted the model plus its textures and rig into a binary Man.glb file (using collada2gltf ).
Created an aframe scene with an onload-component which has two important methods init and tick. Tick is called on every frame by aframe internal rendering mechanism. init is called when the component is attached to the DOM. On the init method i create an eventlistener to be notified when the model is loaded. Once loaded i proceed loading the bvh file and trying to animate the model…
There are two BVHLoader callbacks implemented (parseBvhAnimation and parseBvhAnimation2) if you alternate you can see the difference. using one callback gives you a giant skeleton so weird… the other plays the bvh but out of the model (you have to look up to see it).
The code is so ugly im sorry, but its cause im already banging my head on the walls lol
Is that a problem converting the skeleton from collada to glb?
Im stuck for almost 3 weeks here
Hello All, Hello @naiteon, I believe you can do some of what you are asking in Three.js … not any mesh, but perhaps any mesh with a skeleton that matches (or nearly) your BVH’s. There were some other questions in the forum that seemed to be about this same thing, so I’m starting a new thread with at least one way to do it https://discourse.threejs.org/t/animating-a-mesh-with-bvh-data/21898
I’m currently working on an animation retargeting example.
The animation from a BVH file will be applied to the XBot GLB model
(from: three.js examples).
I think I’m almost there, but I still need to scale the BVH skeleton to the GLB skeleton.
Ok, just pushed the retargeting code in the dance demo:
The scale seems to be correct now, however the upper and lower legs are a bit dislocated.
hello guys i would like to collaborate i have the same problem i have tried everything and here are some things i got
1- sea3d model and bvh animation as the example sent here but the sea3d model is abandoned and makes it difficult when you need to create new models
2- model fbx animation mixb fbx very good too but the problem is that each animation is more than 1MB which makes the project heavy and you limit yourself to the mixamo animations
3- Gbl model and gbl animation this is great also has a nice example that I managed to reproduce with mixamo animations and then it is gbl model and gbl animations but the problem is that in this example you have to include the animations in the model and even you export the animations in gbl it looks great too
then the ideal would be example 1 but with gbl model and external animations in bvh there are thousands of these free animations the ideal is to load them in a glb model using the bvhloader can someone help to do this miracle using the tympanus tutorial below?