Monday, June 4, 2012

Mask Modifier 'Armature' Option

A few years ago, I introduced the Mask Modifier to Blender. It was originally intended as a tool for riggers which would make it possible to design rigs where the regions controlled by the selected bones are highlighted on the meshes themselves, and with hardly any bones in sight (inspired by this thread over on BlenderArtists). At the time, I ran into some technical difficulties which prevented it from being used for its intended purposes, though the other modes that were working have found their way into numerous production pipelines since.

Today at long last, I finally solved these lingering problems, and the Mask Modifier can be used as originally intended. Clutter-free rigs just got one step closer again...

Demo Video - Modified Red Nelb v0.8

The video show a quick test where a modified version of the Red Nelb rig (cheers Daniel/Pepeland!) where this setup has been applied. It is important to note that since the rig wasn't specifically designed for such usage, there are still some elements of clunkiness which mean that this is not an accurate representation of what the intended means of interaction will be like (for that, check out the videos in the original thread).

- The video quality is also a bit nasty, since I recompressed to make it a more palatable size to upload, though this has meant that the video quality flickers a bit.
- I've uploaded the rig used here to:

The Setup
Using the example of Red Nelb, there are three components to this rig:
1) The armature/rig ("Red_Nelb_rig") - these are the bones that you animate. For the best setup, try to work out a system where you can get all the bones inside the rig, lying where an animator would expect to click to directly manipulate the body part in question.

2) Character Mesh ("PSL_mesh_def") - this is the character's mesh that gets rendered/shown in the viewport. Nothing new here.

3) The "Mask" Mesh ("PSL_select_mask") - this is where the magic takes place.
   i. We take a copy of the character mesh/meshes, perhaps simplifying the geometry if necessary, including all deformers/shapekeys it may have.
   ii. We remove all the materials, and assign a single material to the whole mesh. The color(s) are up to you, but the important point is to ensure that this color(s) stands out from the colors on the character mesh. Also, this material should be set to be slightly transparent (or not), in which case, you may want to activate the "Transparency" option in the Object >> Draw Options Panel too.
   iii. We add a "Mask" modifier to this mesh, setting it to the "Armature" mode, and giving it the rig that the animator uses to animate with (i.e. "Red_Nelb_rig"). To minimise the performance hit, try placing this before the Subsurf modifier, to reduce the amount of geometry that will need to be processed. However, if you've got a MeshDeform modifier somewhere in the stack, then you will be forced to put this after that, as it is not tolerant of changing geometry.
    iv. We make this mesh visible in the Viewport only (Outliner visibility toggles), so that this doesn't obscure the character mesh in unexpected ways when rendering. 

In the setup outlined above, animators still end up selecting the bones in the armature. Here, they are just made to be not so prominent (such that they clutter the view, obscuring the forms of the meshes being animated), and are placed "under the skin" in ideal circumstances. The occasional external control is still acceptable though if it doesn't make sense embedded within the body for direct manipulation. We also get a nice visual representation of the area of influence of each control. And all of this practically built in to Blender.

How this Works
The "Armature" mode of the Mask Modifier filters out the verts/faces of the mesh that it is applied to so that only those which belong to the vertex groups corresponding to selected bones are included.


  1. OH MY GOOOODDD@!!!!! this is so awesome :DDD

  2. I also am rather fond of your work.
    Nice one Aligorith!

  3. It's not working if implemented to armature that has controler bones separated from it's deformer, just like rigify. Any workaround for that?