Skip to content

spacejake/blender-flame-addon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blender FLAME Addon

This blender add-on for is for tools using the FLAME Face model [1]. Currently, a Python 3.x fork of the flame-fitting code is used as a library for accessing the pre-trained model. The pretrained model is available for research purposes after registering at the FLAME project page.

This add-on is also incomplete and initially just a starting point to use Blender as a visualization tool for the Flame model. We will be adding tools as we work.

Screenshot

Blender Setup

The Blender python distribution will need some dependancies installed. We will install these using PyPi and PIP. We only provide instructions for windows.

Install PIP:

  • Download pip installation script
wget https://bootstrap.pypa.io/get-pip.py
  • Run get-pip.py with Blender's Python
# Path to Blender Installation
"C:\Program Files\Blender Foundation\Blender\2.79\python\bin\python" D:\Jake\blender-addons\get-pip.py

Install Dependancies:
The dependancies will be similar to those found in the flame-fitting repo in the python3 branch. We will use Blender python's newly installed PIP to install these.

  • numpy
  • scipy
  • chumpy
  • OpenCV

First Install numpy and scipy normally

# Path to Blender Installation + Path to PIP
"C:\Program Files\Blender Foundation\Blender\2.79\python\bin\python.exe" "C:\Program Files\Blender Foundation\Blender\2.79\python\Scripts\pip3.exe" install numpy scipy

Next install a python3 compatible chumpy, as instructed for the flame-fitting repo.

git clone https://github.com/homier/chumpy.git
cd /path/to/py3_chumpy
git checkout py3
"C:\Program Files\Blender Foundation\Blender\2.79\python\bin\python.exe" "C:\Program Files\Blender Foundation\Blender\2.79\python\Scripts\pip3.exe" install .

Lastly, install opencv for python.

"C:\Program Files\Blender Foundation\Blender\2.79\python\bin\python.exe" "C:\Program Files\Blender Foundation\Blender\2.79\python\Scripts\pip3.exe" install opencv_python-3.4.0-cp35-cp35m-win_amd64.whl

Installing Flame add-on

The issue is resolving the flame-fitting module. Blender has a folder where you can put module dependencies, aptly named modules. This is where to put the flame resource. First we must convert the flame-fitting source into a python module to prevent needing to use sys.path.append() to access the module.

  • Rename the directory name flame-fitting to flame_fitting
  • Add __init__.py in the root dir of the flame module so python can read the it as a whole lib.

You can use the scripts directory in the Blender install the add-on.

  • Put the Blander FLAME addon dir (mesh_flame) in the addons dir.
  • Put the flame_fitting module in the modules dir.

However, blender provides the option of using an external scripts dir. I prefer this, as I like to work outside of the application’s install dir.

In order to use an external scripts dir:

  • The ext. scripts Directory must contain 3 sub-directories : addons, modules, and startup.
  • Go to User Preferences, tab File, and specify a custom extra folder for scripts, in the scripts input location of the external scripts dir.

Screenshot

Further, I also like to use symlinks, so I created one to the repo's module mesh-flame.

mklink /d "D:\Jake\blender-addons\addons\mesh_flame" "D:\Jake\blender-addons\dev\blender-flame-addon\mesh_flame"

Add the mesh_flame addon normally in Blender Screenshot

References

  1. Tianye Li*, Timo Bolkart*, Michael J. Black, Hao Li, and Javier Romero, Learning a model of facial shape and expression from 4D scans, ACM Transactions on Graphics (Proc. SIGGRAPH Asia) 2017

About

A blender add-on for tools using the FLAME Face model

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages