Who Was That Masked Map?
A single map is used several times in the following exercise as both the color and the mask, and eventually as the bump map. Masking is a more complex technique, but this exercise walks you through the basics of using it so that you can understand the concept behind it.
Reusing a single map for multiple purposes is an efficient way to work in 3ds max 5 because the map has to be loaded into memory only once. If you had separate Diffuse maps, Bump maps, and Mask maps, the memory requirements would be three times as great.
Exercise: Masking and Tinting for Flexible, Efficient Materials
In this exercise, you learn to use a Mask map in the Diffuse Color slot to allow the map colorin this case, whiteto show through the dark blue Diffuse Color. You then learn to use an RGB Tint map to adjust the color of the revealed underlying map. You'll be working with a two-wheeled personal transport device, shown in Figure 1, in this exercise.
Figure 1 Your own personal transporter!
Open the TransMatl02.max file from boardman_mask.zip, and save it as TransMatl03.max. Open the Material Editor and click the second sample window in the top row to activate the Metallic_platform material.
In the Material Editor, click the Standard button to the right of the material name. In the Material/Map Browser, double-click the Raytrace material type, which will give you better control of the reflections. In the Raytrace Basic Parameters rollout, click the Diffuse Color swatch to open the Color Selector. In the RGB value fields, set Red to 6, Green to 20, and Blue to 66 for a dark blue color.
Click the gray map shortcut box to the right of the Diffuse Color swatch to drop to the material's map level. Double-click Bitmap in the Material/Map Browser and open the TransBump.png file from boardman_mask.zip. This simple black-and-white image includes footprints and the number 42 (see Figure 2). In the Material Editor, click the Show Map in Viewport button just below the sample windows. The platform will change color, but will not actually show the map until the object has mapping coordinates assigned.
Figure 2 This black and white bitmap, created in the Top viewport, consists of text and two shapes converted to Editable Mesh objects. A white material with full self-illumination was applied, and the Top viewport was rendered as a PNG file.
The sample sphere will turn black with white figures, as the black-and-white bitmap is controlling 100% of the Diffuse Color. You want blue with white figures for your material, so you'll substitute a Mask map for the bitmap, but keep the bitmap as a sub-map. In the Material Editor, click the Bitmap button to the right of the map name. In the Material/Map Browser, double-click Mask. In the Replace Map dialog box, make sure the Keep Old Map as Sub-map radio button is selected, and click OK. The Material Editor should look like Figure 3.
Figure 3 By choosing Mask map and keeping the bitmap as a sub-map, you now have a Mask slot below the current map.
In a mask, the white pixels are opaque and the black pixels are transparent, allowing the base color to show through that portion of the mask.
In the Material Editor, Mask Parameters rollout, drag and drop the Map button onto the Mask button. Select the Copy radio button and click OK in the Copy (Instance) Map dialog box. The sample sphere shows a blue sphere with white figures. Click the Material/Map Navigator button to see the material's hierarchy so far (see Figure 4).
Figure 4 The Material/Map Navigator shows that you have the same map used twice in the materialonce for color and again to mask where the base color is shown in the material.
Next, you'll apply a RGB Tint map to this material's map level so that you can change the map color at any time. This method is good if you have a client who isn't sure what color he or she wants. In the Material/Map Navigator, click the first Map level indented under the Diffuse slot to go to that level. In the Material Editor, click the Bitmap button to the right of the map name and double-click RGB Tint in the Material/Map Browser. In the Replace Map dialog box, make sure Keep the Old Map as Sub-map is selected, and click OK. The RGB Tint map has equal parts of pure red, green, and blue to make white, so it has no effect on the white map. In the RGB Tint Parameters rollout, drag and drop the red color swatch onto the green and the blue slots, selecting Copy in the Copy or Swap Colors dialog box for each action. The RGB Tint map is now tinting the figures bright red, and the Mask map is still revealing the blue base color.
Next, you'll add the TransBump.png map to the material's Bump slot. The white pixels in the map make the figures appear raised, and the black pixels do nothing. In the Material/Map Navigator, click the top level, and in the Material Editor, Maps rollout, resize the Material Editor and scroll, if necessary, to see the Bump slot.
In the Material/Map Navigator, click and drag the Mask: Map #16 (TransBump.png) level onto the None button next to the Bump slot in the Maps rollout. Select the Instance radio button in the Instance (Copy) Map dialog box and click OK (see Figure 5). The text looks slightly raised on the sample sphere. In the Maps rollout, enter 75 in the Bump Amount field to heighten the illusion. Close the Material Editor and Material/Map Navigator.
The actual map numbers might be different in your scene.
Figure 5 You can clone maps by dragging from the Material/Map Navigator to the buttons in the Material Editor.
Quick render the Perspective viewport. You'll see a Missing Map Coordinates message box indicating that platform_shape01 has no mapping coordinates to place the map pattern on the surface. Click Cancel to cancel the render. On the main toolbar, click the Select button and click on platform_shape01 in the Perspective viewport. In the Modify panel, Modifier List, double-click the UVW Map modifier. Quick render the Perspective viewport. Because of the way the object was created, the default Planar map is perpendicular to the object's Local Z axis, which stretches the footprints across the width of the platform and places the numbers backward (see Figure 6). In the Modify panel, click the Remove Modifier from the Stack button to remove UVW Map. It will not give you the correct orientation for the maps.
Figure 6 The Planar UVW Map does not orient the maps correctly on your platform.
Positioning map patterns on objects can often be challenging, to say the least. 3ds max 5 makes it a lot easier with the improved Unwrap UVW modifier, which allows you to control the surface coordinates to match patterns in the current material's bitmaps. You'll use this modifier to make positioning the footpads and racing numbers on your transporter a snap.
You want the footprints on the platform facing forward and the number 42 on top of each fender. You have only one 42, which is in front of the footprints. You will use the improved Unwrap UVW modifier to give you the control you need. With the platform_shape01 object selected, go to the Modify panel, Modifier List, and click Unwrap UVW. In the Parameters rollout, click the Edit button. This opens the Edit UVWs dialog box and shows the mesh from the side with some selected vertices. In the Modify panel, Selection Parameters rollout, click the minus button to deselect the vertices.
Click the UV drop-down list at the top right of the Edit UVWs dialog box, and select Pick Texture from the list (see Figure 7). Double-click Bitmap in the Material/Map Browser and open TransBump.png from boardman_mask.zip. This drops it into the dialog box background. The mesh in the dialog box represents the mapping coordinates on the surface, and you can see the relationship to help align the pattern.
Figure 7 You can view a bitmap in the Edit UVWs dialog box by selecting Pick Texture in the UV drop-down list.
You do not want the default mapping because you need a more complex positioning on the object's surface. Choose Mapping, Flatten Mapping from the Edit UVWs menu. In the Flatten Mapping dialog box, enter 40 in the Face Angle Threshold field and click OK (see Figure 8).
Figure 8 The Flatten Mapping option groups faces that meet at 40 degrees or less and flattens them onto the Edit UVWs display with the bitmap visible in the background.
At the bottom of the Edit UVWs dialog box, in the Selection Modes section, click the Select Element check box. Click on the shapes in the display, and each element will be highlighted in red as it's picked. In the Edit UVWs display, zoom out slightly to see that the map is tiled in the background. Drag a selection window around half of the elements, and move them to the right, into the black space away from the map figures. Move the other half to the left so that the figures do not appear on the object.
Click the Freeform Mode button at the top left of the Edit UVWs dialog box. Also, make sure the Show Map in Viewport button is toggled on in the Material Editor. In the Edit UVWs display, select the large element in the middle of the second column of elements on the left (see Figure 9), pick any of its vertices, and move the element over the footprints. Zoom in to see the alignment better. The footprints now show on the platform in the Perspective viewport. You are adjusting the mesh's mapping coordinates to match the map patterns. Click on one of the Element Gizmo's yellow corners, and scale the element so that the footprints fit in the rectangular area. Move the element again to center it on the footprints (see Figure 10).
By default, the Edit UVWs cursor is in Freeform Mode. Clicking the corner points scales the selection, clicking the midpoints rotates the element, and clicking on a vertex moves the element. If you hold Ctrl down while dragging, you lock the Element Gizmo's aspect ratio. Holding down Shift restricts scaling to one axis.
Figure 9 By selecting elements in the Edit UVWs display and moving them away from the bitmap figures, the map will not show anywhere on the mesh in the scene. Then select the middle element in the left grouping.
Figure 10 Scaling the element large makes the pattern look smaller on the surface. Moving the element adjusts the position of the pattern on the surface.
Next, you'll align the top coordinates of the left and right fenders (see Figure 11) over the 42 in the map. You need to rotate and scale the elements for the right fit. In the Edit UVWs display, rearrange the fender's top elements to make the numbers smaller so that they can be read on each side (see Figure 12).
Figure 11 Align the two fender top elements with the 42 in the bitmap.
Figure 12 You can position the numbers on each fender by moving, rotating, and scaling the elements in the Edit UVWs dialog box.
If this pattern were too crowded to get the results you wanted, you could zoom out and move elements to any other tiled map location in the display.
Close all windows and dialog boxes. Right-click in the Perspective viewport and click the Quick Render button. The shiny blue platform should have bright red figures raised from the surface. Open the Material Editor, and at the top level of the Metallic_platform material, click the Reflect Color swatch in the Raytrace Parameters rollout. In the Color Selector dialog box, enter 100 in the Values field, and press Enter. In the Raytrace Parameters rollout, enter 100 in the Specular Level field and press Enter. Quick render the Perspective viewport. You should have a shiny blue platform with chrome fixtures and rubber tires.
Close all windows and dialog boxes, and save the file. It should already be called TransMatl03.max. If you like, you can compare your ending scene with the TransMatl03.max from boardman_mask.zip.
To follow along with this exercise, you can download the scene and map files. They have been zipped into boardman_mask.zip for faster downloading.