smplx
smplx copied to clipboard
smplx to bvh
Hi,
Is there a way to export the skeleton motion to bvh format ? Do you have some example for that ?
Thanks.
If you can load the data into fairmotion you can save to .bvh
with their bvh.save. AMASS files can be loaded using fairmotion.data.amass
. I'm not an author of this repo or fairmotion, this is the just the easiest way I've found to get .bvh
files at the moment.
Hi,
Is there a way to export the skeleton motion to bvh format ? Do you have some example for that ?
Thanks.
I have the same question, and I want to know that you have already solve it? Could you please share the method? Thanks very much!!!
Hi, Is there a way to export the skeleton motion to bvh format ? Do you have some example for that ? Thanks.
I have the same question, and I want to know that you have already solve it? Could you please share the method? Thanks very much!!!
Hi, I also meet the same question, and I also want to know that you have already solve it? Thank you very much!!
We don't have an exporter for .bvh but it would not be hard to implement. The bvh format is simple (https://research.cs.wisc.edu/graphics/Courses/cs-838-1999/Jeff/BVH.html). We've never done this because bvh throws away the information about body shape so it is a lossy transformation.
Hi @Cicistrawberry ,
What I finally did is similar to what @gngdb suggested. I exported from the SMPL format the skeleton connectivity plus all the rotation, translation data and then loaded it to fairmotion library and then saved it as bvh file. I dont have access to this code so I am sorry that I cannot share it.
We don't have an exporter for .bvh but it would not be hard to implement. The bvh format is simple (https://research.cs.wisc.edu/graphics/Courses/cs-838-1999/Jeff/BVH.html). We've never done this because bvh throws away the information about body shape so it is a lossy transformation.
This gets the job done:
from fairmotion.data import amass, bvh
import os
prefix = f'./<data-dir-path-here>' # eg: './AMASS/TotalCapture/s1'
# list all the files in the directory
files = [f for f in os.listdir(prefix)]
bm_path = './<body-model-path-here>' # eg: body_models/smplh/neutral/model.npz'
motion = [bvh.save(amass.load(os.path.join(prefix, f), bm_path=bm_path, model_type="smplh"),
f"{os.path.join(prefix, f.split('.')[0]) + '.bvh'}") for f in files]
Note:
fairmotion.data.amass will throw an error (installed with pypi) TypeError: __init__() missing 1 required positional argument: 'model_type'
. Simply add it to load_body_model() in the file.
Similar issue with human_body_prior package TypeError: lbs() got an unexpected keyword argument 'dtype'
. Simply remove the arg from the lbs() in the forward function of body_model.BodyModel.
It works fine after that. Could train amass on deep-motion-editing thereafter which requires .bvh files Cheers.