Masking in Materials

Something I stress in the 3ds Max and VIZ classes that I teach are masking techniques in the Material Editor and the quality of the masks are higher quality when the mask images contain Alpha channel.

Many of the masks I create could be done in an image editing program, but I find it much more flexible and controllable to create them directly in 3ds Max.  For example, if I need text or a symbol for a company logo and the client is not sure whether the colors will be blue on a red background, or yellow on a blue background, it is much more efficient for me to create a Blend material with a mask.  Each of the sub materials can be different colors, different bumpiness textures, or perhaps different opacities, and then I can use the Alpha channel mask to reveal the text and logo over the background.

Creating the Mask in Max or VIZ

For the mask itself I create the 2D shapes in a new Max scene, or off to one side in the current scene (the shapes could also be imported from CAD or other vector software), and then apply a Mesh Select modifier.  This converts the 2D shapes into solid flat planes without adding any significant overhead compared to, say, an Edit Mesh modifier. If I need to edit the text or logo, I can simply drop down in the Modify Stack, make the changes at the 2D level, and then return to the top of the stack to rerender my mask image.

The Material for the Mask objects

For the mask material, I create a pure white color swatch and copy it into Diffuse, Ambient, and Specular swatches, then switch the Self-Illumination to Color mode and copy the white swatch into it.  Now the flat planes in the scene will render white against a black background no matter what the lighting is in the scene. White pixels in a mask are opaque, black pixels are transparent, and gray pixels are some level in between.

Rendering for easier mapping

Finally, I select all the logo and text objects, switch my rendering type to Box Selected from the default View and render to a 24-bit PNG file with the Alpha Channel option checked.

Rendering with Box Selected insures that only the bounding box extents of the selected objects are rendered and the mask will have exactly the right aspect ratio so it can be placed and sized more accurately with Planar UVW mapping.

Upcoming tutorial

Sometime in the near future I'll post a tutorial to show how this technique can be used to map complex parking stripe layouts that can easily be changed.  In the meantime, try experimenting on your own to create a company logo or something similar.

Learning this simple technique can enhance productivity in your daily workflow.