MagicaVoxel to Unity - Rigging Tutorial
Open voxel editor by click "Voxel Editor" button in tools panel, or use "Tools >> Voxel Editor" in the
menu.
After open the voxel editor, you'll see the welcome screen. Drag and drop a vox file into the voxel
editor window. (If you want to rig a qb file, convert it into vox file first)
When you have a model opened, you can view the model in the voxel editor window. Use mouse right
button to rotate, middle button to move, mouse wheel to zoom.
① "Save" button will save the changes into vox/qb file, if you changed anything it will become
green. You can also use "Ctrl + S" to save.
"×" button will close the model and back to the welcome screen.
② The "Cube" works like a reference. Click on the cube will rotate the camera to specific angle.
"C" button will reset the camera. "G" button show or hide the background box.
"Sliders" will set camera angle with a snapped value.
③ “Rigging” and "Sprite" button will switch the editor between rigging and sprite mode, I'll talk
about it later.
④ "Debug Data" button show or hide the debug data below the current view. You can check the
detail infomation of the voxel file you opened.
"State" button show or hide the state info. In current state, it shows the Name and Size of the
model, will be different in rigging state.
⑤ “Rotate” buttons can rotate the model in specific axis, the rigging data will also be rotated. "Flip"
works similarly.
Click on the "Rigging" button, the editor will switch to the rigging mode.
① "Create Rig Prefab" and "Create Avatar Prefab" button will create a prefab for the current
model. Your rigging data will set into a mesh. The prefab contains a SkinedMeshRenderer ready to
work. If you clicked the "Create Avatar Prefab" button, the prefab will have a avatar setted up.
"Import Rig Json" and "Export Rig Json" button can load or save the infomation about rigging with
a json file. If you use MagicaVoxel change and save your model, the rigging data will be
delete. This feature allows you to edit your model without losing the rig data.
② "+ New Bone" button will add a bone into the root of the bones hierarchy. If you select a bone,
this button will become "+ Child Bone" and will add a child bone for the selecting bone if you click
it.
"+ Human Bomes" will add a series of bones for avatar. You have two types of bone series,
"Major" bones and "Full" bones. The Major bones only contains the important bones support by
avatar, and full bones are all the bones support by avatar. The bones will be placed in the root
and the hierarchy layout will be setted correctly.
"Paint" button will let you start paint the selecting bone, if you are painting a bone, this button will
become "Stop Paint".
After add a major human bones, you'll see the bones in the current view. The bones probably not
mapping the pose of your model, but you can adjust them very easily.
① shows the hierarchy layout of the current bones. Click on the names will select the bone, you
can also click on the cones above to select the bone it represents.
Click on the selecting bone in the bone hierarchy will show the text field so you can rename the
bone.
Right click on the bone will shows a menu, you can paint, rename, add child bone or delete the
bone. Press "Delete" key will also delete the selecting bone. (if the delete key don't work, that's
because the editor window is not focused or you were typing in a text field)
② shows the selecting bone in the model view. Drag the axis to move the selecting bone, click on
empty space will deselect it.
The bones will always snap to the center of a voxel.
The rotation of a bone depends on it's child bone, if it don't have a child bone, then depends on
the parent bone.
When you selecting a bone, click on the "Paint Weight" button above or press "P" will start to paint this
bone. In the image below, I'm painting the right ear bone.
Click or drag with mouse left button will paint weight for voxels.
The red voxels are rigged only by the current painting bone, yellow voxels rigged by current bone and
some bone else. Every voxel can be rigged by two bones for maximum.
After paint this bone, click "Stop Painting" button or press "ESC" key to go back.
The brush setting below will only appear when painting a bone.
"Voxel" and "Box" button works like the voxel and box mode in MagicaVoxel. Hot key is "V" and
"B". Drag with voxel mode selected will only paint on the voxels with the cursor pass through. Box
mode will paint all the voxels in the box formed by the cursor.
"Attach" and "Erase" button switch between attach and erase mode. Hot key is "T" and "R". You
can hold shift key to change the mode temporarily like MagicaVoxel.
After painted all the voxels, created an avatar prefab. Then link your animator. The rigging animation
will works with the bones and weights you gave it.
Hope you enjoy it.