I have been trying to create a simple character with bones and loading a bvh file to animate that character. I could not find any direct examples, but from what I could find from the documentation and other simplified examples on the internet I was able to create a little example. My example can be downloaded here: https://drive.google.com/file/d/1hEKu9mQzjPhUg4J0Hf4PolVVs4BOKtDg/view?usp=sharing
as you can see my example is animating incorrectly.
Anyone know why?
Peter
I think one problem is that the embedded skeleton in the FBX file is different compared to the BVH-skeleton. The FBX skeleton has 26 bones whereas the BVH skeleton has 38.
It’s not valid to apply arbitrary skeletons to a skinned mesh since geometry attributes like skinWeights
and skinIndices
have to match. Otherwise stuff happens like vertices refer to wrong or non-existing bones.
1 Like
@Mugen87 I would think the number of bones shouldn’t have any affect, because targeting is done with the bone names. For example, some models with bones have fingers and if the BVH doesn’t contain finger animation then they are just ignored.
skinWeights and skinIndices is what is defined in the fbx file. the BVH doesn’t need to have any knowledge of that. It should only contain data about bone transformations.
am I wrong?
Peter
skinIndices
define which bones affect a single vertex. If the values in this array do not match with the structure of the skeleton, animations won’t work.
https://threejs.org/docs/#api/core/Geometry.skinIndices
i’m confused by what you are saying, because the skinindices and weights are defined in the fbx model not the skeleton in the BVH. Thereby the fbx model and skinindices, weights will always match?!
We need to be clear when talking which bone set we are talking about (BVH bones or FBX bones).
As of your first comment you say the number of bones in the BVH does not match that is in the FBX file. I would think that is perfectly ok. The BVH knows nothing about vertices, skin indices or weights.
so I’m still at a lost.
Peter
Animations move bones around by name, but the bones also have a particular order in the .bones
array, and each vertex in the mesh stores the index of the bone(s) that affect it. If you reorder the bones (or have a different number of bones), those indexes will not match up properly.
Are you running into a particular issue that requires you to use two separate files here?
1 Like
@donmccurdy I understand the bone and vertices relationship. There are two set of bones, one in the fbx file (the model) and one in the BVH file (motion).
the model is correctly mapped to the vertices. The bvh file can have any number of bones since they are not mapped to the vertices.
Having the animation baked into the file works perfectly, but that is not what we won’t. It uses less resources and is much more flexible by having each animation as a bvh.
Hello. Did you ever get a working version of this? Im trying to target a skeleton helper onto a model and have it animate through bvh files. Pleas let me know. Thanks for your time.