MMData is a tool to manipulate PMX (MikuMikuDance) models with VMD (Vocaloid Motion Data) files.
You can use it to pose a character model with various poses for fun.
In addition, this tool can generate a huge dataset for training 3D mesh reconstruction models,
such as PIFu or PaMIR.
After generating lots of data, time to head for a mesh reconstruction model (for example, PaMIR) and train your model! I used this tool to train a mesh reconstruction model for Japanese anime characters in a past project.
Firstly, we need to install necessary packages:
sudo apt update
sudo apt install gcc build-essential libopenexr-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev
Then, install the Python libraries in the reuirements.txt
file:
pip install -r requirements.txt
Suppose that we have the following structure:
- pmx_data
- {model_name_01}
- {model_name_01}.pmx
- texture files
- {model_name_02}
- {model_name_02}.pmx
- texture files
- ...
- {model_name_01}
- mesh_output
- {model_name_01}
- {model_name_01}.obj
- texture and PRT files
- {model_name_02}
- {model_name_02}.obj
- texture and PRT files
- ...
- {model_name_01}
- image_output
- {model_name_01}
- color
- color_uv
- mask
- meta
- {model_name_02}
- ...
- ...
- {model_name_01}
- motion.vmd
The structure of image_data
follows the same structure as PaMIR's training data.
To pose a PMX model with a VMD file, we use:
$ mmdata pose
--pmx
,-p
: path to the PMX model file--vmd
,-v
: path to the VMD motion file--timestamp
,-t
: timestamp in VMD file--output_dir
,-o
: path to output directory--no_display
: flag to prevent displaying the pose output
Example:
mmdata pose -p ./pmx_data/A/A.pmx -v ./motion.vmd -t 10.0 -o ./mesh_output
To generate mesh reconstruction training data, we use:
$ mmdata gen
--pmx_dir
,-p
: path to the PMX directories--vmd
,-v
: path to the VMD motion file--timestamp
,-t
: timestamp in VMD file--mesh_dir
,-m
: path to the OBJ directories--image_dir
,-i
: path to the directory of output images
Example:
mmdata gen -p ./pmx_data -v ./motion.vmd -t 10.0 -m ./mesh_output -i ./image_output