MaskBaker is a free script from Nettle for Autodesk 3ds Max. This tool is designed for easy generation of material masks while mapping hi-poly onto low-poly models.


The script window looks as follows:
An example of script use:

First, create a hi-poly 3D model and then texture it as a whole using the Multi/Sub-Object material.
Within Multi/Sub-Object you can create materials to texture certain polygons of the model.
After that, create a low-poly model and map the hi-poly model onto it.
Apply the Projection modifier to the low-poly model and designate the hi-poly model as the mapping source.
Create and edit an unwrap of the low-poly model with the Unwrap UVW modifier.
Run the MaskBaker script, select the low-poly model in the 3ds Max window, and press Refresh.
The list of materials for the hi-poly model is displayed.
Double-click on the material to run the script. The script will set the Diffuse color for the selected material to white and change the color of the other materials in the model to black. If you uncheck Renderable for the low-poly model, you will be able to review the mask of this material in the hi-poly model.
Press the Show diffuse maps button to reset the Diffuse color for every material in the model to white.
Select the object texture size and the file path for the masks of the materials. Press Bake to carry out sequential rendering of all the masks. The names of the mask files will coincide with the names of the materials in the hi-poly model.

If you previously unchecked Renderable in the low-poly model properties to review the masks of the materials, remember to check it again before pressing Bake.
Material masks generated in this manner can be used in CompositeMap, a utility from Nettle for developers working with Unity 3D.