PeizhuoLi / neural-blend-shapes

An end-to-end library for automatic character rigging, skinning, and blend shapes generation, as well as a visualization tool [SIGGRAPH 2021]
Other
637 stars 92 forks source link

FBX Output Script (Blender) #5

Closed huh8686 closed 3 years ago

huh8686 commented 3 years ago

This script allows to export neural-blend-shapes file (.fbx, .glb)

To get neural-blendshapes model , just simply run blender -b -P nbs_fbx_output.py -- --input ../demo --output ../demo/output.fbx

To get envelop-only model , just simply run blender -b -P nbs_fbx_output.py -- --input ../demo --output ../demo/output.fbx --envelope_only 1

Required

Input direcotry is the directory where the ouputs are generated from 'demo.py'

'T-pose.obj', 'skeleton.bvh' , 'weight.npy' and 'basis.npy' , 'coff.npy' should exist in input directory (e.g. ../demo) If 'basis.npy' , 'coff.npy' don't exist , envelope-only model will be exported.

'basis.npy' and 'coff.npy' (that is required to get neural-blend-shape model) can be achieved from params called basis_full, coff respectively in ./architecture/blend_shapes.py

e.g. I simply add this code in the forward function in ./architecture/blend_shapes.py

import numpy as np np_basis = basis_full.detach().cpu().numpy() np_coff = coff.detach().cpu().numpy() np.save('./demo/basis.npy',np_basis) np.save('./demo/coff.npy',np_coff)