All of the techniques covered thus far work on polygon primitives. They will not, however, necessarily work on any polygon surfaces you've modeled. While NURBS surfaces are always four-sided, polygon surfaces are made up of many small faceswhich means that applying textures to them is not as simple as it is on NURBS surfaces. Think of a wrapped present. Imagine carefully removing the wrapping paper and flattening it out. Once the paper has been flattened, you can easily paint a new image on it (Figure 15.90). Figure 15.90. A wrapped-gift texture has been mapped to a cube. This is essentially what you need to do to add texture to a polygon surface. Before you can successfully texture-map it, you need to "unwrap" the surface. To do this, you create a UV map, which you can see in the UV Texture Editor (Figure 15.91). Figure 15.91. The white lines in the UV Texture Editor represent the edges of the cube. You can see how the cube has been "unwrapped." The image beneath these lines is what the actual image file that's mapped to the surface looks like. The UV maps for complicated characters can be confusing to look at, and require a lot of work to use effectively. However, you don't need to create them for polygon primitives because they come with them. One distinct advantage of polygons over NURBS is that you can assign shading groups to individual faces of a polygon surface, while a NURBS surface can have only one shading group assigned to it. You do this by selecting polygon faces and assigning the materials to them, not to the object as a whole (Figure 15.92). Figure 15.92. Four different textures have been mapped to different parts of the same polygon sphere by assigning them to specific faces of the sphere. To create automatic mapping for a polygon texture: 1. | Create a polygon telephone (Figure 15.93). Figure 15.93. By using Extrude Face and Smooth, a phone can be modeled from a cube in a few easy steps. For a detailed instruction of how to do this, see "To model a Subdiv telephone receiver, starting with a polygon" in Chapter 9, "Subdiv Surfaces." However, do not convert it to subdivision surfaces. Instead, smooth the polygon with a subdivision level of 3 and a continuity of 0.35. Save this model for later use. | 2. | Create a Blinn material, and assign it to the surface. | 3. | Open the Hypershade and double-click the Blinn material. The Attribute Editor for the Blinn material opens. | 4. | Click the Map button next to the Color slider in the Attribute Editor. The Create Render Node window appears. | 5. | Make sure that the radio button next to Normal is selected, and then click File. The Attribute Editor for the file node opens. | 6. | Click the Browse button next to Image Name. | 7. | Browse for and open your own image file. This one was created especially for the phone, but any image will do. The image will look messed up and stretched out on the phone in the Perspective view (Figure 15.94). Figure 15.94. On the left is the file texture that is mapped to the phone. On the right, the texture on the phone is stretched out and in the wrong places. | 8. | Select the surface. | 9. | From the Edit Polygons menu, select Texture > Automatic Mapping. Now the image is not stretched out as much, but the different elements are not in place (Figure 15.95). Figure 15.95. Now that a UV map has been created using automatic mapping, the texture is placed on all parts of the surface, but not in the right places. | You navigate the UV Texture Editor just as you would any panel. You can track and dolly the same way you do in any view panel. And the Move, Rotate, and Scale tools work just as they do in the rest of the program. The image that is mapped to the surface is tiled in the UV Texture Editor. This allows you to move up different parts of the surface onto the part of the image you want without a lot of messy overlapping. To use the UV Texture Editor: 1. | Continue using the phone from the previous task. | 2. | Right-click the surface and select UV from the Marking menu. | 3. | Choose one UV point from the center of the earpiece of the telephone (Figure 15.96). Figure 15.96. One UV point has been selected from the center of the earpiece of the phone. | 4. | From the Window menu select UV Texture Editor. The UV Texture Editor opens. You can see the image that was assigned to the surface, and on top of that is the wire-frame of the different parts of the surface (shells) that have been separated. The one point you picked on the surface is visible and is easy to find because of the transform manipulator on it (Figure 15.97). Figure 15.97. In the UV Texture Editor, you can see how the different parts of the surface have been laid out over the image map. The UV point that was selected in the Perspective view is also selected here and is seen with move manipulators on it. This makes it easy to recognize which shell is the phone's earpiece. | 5. | Right-click the shell, and from the Marking menu, choose Select > Select Shell (Figure 15.98). Figure 15.98. Rather than having to carefully select each UV of the shell, you can select the whole shell at once by clicking with the right mouse button and choosing Select > Select Shell from the Marking menu. All the UVs of the shell are selected. | 6. | Move, scale, and rotate the shell over a recognizable part of the image. You can watch the image on the selected area of the phone change interactively in the Perspective view (Figure 15.99). Figure 15.99. While placing the UVs in the Texture view (right), you can see their effect on the surface simultaneously (left). | 7. | Repeat Steps 3 through 6 for other parts of the phone. | Because the surface is in many separate pieces (shells) in the UV Texture View, there are seams on the surface (Figure 15.100). We can combine two shells and get rid of the seam by using Move and Sew UVs. Figure 15.100. A seam in the texture is apparent along the side of the phone. To eliminate a seam in a texture using Move and Sew UVs: 1. | Continue using the phone from the previous tasks. | 2. | In the Perspective view, carefully select all of the edges along the seam (Figure 15.101). Figure 15.101. All of the polygon edges along the edge of the seam have been carefully selected. The corresponding edges are automatically selected in the UV Texture Editor when you select them on the object (Figure 15.102). Figure 15.102. The edges of two shells are selected because they are, in fact, one edge shared by both shells. | 3. | From the Edit Polygons menu select Texture > Move and Sew UVs. The seam on the object disappears in the Perspective view (Figure 15.103). In the UV Texture Editor, two shells have been combined along that edge (Figure 15.104). Figure 15.103. The seam is now gone because the edges of the two shells have been sewn together, allowing the texture image to extend across both. Figure 15.104. What was once two separate shells is now one bigger shell covering a larger portion of the phone. | Using the UV Texture Editor toolbar The UV Texture Editor toolbar holds shortcuts to many of the actions in the UV Texture Editor menus. The toolbar is divided into four main sections: UV position buttons, Isolate Selection buttons, View buttons, and UV edit buttons. They provide the following functions: UV position buttons This section holds shortcuts to many of the UV position tools, including Flipping, Rotating, Sewing, and Aligning UVs (Figure 15.105). Figure 15.105. The UV position buttons section of the UV Texture Editor toolbar. Isolate Selection buttons This section holds shortcuts to adding, removing, and toggling isolation tools (Figure 15.106). Figure 15.106. The Isolate Selection buttons section of the UV Texture Editor toolbar. View buttons This section holds snaps, toggles, and border menu shortcuts (Figure 15.107). Figure 15.107. The View buttons section of the UV Texture Editor toolbar. UV edit buttons This section holds UV coordinate input fields as well as UV copying and pasting features (Figure 15.108). Figure 15.108. The UV edit buttons section of the UV Texture Editor toolbar. Setting material attributes via the Channel Box You can adjust many of the material attributes using the Channel Box, which spares you having to search through the Attribute Editor for the right command. To set material attributes using the Channel Box: 1. | Create a NURBS primitive sphere. | 2. | Open the Hypershade and create a new Blinn and assign it to the sphere. | 3. | Select the Blinn in the work area. Many of the Blinn attributes are now available in the Channel Box. For this example, we'll change the transparency. | 4. | In the Channel Box, change the Transparency R, B, and G attributes to .5. The Sphere is now transparent. | Avoiding swimming textures Swimming textures is an undesirable effect that can occur when you animate an object that has a 3D texture applied to it; the animated object moves, but the assigned texture stays in the same place. To avoid swimming textures, you can parent the placement node to the object or set the texture to local. But if the object deforms, you need to convert the 3D texture to a file-based texture by using the Convert to File Texture command. To convert a 3D texture to a file texture: 1. | Create a NURBS primitive sphere. | 2. | Open the Hypershade, create a new Blinn, and assign it to the sphere. | 3. | Double-click the Blinn to open the Attribute Editor. | 4. | Click the map button for Color. | 5. | Select the 3D texture wood. | 6. | In the modeling window select the sphere, and in the Hypershade -select the Blinn. | 7. | From the Edit menu in the Hypershade, select Convert to File Texture. A new Blinn is assigned to the sphere. | About projecting UV maps Earlier in this chapter you were shown how to project a texture; you can also project UV maps. One main difference is that a projected UV map sticks to the object even if it deforms, whereas a deforming object will "swim" through a projected texture. To create a planar UV map for a polygon object: 1. | Open the model of the polygon telephone made in the first step of the task "To create automatic mapping for a polygon texture" earlier in this chapter. | 2. | Open the Hypershade, create a Blinn material, and assign it to the surface. | 3. | Double-click the Blinn material in the Hypershade. The Attribute Editor for the Blinn material opens. | 4. | Click the Map button next to the Color slider in the Attribute Editor. The Create Render Node window appears. | 5. | Make sure that Normal is selected, and then click File to open. | 6. | Select the phone surface, choose Edit Polygons > Texture and select the box next to Planar Mapping. The Polygon Planar Mapping Options dialog box opens (Figure 15.109). Figure 15.109. Use the Polygon Planar Mapping Options dialog box to control how the object is mapped. | 7. | For Mapping Direction, click Camera and click Apply. A projected mapping manipulator appears around the object (Figure 15.110). Figure 15.110. The projected mapping manipulator appears around the object. | 8. | Rotate the camera by pressing while you click and drag in the 3d view. The texture stretches across the object from the camera's previous position (Figure 15.111). Figure 15.111. Rotating the camera reveals that the texture was projected from the camera's previous POV (point of view). | 9. | In the Polygon Planar Mapping Options dialog box, click Apply again. The projected mapping manipulator changes position to match the camera's current direction (Figure 15.112). Figure 15.112. The projected mapping manipulator updates to match the current camera POV. Using the camera option forces the projection to be created from the camera's current view. | 10. | In the Mapping Direction section of the Polygon Planar Mapping Options dialog box, click Y Axis and click Apply. The projected mapping manipulator changes position so that it projects directly down the Y axis (Figure 15.113). Figure 15.113. The projected mapping manipulator projects down the Y axis. | 11. | Repeat step 10, but click the Z Axis button to project down the Z axis (Figure 15.114) or click the X Axis button to project down the X axis (Figure 15.115). Figure 15.114. Projecting down the Z axis. Figure 15.115. Projecting down the X axis. | 12. | Click and drag the green box on the texture projection manipulator. This scales the manipulator and allows additional control over the placement of a UV projection (Figure 15.116). Figure 15.116. Drag the handles on the projected mapping manipulator to change its scale and position. | 13. | Switch to Selection by Hierarchy mode and select the phone. | 14. | From the Deform menu, select Create Nonlinear > Bend. This applies a bend deformer to the object. | 15. | In the Inputs section of the Channel Box, click bend1 to reveal the bend controls (Figure 15.117). Figure 15.117. Apply a bend deformer and then expand the bend1 options under the Inputs section of the Channel Box. | 16. | Using the middle mouse button, click and drag Curvature back in forth in the 3D view to set it to .5. or In the numeric entry field, set Curvature to .5. This deforms the object so that the texture to stick to it (Figure 15.118). Figure 15.118. The object deforms and the texture sticks to it. | 17. | Uncheck Insert Before Deformers and click Apply again. The mapping changes to reflect the deformation of the object (Figure 15.119). Figure 15.119. Uncheck Insert Before Deformers to allow the mapping to be applied to the object in its current deformed shape. | To create a cylindrical UV map for a polygon object: 1. | Repeat steps 15 from the previous task, "To create a planar UV map for a polygon object." | 2. | Select the phone surface, choose Edit Polygons > Texture and select the box next to Cylindrical Mapping. The Polygon Cylindrical Projection Options dialog box opens (Figure 15.120). Figure 15.120. The Polygon Cylindrical Projection Options dialog box. | 3. | Click Apply to accept the default values and update mapping on the surface (Figure 15.121). Figure 15.121. The mapping on the object updates and the projected mapping manipulator appears. | 4. | In the first numeric entry field, set Image Scale to .5 click Apply (Figure 15.122). Figure 15.122. Type a lower value into Image Scale to force the texture to be larger in relationship to the object. The mapping updates so that the texture around the object is larger. | 5. | Click and drag the red box on the texture projection manipulator to make the texture around the object larger or smaller (Figure 15.123). Figure 15.123. Drag the handles on the projected mapping manipulator to control the position and scale of the projection in relationship to the object. | To create a spherical UV map for a polygon object: 1. | Repeat steps 15 from the task "To create a planar UV map for a polygon object," earlier in this chapter. | 2. | Select the phone surface, choose Edit Polygons > Texture and select the box next to Spherical Mapping. The Polygon Spherical Projection Options dialog box opens (Figure 15.124). Figure 15.124. The Polygon Spherical Projection Options dialog box. | 3. | Click Apply to accept the default values and update mapping on the surface (Figure 15.125). Figure 15.125. The mapping on the object updates and the projected mapping manipulator appears. | 4. | Click and drag the blue box on the texture projection manipulator to make the texture around the object smaller (Figure 15.126) or larger (Figure 15.127). Figure 15.126. Drag the handles on the projected mapping manipulator to scale the projection and make it smaller... Figure 15.127. ...or larger. | Texturing Subdivs Texturing subdiv surfaces is very similar to texturing polygons and under some circumstances it can be done exactly the same way. Say you want to create automatic mapping for a subdiv object (like the telephone you made in Chapter 9, "Subdiv Surfaces"). You can follow the same steps in "To create a planar UV map for a polygon object," earlier in this chapter, but choose Subdiv Surfaces > Texture > Automatic Mapping to open the Automatic Mapping Options dialog box. Or, to create a planar UV map for your subdiv phone, choose Subdiv Surfaces > Texture > Planar Mapping to open the Planar Mapping Options dialog box. Then continue with the steps in "To use the UV Texture Editor," earlier in this chapter. However, you cannot edit the UV mapping of a subdiv by switching to polygon mode. Instead, choose Modify > Convert > Convert to Subdiv Options to open the Convert to Subdiv Options dialog box. Then select Proxy Object Subdivision Surface Mode and when you edit the UV mapping on the polygon cage and it will update UV mapping on the subdiv surface. |
Using Adobe Photoshop In Maya, you can create layered PSD (Photoshop Document) files or use PSD image files with layers from Adobe Photoshop for textures. Being able to use layered files makes it simpler to manage complex textures that require individual image maps for one or more channels in a single shader. To create layered PSD in Maya: 1. | Select an object and, from the Texturing menu, select Create PSD Texture. The Create PSD Texture Options dialog box opens (Figure 15.128). Figure 15.128. Use the Create PSD Texture Options dialog box to create layered Photoshop image files to use as textures. | 2. | In the Attributes section, select color and transparency and click the right arrow (>) to add them to Selected Attributes (Figure 15.129). Figure 15.129. Select color and transparency and click the right arrow (>) to add them to Selected Attributes. | 3. | Click Create. The dialog box closes and Maya saves the PSD to the sourceimages folder in your current project directory. | 4. | Open the PSD in Adobe Photoshop (Figure 15.130). Figure 15.130. Open the PSD file that Maya created in Photoshop. The layered image file has a layer called UVSnapShot that you can use as a reference while painting in PS (Photoshop). The file also has layer sets named after the channels that were selected in the Create PSD Texture Options. | 5. | Paint several strokes on the layer in the lambert1.transparency layer set (Figure 15.131). Figure 15.131. Paint some strokes on the layer contained in the lambert1.transparency layer set. White is fully transparent and black is fully opaque. | 6. | Click the eye icon next to the lambert1.transparency layer set and the Uvsnapshot layer so that they are hidden. | 7. | Paint some colorful strokes on the layer in the lambert1.color layer set (Figure 15.132). Figure 15.132. Paint some colors on the layer. | 8. | Save the PSD file and switch back to Maya. | 9. | In the active view, choose Shading > Hardware Texturing. The hardware shaded view can display texture maps assigned to surfaces. | 10. | Select the object that for which the PSD texture was originally created and choose Texturing > Update PSD Textures. The surface updates, displaying the color map that was created in Photoshop (Figure 15.133). Figure 15.133. The surface displays the color map. | 11. | From the Render menu, select Render Current Frame. The Render View dialog box opens and renders the current view, showing the color channel and transparency channels that were painted (Figure 15.134). Figure 15.134. The surface updates show the color map that was created in Photoshop. | Tip To use an existing layered PSD in Maya: 1. | Open the Hypershade and, in the Create bar, expand 2D Textures. | 2. | Click Normal, then click the PSD File icon (Figure 15.135). Figure 15.135. Render the view so that all the channels used for a shader can be seen. A PSD File node appears as psdFileTex1 in the work area (Figure 15.136). Figure 15.136. A PSD File node appears as psdFileTex1 in the work area. | 3. | Double-click the psdFileTex1 node to open its Attribute Editor. | 4. | Click the Folder icon next to Image Name. The Open dialog box appears (Figure 15.137). Figure 15.137. The Open dialog box appears and defaults to the current project directory. | 5. | Select a PSD file from the hard drive and click Open. The Open dialog box closes and the texture sample of the psdFileTex1 updates with the PSD file that was selected (Figure 15.138). Figure 15.138. The texture sample updates with an image of the file that was selected. | 6. | From the pull-down menu next to Link To Layer Set, choose Composite (Figure 15.139). Figure 15.139. Choose Composite from the Link to Layer Set pull-down menu. This pull-down menu lists each layer set in the image. If the image has no layer sets, then Composite is the only item in the list. Composite is a "flattened" combination of all the visible layers in the PSD file. | 7. | In the Hypershade, create a Blinn shader, and assign it to the surface. The blinn shader appears in the work area next to the psdFileTex1 node. | 8. | With the middle mouse button, click and drag the psdFileTex1 node onto the blinn1 icon. | 9. | From the Marking menu that appears, select "color" (Figure 15.140). Figure 15.140. Middle-click and drag the psdFileTex1 node onto blinn1 to open the Marking menu. The icon of the blinn1 shader updates with the new texture. | Maya provides a one-click method to convert a PSD File node into a layered texture. The Convert to Layered Texture command creates a separate PSD file node for each layer set and connects them to a Layered Texture node. This command is also useful if you need to connect the layer sets to the channels of a shader. Convert to Layered Texture automatically creates additional PSD File nodes for each layer set and selects them in the Link To Layer Set section of the PSD File node attributes. Then you can use the middle mouse button to connect each PSD File node to the appropriate channel in the shader. To create layered texture from a PSD File node: 1. | Follow steps 16 from the previous task. | 2. | Right-click the psdFileTex node and select Convert To Layered Texture from the Marking menu that appears (Figure 15.141). Figure 15.141. Right-click the psdFileTex and select Convert to Layered Texture from the Marking menu. Several new nodes appear in the work area. For each layer set in the PSD file, a new psdFileTex node is created (Figure 15.142). Figure 15.142. Convert to Layered Texture creates psdFileTex nodes for each layer set in the PSD file and connects them to a layeredTexture node. | 3. | Click and drag the nodes so they do not overlap (Figure 15.143). Figure 15.143. Click and drag the nodes to rearrange them. | 4. | Right-click the layeredTexture node and select Graph Network from the Marking menu (Figure 15.144). Figure 15.144. Right-click layeredTexture and select Graph Network from the Marking menu. The work area updates showing how the psdFileTex nodes are connected to the layeredTexture node (Figure 15.145). Figure 15.145. The graph of the psdFileTex nodes connect to the layeredTexture. | 5. | With the middle mouse button, click and drag the layeredTexture node to any channel input of a shader. | 6. | Repeat step 5 with the individual psdFileTex nodes. | |