patrikhuber / eos

A lightweight 3D Morphable Face Model library in modern C++
Apache License 2.0
1.89k stars 596 forks source link

Add New Blendshapes to Default Set #230

Closed jjbouza closed 5 years ago

jjbouza commented 5 years ago

Hello,

This library has been very useful for a project I am working on. The project involves modeling of unusual/extreme facial expressions (in a medical imaging scenario). I was considering adding custom blendshapes to increase the expressivity of the expression fitting and better capture more extreme expressions.

Do you have any suggestions for how I could go about this? E.g. what is the format of the default expression_blendshapes_3448.bin file?

Thank you.

patrikhuber commented 5 years ago

Hi,

Glad you could sort it out! The easiest thing to do is to read the existing blendshapes with the Python bindings, add your new ones, put them back into the model, and save the model. That's probably what you did in the end. The Python bindings are extremely awesome for such kind of things :-)

Patrik

jjbouza commented 5 years ago

Thanks for the help, thats exactly what I did.

For anyone needing help in the future, the approach I used was to load up the reference model in blender (making sure to import such that vertex order is preserved) and modify as desired. Then export the modified mesh, compute the difference between the reference and the modified mesh, and save this as a eos.morphablemodel.Blendshape object. Then this object can be appended to the default expression_blendshapes_3448.bin file (which is essentially just a serialized list of eos.morphablemodel.Blendshape objects) and saved. All of this can be scripted easily using the Python interface.

Best, Jose.

patrikhuber commented 5 years ago

Excellent! :-)

Chen-Jinlong commented 4 years ago

Thanks for the help, thats exactly what I did.

For anyone needing help in the future, the approach I used was to load up the reference model in blender (making sure to import such that vertex order is preserved) and modify as desired. Then export the modified mesh, compute the difference between the reference and the modified mesh, and save this as a eos.morphablemodel.Blendshape object. Then this object can be appended to the default expression_blendshapes_3448.bin file (which is essentially just a serialized list of eos.morphablemodel.Blendshape objects) and saved. All of this can be scripted easily using the Python interface.

Best, Jose.

Can you give more details please?

Neo1024 commented 2 years ago

Thanks for the help, thats exactly what I did.

For anyone needing help in the future, the approach I used was to load up the reference model in blender (making sure to import such that vertex order is preserved) and modify as desired. Then export the modified mesh, compute the difference between the reference and the modified mesh, and save this as a eos.morphablemodel.Blendshape object. Then this object can be appended to the default expression_blendshapes_3448.bin file (which is essentially just a serialized list of eos.morphablemodel.Blendshape objects) and saved. All of this can be scripted easily using the Python interface.

Best, Jose.

I did almost the same steps as yours except the generation of the difference between the reference and the modified mesh is a bit different. Nevertheless, after I loaded the new blendshapes into EOS, I tried to fit the 2D image and I got the resulting blendshape coefficients successfully. However, when I tried to reconstruct the 3D mesh with the blendshape coefficients by adding up the shape vector and the linear combination of all blendshapes that are multiplied with the coefficients, I found the reconstructed 3D mesh is twisted as below. When I manually set the blendshape coefficient to a reasonable value, it works fine.

1638504214267-0ab27d42-6053-4a5b-8513-7d1dfd704986