Chapter 7
Autodesk® Maya® Shading and Texturing

Shading is the term for applying colors and textures to create materials, also known in the Autodesk® Maya® software as shaders. A shader defines an object’s look—its color, tactile texture, transparency, luminescence, glow, and so forth.

  1. Learning Outcomes: In this chapter, you will be able to
  • Differentiate between different shader types
  • Create and edit shader networks in the Hypershade window
  • Apply shaders and textures to a model
  • Set up UVs on a model for the best texture placement
  • Understand the steps to set up texture images to fit a model’s UV layout
  • Tweak UVs to align texture details
  • Use Maya’s toon shading to create a cartoon look

Maya Shading

When you create any objects, Maya assigns a default shader to them called Lambert1, which has a neutral gray color. The shader allows your objects to render and display properly. If no shader is attached to a surface, an object can’t be seen when rendered. In the Maya viewports, it will appear wireframe all the time, or as flat green, even in Shaded view.

Shading is the proper term for applying a renderable color, surface bumps, transparency, reflection, shine, or similar attributes to an object in Maya. It’s closely related to, but distinct from, texturing, which is what you do when you apply a map or other node to an attribute of a shader to create some sort of surface detail. For example, adding a scanned photo of a brick wall to the Color attribute of a shader is considered applying texture. Adding another scanned photo of the bumps and contours of the same brick wall to the Bump Mapping attribute is also considered applying a texture. Nevertheless, because textures are often applied to shaders, the entire process of shading is sometimes informally referred to as texturing. Applying textures to shaders is also called texture mapping or simply mapping.

c07f001.tif

Figure 7-1: The Maya shading nodes and categories

Shaders are based on nodes. Each node holds the attributes that define the shader. You create shader networks of interconnected shading nodes, akin to the hierarchies and groups of models.

As you learn about shading in this chapter, you’ll deal at length with the Hypershade window. See Chapter 2, “Jumping into Basic Animation Headfirst,” and Chapter 3, “The Autodesk® Maya® 2016 Interface,” for the layout of this window and for a hands-on introduction. You can access the Hypershade window by choosing Windows ⇒ Rendering Editors ⇒ Hypershade. Shading in Maya is almost always done hand in hand with lighting. At the least, textures are tweaked and edited in the lighting stage of production.

Shader Types

Open the Hypershade window by choosing Windows ⇒ Rendering Editors ⇒ Hypershade. In the left column of the Hypershade window, you’ll see a listing of Maya shading nodes (Figure 7-1), split into categories. The first category displays surface nodes, a.k.a. material nodes or shader types. Of these shader types, a few are common to other animation packages (Lambert, Phong, and Blinn for example).

The way light bounces off an object defines how you see that object. The surface of the object may have pigments that affect the wavelength of light that reflects off it, giving the surface color. Other features of that object’s surface also dictate how light is reflected.

Most light, after it hits a surface, diffuses across an area of that surface showing off the object’s color. It may also reflect a hot spot called a specular highlight (a basic reflection of a light source). The shaders in Maya differ in how they deal with specular and diffuse parameters according to the specific math that drives them. As you learn about the shader types, think of the things around you and what shader type would best fit them. Some Maya shaders, such as the Hair Tube shader and the Use Background shader, are specific to creating special effects. It’s important to learn the fundamentals first, so I’ll cover the shading types you’ll be using right off the bat.

You can adjust the settings for a shader’s look either through the Hypershade’s Property Editor or through the usual Attribute Editor in the main Maya UI. Next you’ll take a quick look at the different types of shaders and what they do.

The Lambert Shader Type

The default shader type is Lambert, an evenly diffused shading type found in dull or matte surfaces. A sheet of regular paper, for example, is a Lambert surface.

A Lambert surface diffuses and scatters light evenly across its surface in all directions, as you can see in Figure 7-2.

c07f002.tif

Figure 7-2: A Lambert shader

The Phong Shader Type

Phong shading brings to a surface’s rendering the notions of specular highlight and reflectivity. A Phong surface reflects light with a sharp hot spot, creating a specular highlight that drops off sharply, as shown in Figure 7-3. You’ll find that glossy objects such as plastics, glass, and most metals take well to Phong shading.

c07f003.tif

Figure 7-3: A Phong shader

The Blinn Shader Type

The Blinn shading method brings to the surface a highly accurate specular lighting model that offers superior control over the specular’s appearance (see Figure 7-4). A Blinn surface reflects light with a hot spot, creating a specular that diffuses somewhat more gradually than a Phong. The result is a shader that is good for use on shiny surfaces and metallic surfaces.

c07f004.tif

Figure 7-4: A Blinn shader

The Phong E Shader Type

The Phong E shader type expands the Phong shading model to include more control over the specular highlight. A Phong E surface reflects light much like a regular Phong does, but it has more detailed control over the specular settings to adjust the glossiness of the surface (see Figure 7-5). This creates a surface with a specular that drops off more gradually and yet remains sharper than a Blinn. Phong E also has greater color control over the specular than do Phong and Blinn, giving you more options for metallic reflections.

c07f005.tif

Figure 7-5: A Phong E shader

The Anisotropic Shader Type

The Anisotropic shader is good to use on surfaces that are deformed, such as a foil wrapper or warped plastic (see Figure 7-6).

Anisotropic refers to something whose properties differ according to direction. An anisotropic surface reflects light unevenly and creates an irregular-shaped specular highlight that is good for representing surfaces with directional grooves, like CDs. This creates a specular highlight that is uneven across the surface, changing according to the direction you specify on the surface, as opposed to a Blinn or Phong where the specular is circular.

The Layered Shader Type

A Layered shader allows the stacking of shaders to create complex shading effects, which is useful for creating objects composed of multiple materials (see Figure 7-7). By using the Layered shader to texture different materials on different parts of the object, you can avoid using excess geometry.

You control Layered shaders by using transparency maps to define which areas show which layers of the shader. You drag material nodes into the top area of the Attribute Editor and stack them from left to right, with the leftmost shader being the topmost layer assigned to the surface, like a candy shell around a chocolate.

Layered shaders are valuable resources to control compound and complex shaders. They’re also perfect for putting labels on objects or adding dirt to aged surfaces.

c07f006.tif

Figure 7-6: An Anisotropic shader

c07f007.tif

Figure 7-7: A Layered shader

The Ramp Shader Type

c07f008.tif

Figure 7-8: A Ramp shader in the Property Editor

A ramp texture is a gradient that can be attached to almost any attribute of a shader as a texture node. Ramps can create smooth transitions between colors and can even be used to control particles. (See Chapter 12, “Autodesk® Maya® Dynamics and Effects.”) When used as a texture, a ramp can be connected to any attribute of a shader to create graduating color scales, transparency effects, increasing glow effects, and so on.

The Ramp shader (as opposed to the ramp texture discussed earlier) is a self-contained shader node that automatically has several ramp texture nodes (a.k.a. gradients) attached to its attributes. This makes for a simplified editing environment for the shader because all the colors and handles are accessible through the Ramp shader’s own Property Editor, as shown in Figure 7-8. The Attribute Editor will display much the same information, just slightly differently than the Property Editor.

To create a new color in any of the horizontal ramps, click in the swatch to create a new ramp position. Edit its color through its Selected Color swatch. You can move the position by grabbing the circle right above the ramp and dragging left or right. To delete a color, click the box beneath it.

These ramp textures are automatically attached to the Color, Transparency, Incandescence, Specular Color, Reflectivity, and Environment attributes of a Ramp shader. In addition, a special curve ramp is attached to the Specular Roll Off attribute to give you more precise control over how the specular highlight diminishes over the surface.

Bifrost Materials

You can see three icons marked Bifrost Materials in the Create panel, toward the top. Bifrost is a liquid simulation engine in Maya that typically uses its own materials, found here. Since I do not cover the advanced workflow behind Bifrost in this book, I will leave these materials out of this book as well.

Shaderfx and Stingray PBS Shader Types

These shaders sit at the top of the Create panel in the Hypershade. Shaderfx is an editing tool for creating shader networks for game engines. Stingray is Autodesk’s own game engine. Because these are advanced shaders specific to games, their functions will not be covered in this introductory book. However, in short, they will allow you to create materials and looks for your game assets in Maya and let you import those looks directly into the appropriate game engine without needing to re-create the materials in the engine itself.

Shader Attributes

Shaders are composed of nodes just like other Maya objects. Within these nodes, attributes define what shaders do. Here is a brief rundown of the common shader attributes with which you’ll be working:

  1. Color An RGB or HSV value defines what color the shader is when it receives a neutral color light. For more on RGB and HSV, see the “RGB and HSV” sidebar in this chapter.
  1. Transparency The higher the Transparency value, the less opaque and more see-through the object becomes. Although usually expressed in a black-to-white gradient, with black being opaque or solid and white being totally clear, transparency can have color. In a color transparency, the shader’s color shifts because only some of its RGB values are transparent, as opposed to the whole.
  2. Ambient Color This color affects the overall color attribute of a shader because this adds a flat ambient color irrespective of lighting in the scene. The default is black, which keeps the darker areas of a surface dark. The lighter the ambient color, the lighter those areas become. A bright Ambient Color setting flattens out an object, as shown in Figure 7-9.
    c07f009.eps

    Figure 7-9: Ambient color values flatten an object.

  3. Incandescence This attribute is the ability to self-illuminate. Objects that seem to give off or have their own light, such as an office’s fluorescent light fixture, can be given an Incandescence value. Incandescence doesn’t, however, light objects around it in regular renders, nor does it create a glow. Also, it tends to flatten the object into a pure color (see Figure 7-10). As you’ll see in Chapter 11, “Autodesk® Maya® Rendering,” incandescence can also help light a scene in the mental ray® Final Gather rendering.
c07f010.eps

Figure 7-10: Incandescence values

  1. Bump Mapping This attribute creates a textured feel for the surface by adding highlights and shadows to the render. It doesn’t alter the surface of the geometry, although it makes the surface appear to have ridges, marks, scratches, and so forth. The more intense the variation in tones of a bump map, the greater the bump. Bump maps are frequently used to make surfaces look more real because nothing in reality has a perfectly smooth surface. Using bumps very close up may create problems; bumps are generally good for adding inexpensive detail to a model that isn’t in extreme close-up (see Figure 7-11).
c07f011.eps

Figure 7-11: The effects of a bump map

  1. Diffuse This value governs how much light is reflected from the surface in all directions. When light strikes a surface, light disperses across the surface and helps illuminate it. The higher this value, the brighter its object is when lit. The lower the Diffuse value, the more light is “absorbed” into the surface, yielding a darker result (see Figure 7-12).
c07f012.eps

Figure 7-12: How a Diffuse value affects a shader’s look

  1. Translucence and Translucence Focus The Translucence and Translucence Focus attributes give the material the ability to transmit light through its surface, like a piece of canvas in front of a light. At a value of 1 for Translucence, all light shines through the object; at 0, none does. The Translucence Focus attribute specifies how much of that light is scattered. A light material such as paper should have a high translucence focus, and thicker surfaces should have low focus rates.
  2. Glow Intensity Found in the Special Effects section of the Attribute Editor, the Glow Intensity attribute adds a glow to the object, as if it were emitting light into a foggy area (see Figure 7-13). You’ll add glow to an object in Chapter 10, “Autodesk® Maya® Lighting.”
c07f013.eps

Figure 7-13: Adding a glow

  1. Matte Opacity Objects rendered through Maya generate a solid matte. Where there is a solid object, the matte is white; where there is nothing, the matte is black. In compositing programs, which bring together elements created independently into a single composite scene, mattes help to separate rendered CG from their backgrounds. Turning down the slider decreases the brightness of the object’s matte, making it appear more transparent. For more information about mattes, see the sidebar “Image Mattes” in this chapter, and see Chapter 11.
  2. Raytrace Options With raytracing, you can achieve true reflections and refractions in your scene. This subset of attributes allows you to set the shader’s raytracing abilities. See Chapter 11 for more on raytracing.

Some attributes are available only with certain shader types. The following are the attributes for the Phong, Phong E, and Blinn shaders because they can be shiny and reflective:

  1. Specular Color This sets the color of the highlights on a shiny surface. Black produces no specular, and white creates a bright one.
  2. Reflectivity This sets the amount of reflection visible in the surface. The higher the value, the more reflective the object will render. Increasing this value increases the visibility of the Reflected Color attribute or of true reflections in the scene when raytraced.
  3. Reflected Color This gives the surface a reflection. Texture maps are generally assigned to this attribute to give the object a reflection of whatever is in the image file or texture without having to generate time-consuming true reflections with a raytraced render. Using raytracing to get true reflections, however, is the only way to generate reflections of other objects in the scene.
  4. Cosine Power Available only with a Phong shader, this attribute changes the size of the shiny highlights (a.k.a. specular) on the surface. The higher the number, the smaller the highlight looks.
  1. Roughness, Highlight Size, Whiteness These control the specular highlight on a Phong E surface only. They control specular focus, amount of specular, and highlight color, respectively.
  2. mental ray Attributes Because Autodesk integrates features of the Nvidia mental ray rendering engine into Maya, an object’s Attribute Editor usually includes a set of mental ray options. Shaders are no different. If you open the Mental Ray heading in the Attribute Editor for a shader, you’ll see attributes such as Reflection Blur and Irradiance, as well as a few ways to override the Maya shading attributes with those of mental ray. You’ll work with mental ray in Chapters 10 and 11.

Shading and Texturing the Toy Plane

In the following section, you’ll add shaders to the toy plane from Chapter 6, “Practical Experience!” This exercise is also available in a video on the book’s web page, as well as my YouTube account. The plane is fairly straightforward to shade. Use bodyModel_v06.ma from the plane project from the companion website. You have just two colors on the body of the plane. You’ll start by making shaders in the Hypershade.

  1. With either your scene file or bodyModel_v06.ma loaded, open the Hypershade (Windows ⇒ Rendering Editors ⇒ Hypershade). You need to re-create a plastic look for the toy plane. Create two Blinn shaders by clicking Blinn in the Create column in the Hypershade twice, as shown in Figure 7-14. Name the first shader gray and the second shader yellow.
    c07f014.tif

    Figure 7-14: Create two Blinn shaders.

    The toy plane is yellow and gray, but it has some flakes of dark gray in both colors. Figure 7-15 is a close-up photo of a yellow pontoon to showcase the dark “noise” in the plastic color. You will mimic that with a texture node called Noise.

  1. In the Create Panel of the Hypershade, click 2D Textures to display the 2D texture nodes. Then click Noise to create a new noise texture, though you won’t notice that it’s been made immediately. Click the Textures tab at the top of the Hypershade to display the noise texture you just created, as shown in Figure 7-16 (left). MMB+drag the noise1 icon from the top of the Hypershade to the work area in the lower right of the Hypershade. The icon here (as shown in Figure 7-16, right) allows you to make shader connections easier. More on this later.
  2. It doesn’t look like much now, but you will adjust the attributes on this noise texture to simulate the dark flakes in the plastic. With the noise texture node still selected, in the Property Editor (or the Attribute Editor, if you prefer) set the attribute values as shown in Table 7-1, leaving the remaining attributes at their default values.

    Table 7-1: Noise texture values

    AttributeValue
    Threshold0.735
    Amplitude0.56
    Ratio2.02
    Frequency Ratio6.62
    Spottyness1.4

    Also in the Color Balance heading, click the white color swatch next to the Color Gain attribute and set that color to a mustard yellow using the HSV values of 46., 0.756, 0.472, as shown in Figure 7-17. Click in the top of the Property Editor and rename the node from noise1 to noiseYellow. This color will give you the yellow you need for that plastic.

c07f015.tif

Figure 7-15: A close-up of a yellow pontoon shows flakes of dark gray in the plastic color.

c07f016.tif

Figure 7-16: Click to create a new noise texture node and find it in the Textures tab (left). The noise1 icon in the Work Area of the Hypershade next to the Property Editor showing its attributes (right).

c07f017.tif

Figure 7-17: Setting the noise texture values

  1. You’ll duplicate the yellow noise node to make a blue-gray version for the gray plastic parts of the plane. In the Hypershade, select noiseYellow and choose Edit ⇒ Duplicate ⇒ Shading Network. Name the duplicate texture node noiseGray. The duplicated texture will appear on the Textures tab at the top of the Hypershade. MMB+drag the noiseGray texture node down to the Work Area next to the yellow one you’ve already created.
  2. In the Color Balance heading for the noiseGray node, set the Color Gain HSV values to 231, 0.56, 0.20.
  3. Switch to the Materials tab and select the gray shader in the Hypershade to display it in the Property Editor. MMB+drag the grayNoise node from the Work Area to the Color attribute of the gray shader in the Attribute Editor, as shown in Figure 7-18. This will set the gray noise texture you just made to be the color of the gray plastic material.
  4. Select the yellow Blinn shader and then MMB+drag the noiseYellow node from the Work Area to the Color attribute. This connects the yellow color to the yellow Blinn shader.
    c07f018.eps

    Figure 7-18: Connect the gray noise texture to the Color attribute of the gray Blinn shader.

  5. Now let’s assign the shaders to the parts of the plane. In the persp viewport, select the wings, body, and two pontoons and assign the yellow Blinn shader to them by RMB+clicking in the Hypershade and selecting Assign Material To Selection, as shown in Figure 7-19.
  6. Select the remaining parts of the plane and assign the gray Blinn shader to them, as shown in Figure 7-20.
    c07f019.eps

    Figure 7-19: Select these parts of the plane and assign the yellow Blinn to them.

c07f020.tif

Figure 7-20: Select the remaining parts of the plane and assign the gray Blinn shader to them.

Now let’s see what it looks like! In the persp viewport, render a view of your plane by clicking the Render Current frame icon on the Status line (c07i001.tif). Since you haven’t created any lights in the scene, Maya will use default lights and render an image (Figure 7-21) with the basic shaders you just created. Not bad. Feel free to adjust the colors or the attributes of the noise textures to your liking. Once you start lighting the scene in Chapter 10, you will adjust the shaders to make the toy plane look like better plastic. For now, you’re done! You can check your work against the scene file planeShading_v01.ma in the Scenes folder of the Plane project.

You can embellish a model a lot at the texturing level. The more you explore and experience shaders and modeling, the better you’ll be at juggling modeling with texturing to get the most effective solution. For example, you can use more elaborate noise patterns to mimic the flakes in the plane’s plastic, as opposed to using the simple pattern you created with a noise texture. That is a more involved workflow, which you will tackle later in this chapter with UVs and texture maps.

You’ll begin UV layout and texturing a child’s red wagon later in this chapter and then go into more detailed texturing with the decorative box, which you’ll then light and render in mental ray. For even more practice, try loading the catapult model from Chapter 4, “Beginning Polygonal Modeling,” and texturing it from top to bottom.

c07f021.tif

Figure 7-21: The plane renders with yellow and gray Blinn shaders to look a little like plastic.

Textures and Surfaces

Texture nodes generate maps to connect to an attribute of a shader. There are two types of textures: procedural and bitmapped (sometimes called maps). Procedural textures use Maya attributes to generate an effect, such as a ramp gradient, checkerboard, or fractal noise texture. You can adjust each of these procedural textures by changing their attribute values.

A map, on the other hand, is a saved image file that is imported into the scene through a file texture node. These files are pregenerated through whatever imaging programs you have and include digital pictures and scanned photos. You need to place all texture nodes onto their surfaces through the shader. You can map them directly onto the UV values of the surface or project them.

UV Mapping

UV mapping places the texture directly on the surface and uses the surface coordinates (called UVs) for its positioning. In this case, you must do a lot of work to line up the UVs on the surface to make sure the created images line up properly. What follows is a brief summary of how UV mapping works. You’ll get hands-on experience with UV layout with the red wagon and decorative box exercises later in this chapter.

Just as 3D space is based on coordinates in XYZ, surfaces have coordinates denoted by U and V values along a 2D coordinate system for width and height. The UV value helps a texture position itself on the surface. The U and V values range from 0 to 1, with (0,0) UV being the origin point of the surface.

Maya creates UVs for primitive surfaces automatically, but frequently you need to edit UVs for proper texture placement, particularly on polygonal meshes after you’ve edited them. In some instances, placing textures on a poly mesh requires projecting the textures onto the mesh because the poly UVs may not line up as expected after the mesh has been edited. See the next section, “Using Projections.”

If the placement of your texture or image isn’t quite right, simply use the 2D placement node of the texture node to position it properly. See the section “Texture Nodes” later in this chapter for more information.

Using Projections

You need to place textures on the surface. You can often do so using UV placement, but some textures need to be projected onto the surface. A projection is what it sounds like. The file image, ramp, or other texture being used can be beamed onto the object in several ways.

You can create any texture node as either a normal UV map or a projected texture. In the Create Render Node window, clicking a texture icon creates it as a normal mapped texture. To create the texture as a projection, you must RMB+click the icon and select Create As Projection (see Figure 7-22).

c07f022.tif

Figure 7-22: Selecting the type of map layout

When you create a projected texture, a new node is attached to the texture node. This projection node controls the method of projection with an attached 3D placement node, which you saw in the axe exercise. Select the projection node to set the type of projection in the Property Editor or the Attribute Editor (see Figure 7-23).

Setting the projection type will allow you to project an image or a texture without having it warp and distort, depending on the model you’re mapping. For example, a planar projection on a sphere will warp the edges of the image as they stretch into infinity on the sides of the sphere.

  1. Try This In a new scene, create a NURBS sphere and a NURBS cone and place them side-by-side. Create a Blinn shader and assign it to both objects. In the Blinn shader’s Attribute Editor, set its Color attribute to a checkerboard pattern, as shown in Figure 7-24.

Now, try removing the color map from the Blinn shader you just made. In the Blinn shader’s Attribute Editor, RMB+click on the word Color; then choose Break Connection from the context menu. Doing so severs the connection to the checker texture map node and resets the color to gray. Now, re-create a new checker texture map for the color, but this time create it as a projection by RMB+clicking the Checker texture icon in the Create Render Node window. In the illustration on the left in Figure 7-25, you see the perspective view in Texture mode (press the 6 key) with the two objects and the planar projection placement node.

c07f023.tif

Figure 7-23: The projection node in the Hypershade’s Property Editor as well as the Attribute Editor

c07f024.tif

Figure 7-24: Assign a checkerboard pattern to the sphere and cone with Normal checked.

c07f025.tif

Figure 7-25: A planar projection checkerboard in the viewport (left) and rendered (right)

Try moving the planar placement object around in the scene to see how the texture maps itself to the objects. The illustration on the right of Figure 7-25 shows the rendered objects.

Try the other projection types to see how they affect the texture being mapped.

Projection placement nodes control how the projection maps its image or texture onto the surface. Using a sphere with a spherical projected checker, with U and V wrap turned off on the checkerboard texture, you can see how manipulating the place3dTexture node affects the texture.

In addition to the Move, Rotate, and Scale tools, you can use the special manipulator (press T to activate or click the Show Manipulator Tool icon in the toolbar) to adjust the placement as you watch it update on your object. However, your viewport may not display a projected map properly, so in your viewport, choose Renderer and select Legacy High Quality Viewport, as shown in Figure 7-26, where you will see the special manipulator for the Spherical projection as well.

c07f026.tif

Figure 7-26: The spherical projection’s manipulator tool

c07f027.tif

Figure 7-27: The manipulator wrapping the checkerboard texture around the sphere (left of image, perspective view; right of image, rendered view)

Drag the handles on the special manipulator to change the coverage of the projection, orientation, size, and so forth. All projection types have special manipulators. Figure 7-27 shows the manipulator wrapping the checkerboard pattern in a thin band all the way around the sphere (shown in Legacy High Quality Viewport as shown in Figure 7-26).

To summarize, projection textures depend on a projector node to position the texture onto the geometry. If the object assigned to a projected texture is moving, consider grouping the projection placement node to the object itself in the Outliner.

Texture Nodes

c07f028.tif

Figure 7-28: Some common attributes for all texture nodes

You can create a number of texture nodes in Maya. This section covers the most important. All texture nodes, however, have common attributes that affect their final look. In the Hypershade, click to create any node from the 2D Textures section in the Create panel (in this case, a checker) and take a look at its attributes in the Hypershade’s Property Editor (see Figure 7-28). The Color Balance and Effects headings affect the color of the texture (as you saw with the noise textures from the plane exercise).

  1. Color Balance This set of attributes adjusts the overall brightness and color balance of your texture. Use these attributes to tint or brighten a texture without having to change all the individual attributes of the shader.
  2. Effects You can invert the texture’s color space by clicking the Invert check box. This changes black to white and white to black in addition to inverting the RGB values of colors.

You can map textures to almost any shader attribute for detail. Even the tiniest amount of texture on a surface’s bump, specular, or color increases its realism.

Place2dTexture Nodes

The 2D texture nodes come with a 2D placement node that controls their repetition, rotation, size, offset, and so on. You can immediately access this node in the Attribute Editor by clicking its tab, or in the Hypershade, select the texture node from the Textures tab (in this case a checker) and click the Input And Output Connections icon in the Hypershade. Then click the place2dTexture node and examine its attributes in the Property Editor. Adjust the setting in this node of your 2D texture in the Attribute Editor, or Property Editor as shown in Figure 7-29, to position it within the Shader network.

The Repeat UV setting controls how many times the texture is repeated on whatever shader attribute it’s connected to, such as Color. The higher the wrap values, the smaller the texture appears, but the more times it appears on the surface.

The Wrap U and Wrap V check boxes allow the texture to wrap around the edges of their limits to repeat. When these check boxes are turned off, the texture appears only once, and the rest of the surface is the color of the Default Color attribute found in the texture node.

c07f029.tif

Figure 7-29: A 2D placement node in the Hypershade Property Editor (while in default Lookdev view mode, with the Material Viewer showing the checker pattern)

The Mirror U and Mirror V settings allow the texture to mirror itself when it repeats. The Coverage, Translate Frame, and Rotate Frame settings control where the image is mapped. They’re useful for positioning a digital image or a scanned picture.

Ramp Texture

A ramp is a gradient in which one color transitions into the next color. A ramp is useful for many things, but mostly it’s perfect for making color gradients. Initially the ramp texture will show as a simple black-to-white gradient (from left to right), as shown in Figure 7-30.

c07f030.tif

Figure 7-30: The ramp texture in the Property Editor

But it’s easy to create gradients using any colors. Simply use the round handles on top of the ramp to select that color and to move it left and right on the ramp. The square handle at the bottom deletes the color. To create a new color, click inside the ramp. Figure 7-31 shows a multicolored ramp. Clicking the right arrow button to the right of the ramp shown in Figure 7-31 will open a larger ramp window to work with if you need extra precision. Note that Figure 7-31 is from the Attribute Editor and not the Hypershade Property Editor.

c07f031.tif

Figure 7-31: Adding and changing colors in a ramp is easy!

The Type setting allows you to create a gradient running along the U or V direction of the surface, as well as to make circular, radial, diagonal, and other types of gradients. The Interpolation setting controls how the colors grade from one to the next. Experiment with them to see how they work.

The U Wave and V Wave attributes let you add a squiggle to the U or V coordinate of the ramp, and the Noise and Noise Freq (frequency) attributes specify randomness for the placement of the ramp colors throughout the surface.

Using the HSV Color Noise attributes, you can specify random noise patterns of hue, saturation, and value to add some interest to your texture. The HSV Color Noise options are great for making your shader just a bit different to enhance its look.

Fractal, Noise, and Mountain Textures

The Fractal, Noise, and Mountain textures are used to create a random noise pattern to add to an object’s color, transparency, or any other shader attribute. For example, when creating a surface, you’ll almost always want to add a little dirt or a few surface blemishes to the shader to make the object look less CG. These textures are commonly used for creating bump maps.

Bulge, Cloth, Checker, Grid, and Water Textures

The Bulge, Cloth, Checker, Grid, and Water textures help create surface features when used on a shader’s Bump Mapping attribute. Each creates an interesting pattern to add to a surface to create tactile detail, but you can also use them to create color or specular irregularities.

When used as a texture for a bump, Grid is useful for creating the spacing between tiles, Cloth is perfect for clothing, and Checker is good for rubber grips. Placing a Water texture on a slight reflection makes for a nice poolside reflection in patio furniture.

The File Node

You use the file node to import image files into Maya for texturing. For instance, if you want to texture a CG face with a digital picture of your own face, you can use the file node to import a Maya-supported image file.

Importing an Image File as a Texture

To attach an image to the Color attribute of a Lambert shader, for example, follow these steps:

c07f032.tif

Figure 7-32: The file texture node

  1. Create a Lambert shader in the Hypershade. (Phong, Blinn, or any of the shaders will do.)
  2. Click the Map button (c07i002.tif) next to the Color attribute of the new Lambert shader to map a texture to it. RMB+click the File button in the Create Render Node window that pops up and select Create Texture. The Attribute Editor shows the attributes for the file node (with an image already loaded); see Figure 7-32.
  3. Next to the Image Name attribute, click the Folder icon to open the file browser to select an image. Find the image file of choice on your computer. (It’s best to put images to use as textures in the project’s Sourceimages folder. As a matter of fact, the file browser defaults directly to the Sourceimages folder of your current project.) Double-click the file to load it.
  4. After you import the image file, it connects to the Color attribute of that shader and also automatically connects the alpha to transparency if there is an alpha channel in the image. You can position it as you please by using its place2dTexture node or by manipulating the projection node if you created the file texture node as a projection.

You can attach an image file to any attribute of a shader that is mappable, meaning it’s able to accept a texture node. Frequently, image files are used for the color of a shader as well as for bump and transparency maps. You can replace the image file by double-clicking the file texture node in the Hypershade and choosing another image file with the file browser.

Using Photoshop Files: The PSD File Node

Maya can also use Adobe Photoshop PSD files as image files in creating shading networks. The advantage of using PSD files is that you can specify the layers within the Photoshop file for different attributes of the shader, as opposed to importing several image files to map onto each shader attribute separately. This, of course, requires a modest knowledge of Photoshop and some experience with Maya shading. As you learn how to shade with Maya, you’ll come to appreciate the enhancements inherent in using Photoshop networks.

  1. Try This You’ll create a single Photoshop file that will shade this sphere with color as well as transparency and a bump. Again, you’re doing this instead of creating three different image files (such as TIFFs) for each of those shading attributes.
  1. Create a poly sphere in a new scene and assign a new Lambert shader to it through the Hypershade. This creates a new shader and assigns it to the selection, in this case your sphere.
  2. Select the sphere and in the Rendering menu set (F6), choose Texturing ⇒ Create PSD Network. In the option box that opens, select Color, Transparency, and Bump from the list of attributes on the left side and click the right arrow to move them to the Selected Attributes list on the right, as shown in Figure 7-33.
  3. Select a location and filename for the PSD image’s location. By default, Maya places the PSD file it generates in the Sourceimages folder of your current project, named after the surface to which it applies. Click Create.
  4. In Photoshop, open the newly created PSD file. You see three layers grouped under three folders named after the shader attributes you selected when creating the PSD file. There are folders for lambert2.bump, lambert2.transparency, and lambert2.color, as well as a layer called UVSnapShot.

    The UVSnapShot layer gives you a wireframe layout of the UVs on the sphere as a guideline to paint your textures. Because the sphere is an easy model, you don’t need this layer, so turn it off. You’ll use UV SnapShot later in this chapter when texturing a toy wagon.

    c07f033.tif

    Figure 7-33: The Create PSD Network Options window

    You can now paint whatever image you want into each of the layers to create maps for each of the shader attributes, all in one convenient file. Save the PSD file. You can save over it or create a new filename for the painted file.

  5. In Maya, open the Hypershade, and open the Attribute Editor for the Lambert shader assigned to the sphere (in this case, Lambert2). If you graph the connections to the Lambert shader in the Hypershade window’s work panel, you see that the PSD file you generated is already connected to the Color, Bump, and Transparency attributes of the shader, with the proper layering set for you, as shown in Figure 7-34. Note however, the icons for the PSD layers (Color, Bump, and Transparency) all display the topmost layer of the PSD, in this case the Bump. This is normal, however irritating.
  6. Open the file nodes for the shader and replace the PSD file with your new painted PSD file. If you saved your PSD file with the same name, all you need to do is click the Reload button to update the psdFile node.
    c07f034.tif

    Figure 7-34: The PSD network for the Lambert shader in the Hypershade shows the connections to Color, Bump, and Transparency. The image inset (upper right) shows the sphere with the different PSD layers applied appropriately in Maya’s viewport 2.0.

If you decide you need to add another attribute to the PSD file’s layering or if you need to remove an attribute, you can edit the PSD network. Select the shader in the Hypershade and choose Edit ⇒ Edit PSD Network. In the option box, select new attributes to assign to the PSD file or remove existing attributes and their corresponding Photoshop layer groups. When you click Apply or Edit, Maya saves over the PSD file with the new layout.

3D and Environment Textures

3D textures are projected within a 3D space. These textures are great for objects that need to reflect an environment, for example.

Instead of simply applying the texture to the plane of the surface as 2D textures do, 3D textures create an area in which the shader is affected. As an object moves through a scene with a 3D placement node, its shader looks as if it swims, unless that placement node is parented or constrained to that object. (For more on constraints, see Chapter 9, “More Animation!”)

Disconnecting a Texture

Sometimes, the texture you’ve applied to an object isn’t what you want, and you need to remove it from the shader. To do so, double-click the shader in the Hypershade to open its Attribute Editor.

You can then disconnect an image file or any other texture node from the shader’s attribute by RMB+clicking the attribute’s name in the Attribute Editor and choosing Break Connection from the context menu, as shown in Figure 7-35.

c07f035.tif

Figure 7-35: RMB+clicking a shader’s attribute allows you to disconnect a texture node from the shader.

Textures and UVs for the Red Wagon

Now you’ll assign shaders to a child’s red wagon toy model. Figure 7-36 shows the real wagon. If you are reading a digital copy of this book, you can see the colors in Figure 7-36 easily. Otherwise, you can download the ColorWagon.tif photo from the book’s website. The wagon is fairly simple; it will need a few colored shaders (Red, Black, Blue, and White) for the body, along with a few texture maps for the decals—which is where the real fun begins. The wagon will also require some more intricate work on the shaders and textures for the wood railings and silver metal screws, bolts, and handlebar; these will be a good foray into image maps and UVs.

c07f036.tif

Figure 7-36: The red wagon and its named parts

Assigning Shaders

Load the file RedWagonModel.ma from the Scenes folder of the RedWagon project to begin shading the model of the wagon.

Study the color images of the wagon and see how light reflects off its plastic, metal, and wood surfaces. Blinn shaders will be perfect for nearly all the parts of the wagon. Follow these steps:

  1. Open the Hypershade window and create four Blinn shaders.
  2. Assign the following HSV values to the Color attribute of each Blinn shader and name them as shown in Table 7-2 and in Figure 7-37. You’ll create the Chrome Metal and Wood shaders later.

    Table 7-2: HSV color values for the wagon’s colors

    Wagon colorShader nameH valueS valueV value
    RedRed3550.9100.650
    BlackBlack000
    WhiteWhite001
    BlueBlue2200.7750.560
    c07f037.tif

    Figure 7-37: Create the four colored Blinn shaders.

Initial Assignments

Look at the color image of the wagon from the book’s web page (or in the e-edition of the book). The bullnose and tires are black, the wheel rims are white, the floor is blue, the screws and bolts and handlebar are chrome metal, the railings are wood, and the main body is red. Assign shaders to the wagon according to the color photo and the following steps:

  1. In the viewport, select the side panels (the A and B panels, without the screws and bolts) and the wheel rim caps, as shown in Figure 7-38, and assign the Red Blinn shader to them. Press 6 to enter Texture Display mode.
  2. Select the wheelMesh objects for all four wheels and assign them the White shader. The tires also turn white, but you’ll fix that shortly; don’t worry about it now. See Figure 7-39.
  3. Select the bullnose (the rounded cylinder in front of the wagon) and assign it the Black Blinn.
  4. Select the wagonFloor object and assign it the Red shader, as shown in Figure 7-40. You’ll notice that the front and back bodies of the wagon turn red like they’re supposed to, but so does the floor of the wagon, which should be blue according to the photo. If you try to assign the Blue shader to the wagon floor mesh, the floor will be correct, but the front and back of the wagon will be blue and not red. You’ll fix this later.
c07f038.tif

Figure 7-38: Assign the Red shader.

c07f039.tif

Figure 7-39: Assign the White shader.

c07f040.tif

Figure 7-40: Assign the Red shader to the wagon floor just for now; you’ll change it to blue later.

Now you have initial assignments for the basic colors of the wagon’s body. Let’s tweak these shaders’ colors next.

c07f041.tif

Figure 7-41: The tire on the wagon

Creating a Shading Network for the Wheels

Refer to Figure 7-41 to observe how the materials are different for the rim and the tire of the wheel. The rim is glossier and has a tighter, sharper specular, whereas the tire has a diffuse specular and is quite bumpy. You’ll create a Layered shader for the wheels with white feeding into the rim portion and black into the tire portion.

Coloring the Wheel

First you need to determine where the white ends and the black starts on the surface of the wheel mesh.

  1. Select the White shader in the Hypershade window. Click the Map icon (c07i002.tif) next to the Color attribute. RMB+click the Ramp Texture icon and select Create Texture. The wheel’s color turns to a black-to-white gradient clockwise around the wheel, which is the wrong direction; you need the gradient to run from the center to the edge. In the ramp texture’s Property Editor, set Type to U Ramp, as shown in Figure 7-42.
c07f042.tif

Figure 7-42: Set the ramp to a U Ramp type.

  1. Now the gradient is running black from the center to light gray on the outside edge through to white on the reverse side of the wheel. Select the round handle for the black color and change Selected Color to white. Then select the round white handle on the right side of the ramp and change Selected Color to black.
  2. Click in the middle of the ramp to create a new color, which will be gray. Set that color to black. Move that new black handle in the ramp until its Selected Position value is about 0.6, as shown in Figure 7-43. Note that I am using the Attribute Editor to adjust the ramp in this figure, though you can use the Property Editor as well.
c07f043.tif

Figure 7-43: Move the new black handle.

  1. Set the Interpolation attribute (found above the ramp color) to None so you get clean transitions from white to black, instead of a soft linear gradient where the black slowly grades to white. Name this ramp wheelPositionRamp.
  2. The backs of the wheels are solid black. In the wheelPositionRamp, move the round handle for the black color all the way at the right of the ramp and set that color to white; set its position to about 0.920 to place white behind the wheels, keeping the black only where the tire is. See Figure 7-44.

    Now that you’ve pinpointed where the white rim ends and the black tire begins, you’ll use this ramp as a transparency texture to place the Tire shader on top of the Rim shader in a Layered shader that you’ll create later. This will allow you to have two different materials on your tire, a smooth white plastic and a rough black plastic.

    c07f044.tif

    Figure 7-44: Setting the tire location using a ramp

  3. You don’t need this Ramp shader on the color of the shader anymore—you did this so you could easily see the ramp positions on the wheel in the viewports. In the Hypershade, select the White shader and click the Input And Output Connections icon (c07i003.tif) to graph the shader in the work area, as shown in Figure 7-45.
c07f045.tif

Figure 7-45: The White shader has the ramp attached as color.

  1. In the Property Editor, RMB+click the Color attribute and select Break Connection from the context menu to disconnect the ramp from the color. Set the Color back to white. Notice that the rubber band link connecting the ramp texture node to the White shader node disappears in the Hypershade window.
  2. Create a Layered shader. MMB+drag the White shader from the Hypershade to the top of the Layered Shader Attributes window, as shown in Figure 7-46. Delete the default Green shader in the Attribute Editor by clicking the checked box below its swatch.
c07f046.tif

Figure 7-46: Drag the White shader to the Layered shader and delete the default Green shader from it.

  1. Create a new Blinn shader and set its color to black. Name the shader tireShader. Select the Layered shader and then MMB+drag the new tireShader from the Hypershade to the Layered shader’s Attribute Editor (or Property Editor in the Hypershade) and then place it to the left of the White shader, as shown in Figure 7-47. Name the Layered shader wheelShader.
c07f047.tif

Figure 7-47: MMB drag the black tireShader material to the Layered Shader.

  1. Select the wheels and assign the wheelShader Layered shader to them. The wheels should appear all white (yours may turn all black). This is where the ramp you created earlier (wheelPositionRamp) will come into play in the next steps.
  2. Select the wheelShader and click Input And Output Connections to graph the network in the Work Area of the Hypershade window. In the top panel of the Hypershade, click the Texture tab to display the texture nodes in the scene so you can see wheelPositionRamp’s node.
  3. In the wheelShader’s Attribute Editor, click the tireShader swatch on the left. MMB+drag the wheelPositionRamp node to the Transparency attribute, as shown in Figure 7-48.
    c07f048.eps

    Figure 7-48: Attach the ramp to the Transparency attribute of the tireShader in the wheelShader.

  4. When you attach the ramp, the wheelShader icon turns white on top and black on the bottom. Render a frame in the persp viewport to make sure the black tires line up properly, as shown in Figure 7-49. The wheel coloring is complete!
c07f049.tif

Figure 7-49: The tires are done!

Setting the Feel for the Materials and Adding a Bump Map

Because the material look and feel on the real wheels differs quite a bit between the rim and the tire, you’ll further tweak the white rim and the black tire shaders. The rim is a smooth, glossy white, and the tire is a bumpy black with a broad specular. Follow these steps:

  1. Let’s set up a good angle of view for your test renders. Position your persp viewport to resemble the view in Figure 7-50. Render a frame.
c07f050.tif

Figure 7-50: Set your view to this angle and render a frame.

  1. Select the White shader and set Eccentricity to 0.05 and Specular Roll Off to 0.5. Doing so sharpens the specular highlight on the rim.
  2. Select the black tireShader and set Eccentricity to 0.375 and Specular Roll Off to 0.6 to make the highlight more diffuse across the tire. Set Reflectivity to 0.05. Render a frame; refer to Figure 7-51 to see how the specular highlight is broader and less glossy than in Figure 7-50.
c07f051.tif

Figure 7-51: Setting specular levels

  1. Open the Attribute Editor for the tireShader and click the Map icon (c07i002.tif) in the Bump Mapping section. In the Create Render Node window, click to create a fractal texture map. Notice that the entire wheelShader icon becomes bumpy. Render a frame, and you’ll see that the entire wheel is bumpy—not just the tire. (See Figure 7-52.) Argh!
  2. You have to use the wheelPositionRamp to prevent the bump from showing on the white rim. Select the wheelShader and click the Input And Output Connections icon (c07i003.tif) in the Hypershade to graph its network (Figure 7-53).
c07f052.tif

Figure 7-52: The whole wheel becomes bumpy!

c07f053.tif

Figure 7-53: Graph the wheelShader network.

  1. Select the fractal to display it in the Attribute Editor and MMB+drag the wheelPositionRamp from the Hypershade to the Alpha Gain attribute for the fractal, as shown in Figure 7-54.
    c07f054.eps

    Figure 7-54: MMB+drag the ramp to the Alpha Gain attribute of the fractal.

  2. Render a frame, and you see that now the tire has no bump and the rim is bumpy (Figure 7-55).
c07f055.tif

Figure 7-55: The tire is smooth, and now the rim is bumpy.

  1. This is easy enough to fix. All you need to do is reverse the ramp and then feed that reversal into the Alpha Gain attribute of the fractal so that the tire is bumpy and the rim is smooth. In the Hypershade, in the Create pane on the left, click the Maya ⇒ Utilities heading and then click the Reverse icon to create a reverse node in the Hypershade window’s Utilities tab. See Figure 7-56. MMB+drag this new Reverse node from the top of the Hypershade (in the Utilities tab) down to the work area.
c07f056.tif

Figure 7-56: Create a reverse node.

  1. In the Hypershade, click+drag the OutColor socket of the wheelPositionRamp node onto the Input socket of the Reverse node and release the mouse button. This connects the output of the ramp into the reverse node, which will then reverse the effect of the ramp on the fractal when you connect it in the next step. Figure 7-57 (left).
    c07f057.eps

    Figure 7-57: First connect the ramp to the Reverse node (top image). Then connect the Reverse node to the Fractal node (bottom image).

  2. On the fractal1 node’s upper right, click the node display size icon (c07i004.tif) until the three slots are filled white (c07i005.tif). This expands the fractal1 icon to display more input and output sockets. In the upper-right corner of the reverse1 node, click the plus symbol next to Output (c07i006.tif) to display Output X, Output Y, and Output Z sockets as shown in Figure 7-57 (right).
  3. Drag the Output X socket from the reverse1 node to the Alpha Gain input socket on the fractal1 node.
  4. Open the Render Settings window by choosing Windows ⇒ Rendering Editors ⇒ Render Settings (or click the Render Settings icon [c07i007.tif] in the status bar at the top of the UI). Click the Maya Software tab and set Quality to Production Quality in the pull-down menu. (See Figure 7-58.) Render a frame; you finally have a bump on the tire and a smooth rim. See Figure 7-59.
  5. It’s not a convincing bump yet, so select the fractal node and set Ratio to 0.85. In the Hypershade, click the Placement node icon for the fractal (it should be called something like place2dTexture6), and in the Property Editor, set the Repeat UV values to 18 and 48, as shown in Figure 7-60. Doing so makes the fractal pattern finely speckled on the tire.
  6. Render a frame; the fractal’s scale on the bumpy tire looks too strong. Double-click the bump2d node in the Hypershade, and in the Property Editor, set Bump Depth to 0.04. Render and check your frame against Figure 7-61. The bump looks much better, if not a little strong from this angle; you can finesse it to taste from here.
c07f058.tif

Figure 7-58: Set Quality to Production Quality.

c07f059.tif

Figure 7-59: Now you have the bump where you need it.

c07f060.tif

Figure 7-60: Set the Repeat UV values for the fractal map.

c07f061.tif

Figure 7-61: The wheel looks pretty good.

Tire Summary

Congratulations! You’ve made your first somewhat complex shading network, as shown in Figure 7-62. By now, you should have a pretty good idea of how to get around the Hypershade and create shading networks. To recap, you’re using a ramp to place the two different (Tire and Rim) shaders on the wheel, as well as using it to place the bump map on just the tire part by using a reverse node. The more times you make shading networks, the easier they will become to create.

c07f062.tif

Figure 7-62: Your first complex shading network

This type of shading is called procedural shading because you used nothing but stock Maya texture nodes to accomplish what you needed for the wheels. In the following sections, you’ll make good use of image mapping to create the decals for the wagon body as well as the wood for the railings.

You can load the file RedWagonTexture_v01.ma from the Scenes folder of the RedWagon project to check your work or skip to this point.

c07f063.tif

Figure 7-63: You need to add the body decals.

Putting Decals on the Body

Figure 7-63 shows you the decals that need to go onto the body of the wagon. They include the wagon’s logo, which you’ll replace with your own graphic design, and the white stripe that lines the side panels.

Instead of trying to make a procedural texture as you did with the wheel, you’ll create an image map that will texture the side panels’ white stripe. The stripe is far too difficult to create otherwise. You’ll create an image file using Photoshop (or another image editor) to make sure the white stripe (and later the red wagon logo) lines up correctly.

Working with UVs

Mapping polygons can involve the task of defining UV coordinates for them so that you can more easily paint an image map for the mesh. When you create a NURBS surface, UV coordinates are inherent to the surface. At the origin (or the beginning) of the surface, the UV coordinate is (0,0). When the surface extends all the way to the left and all the way up, the UV coordinate is (1,1). When you paint an 800×600-pixel image in Photoshop, for example, it’s safe to assume that the first pixel of the image (at X = 0 and Y = 0 in Photoshop) will map directly to the UV coordinate (0,0) on the NURBS surface, whereas the top-right pixel in the image will map to the UV (1,1) of the surface. Toward that end, mapping an image to a NURBS surface is fairly straightforward. The bottom of the image will map to the bottom of the surface, the top to the top, and so on. Figure 7-64 shows how an image is mapped onto a NURBS plane and a NURBS sphere.

c07f064.tif

Figure 7-64: An image file is mapped to a NURBS plane and a NURBS sphere. Notice the locations marked in the image and how they map to the locations on the surface, with the pixel coordinates directly corresponding to the surface’s UV coordinates.

The locations in the image, marked by text, correspond to the positions on the NURBS plane. The sphere, because it’s a surface bent around spherically, shows that the origin of the UV coordinates is at the sphere’s pole on the left and that the image wraps itself around it (bowing out in the middle) to meet at the seam along the front edge as shown.

When you’re creating polygons, however, this isn’t always the case. You must sometimes create your own UV coordinates on a polygonal surface to get a clean layout on which to paint in Photoshop. Although poly UV mapping becomes fairly involved and complicated, it’s a concept that is important to grasp early. When poly models are created, they have UV coordinates; however, these coordinates may not be laid out in the best way for texture-image manipulation.

Working with the A Panels

Let’s look at how the UVs are laid out for the A panel of the wagon model. Use Figure 7-36 earlier in the chapter to remind yourself where the A panel is.

  1. Using the scene file RedWagonTexture_v01.ma from the Scenes folder of the RedWagon project, select the A panel on one side of the wagon and choose Windows ⇒ UV Editor, as shown in Figure 7-65.
    c07f065.tif

    Figure 7-65: The A panel in the UV Editor

    The UV Editor works almost like any other viewport. You may navigate the window and zoom in and out using the familiar Alt+mouse button combinations.

  2. RMB+click any part of the wireframe layout in the UV Editor window and select UV to enter the UV selection. Select the entire wireframe mesh at the lower right, as shown in Figure 7-66. Notice that green points are selected—almost as if they were vertices. These are UV points, and they’re what define the UV coordinates on that part of the mesh. Look in the perspective viewport; the entire front face of the A panel is selected as well as the green UV points.
    c07f066.tif

    Figure 7-66: Select the UVs on this part of the A panel mesh.

    Feel free to select parts of the UV layout in the UV Editor to see what corresponding points appear on the mesh in the persp viewport. This will help orient you as to how the UV layout works on this mesh.

  3. You need to again lay out just this area of the mesh’s UVs. Because you already have the entire front side of the panel selected in UVs, let’s convert that selection to poly faces on the model. In the Modeling menu set and in the Maya main menu bar, choose Select ⇒ Convert Selection ⇒ To Faces. The front faces of the A panel mesh are now selected, as shown in Figure 7-67. You can always manually select just the front faces of the mesh, but this conversion method is much faster. The UV Editor shows just those faces now.
    c07f067.tif

    Figure 7-67: Convert the UVs you just selected to a face selection. This method easily isolates the front faces of the A panel for you to lay out their UVs again.

  4. With those faces selected, make sure you’re in the Modeling menu set. In the main menu bar, choose UV ⇒ Planar ❏ from the Create section of the UV menu. In the option box, set the Project From option to X Axis, check the Keep Image Width/Height Ratio option, and then click Project. (See Figure 7-68.) The UV Editor shows the front A panel face.
  5. Now the front face has a much simpler UV layout from which to paint. However, it’s centered in the UV Editor and will overlap the other UVs of the same mesh. You should move and size it to fit into its original corner, more or less, to make sure no UVs double up on each other. First, double-click the Move tool icon to open its options and make sure that Symmetry is turned off. If Symmetry is enabled for the Move tool, this and the following steps will not work for you.
    c07f068.tif

    Figure 7-68: Create a planar projection for the UV layout.

  6. In the UV Editor, RMB+click the wireframe and select Shell to enter Shell selection. Move your cursor over the new UV shape you just created of the A panel, and the wireframe “shell” appears green in the UV Editor. See Figure 7-69. Click to select that shape, and it turns orange when you move the cursor away (as if it has selected the faces, which is perfect).
  7. Press W for the Move tool and move the selected UV shell to the side of the UV Editor. Press R for the Scale tool and scale the shell down a bit to fit into the corner, as shown in Figure 7-70.
c07f069.tif

Figure 7-69: The UV shell for the A panel, representing all of the front side’s UVs

c07f070.tif

Figure 7-70: Position these UVs to make sure they don’t overlap the rest of the A panel mesh’s UVs.

  1. Earlier in the chapter, you saw how to write out a PSD file with a UV snapshot as one of its layers. You’ll use a similar technique to paint the decal for the panel. Click an empty area of the UV Editor to deselect everything. Then, in Object Selection mode (press F8 if you need to exit Component Selection), select the A panel mesh in the persp viewport in the main Maya UI.
  2. In the UV Editor window, select Polygons ⇒ UV Snapshot to open the option box. Set both Size X and Size Y to 1024. Change the image format to TIFF, click the Browse button at the top next to the File Name field, and navigate to the RedWagon project’s Sourceimages folder on your hard drive. Name the file ApanelUV_mine.tif, and click Save. Note that the Sourceimages folder already has a ApanelUV.tif for your convenience, which is why you add “_mine” to the filename. Leave UV Range set to Normal (0 to 1), and click OK. See Figure 7-71.
c07f071.tif

Figure 7-71: Settings for the UV snapshot

Working in Photoshop

Next, you’ll go into Photoshop to paint your map according to the UV layout you just output.

  1. In your OS file browser, navigate to the RedWagon project’s Sourceimages folder and open the file ApanelUV.tif in Photoshop. Figure 7-72 shows the layout of the UVs that you’ll use to create the white stripe for the front of the A panel.
    c07f072.tif

    Figure 7-72: Using a UV snapshot makes working with the UV layout for the A panel easy.

  2. In Photoshop, create a new layer on top of the background layer that is the UV layout (white on black, as shown). Using the Paint Bucket tool, fill that new layer with the same red you used on the shader in your scene. To do so, click the foreground color swatch in Photoshop and set H to 355, S to 91 percent, and B to 65 percent, as shown in Figure 7-73. Click OK.
c07f073.tif

Figure 7-73: In Photoshop’s Color Picker, create the same red you used for the wagon.

  1. Using the Paint Bucket tool, click to fill the entire image with the red you just created. The trouble is that now you can’t see the UV layout. Set the Opacity value of the red layer in Photoshop to 50 percent, as shown in Figure 7-74.
c07f074.tif

Figure 7-74: Set the opacity for the red layer in Photoshop so you can see the UV layout on the layer below.

  1. Set Photoshop’s foreground color to white. Using the Line and Brush tools set to a width of about 6 pixels, draw a stripe following the UV layout lines, as shown in Figure 7-75. Doing so places that white stripe along the A panel’s outer edge because the UV lines you’re following correspond to that area of the mesh. The rest will be left red.
  2. You may have drawn directly on the red layer in Photoshop or created a new layer for the stripe. In either case, set the Opacity value of the red layer back to 100 percent so you can no longer see the UV layout. Your image file should look like the one in Figure 7-76. Save the image as ApanelStripeMine.tif in the Sourceimages folder of your RedWagon project. You can keep the layers in the TIFF file, or you can choose to flatten the image or merge the layers. It may be best to keep the stripe and red on separate layers so that you can go back into Photoshop and edit the stripe as needed.
c07f075.tif

Figure 7-75: Follow the UV lines to draw the white stripe.

c07f076.tif

Figure 7-76: The striped image file

Creating and Assigning the Shader

Now, let’s create the shader and get it assigned to the geometry.

  1. In Maya, open the Hypershade and select the Red shader. Duplicate it by choosing Edit ⇒ Duplicate ⇒ Shading Network in the Hypershade window, as shown in Figure 7-77.
    c07f077.eps

    Figure 7-77: Duplicate the original Red shader.

    c07f078.tif

    Figure 7-78: Select ApanelStripe.tif or your own ApanelStripeMine.tif file.

  2. Rename the newly duplicated shader (currently called red1) to ApanelStripe. In the Property Editor, click the Map icon (c07i002.tif) next to Color and choose File. In the Attribute Editor, click the Folder icon next to the Image Name field. Navigate to your Sourceimages folder and select ApanelStripeMine.tif (or use the one provided instead—ApanelStripe.tif), as shown in Figure 7-78.
  3. In the Hypershade, you may see that the Shader icon may turn somewhat transparent. Maya may automatically map the Transparency attribute of the shader as well as the color since you are using a TIFF (which may contain an alpha channel). In the Property Editor, RMB+click Transparency, and select Break Connection from the context window if there is a connection. Now your shader is set to the same red you used earlier, but now it gives you a stripe along the side A panel.
  4. Assign the ApanelStripe shader to the A panel mesh and press 6 for Texture Display mode in the persp viewport. See Figure 7-79. The stripe lines up well.
Copying UVs

You need to put the stripe on the other side’s A panel. Select the other A panel and assign the ApanelStripe shader to it. You’ll notice that no stripe appears. (See Figure 7-80.) This is because the UV layout for this A panel hasn’t been set up yet. Don’t worry; you don’t have to redo everything you did for the first A panel. You can essentially copy the UVs from the first A panel mesh to this one.

  1. Select the first A panel (with the stripe) and the second panel (without the stripe). In the Modeling menu set, choose Mesh ⇒ Transfer Attributes ❏. In the option box, set Sample Space to Topology, as shown in Figure 7-81, and click Transfer.
  2. The stripe appears on the inside of the back A panel, not on the outside as you need. Select that A panel and choose Modify ⇒ Center Pivot.
  3. In the Channel Box, enter a value of –1.0 for Scale X. The stripe flips to the correct side, as shown in Figure 7-82.
  4. With that A panel still selected, choose Modify ⇒ Freeze Transformations.

You can load the file RedWagonTexture_v02.ma from the Scenes folder of the RedWagon project to check your work or skip to this point.

c07f079.tif

Figure 7-79: The stripe

c07f080.tif

Figure 7-80: Assign the ApanelStripe shader to the other side’s A panel.

c07f081.tif

Figure 7-81: The Transfer Attributes settings

c07f082.tif

Figure 7-82: The stripe is on the correct side now.

Working with the B Panels

With the A panels done, you’ll move on to the B panels (Figure 7-36 earlier in the chapter) and use much the same methodology you did with the A panels. To begin, follow these steps:

  1. Select one of the B panels, shown in Figure 7-83, and open the UV Editor window.
c07f083.tif

Figure 7-83: Starting on the B panels

  1. The B panel does not have a convenient shell like you had with the A panel before. For the B panel, select the UVs on the lower-right side of the layout in the UV Editor, as shown in Figure 7-84, to isolate the front face of the B panel.
    c07f084.eps

    Figure 7-84: Select the front face UVs for the B panel.

  2. In the UV Editor, choose Select ⇒ Convert Selection To Faces. You’ve isolated the front face of the B panel.
  3. Choose UV ⇒ Planar ❏. In the option box, set the Project From option to X Axis, and make sure the Keep Image Width/Height Ratio option is checked, just as before. Your B panel shows up nicely laid out in the UV Editor. See Figure 7-85.
    c07f085.tif

    Figure 7-85: The planar projection creates a nice UV layout for the front faces of the B panel.

  4. This action has created a shell, making it easier to work with the front side of the B panel. RMB+click the wireframe in the UV Editor and choose Shell. Make sure that Symmetry is not turned on for the Move tool before proceeding. Select the B panel shell shape and use Move (W), Scale (R), and Rotate (E) to position the UV layout for that front face, as shown in Figure 7-86.
    c07f086.tif

    Figure 7-86: Put the front face UV shell on the side.

  5. Press F8, and select the B panel mesh itself in the main Maya UI. In the UV Editor, save a UV snapshot called BpanelUV.tif to the Sourceimages folder of the RedWagon project.
  6. Open the BpanelUV.tif image in Photoshop and follow the same steps as you did for the A panel to lay down a red layer and paint a stripe along the layout, as shown in Figure 7-87. It’s best to save the stripe on its own layer in Photoshop because you’ll probably need to edit and reposition the stripe to make sure it lines up with the A panel stripe after you assign the shader.
  7. Create your own logo to place in the middle of panel B and place it in the Photoshop image file, as shown in Figure 7-88. Save the image file as BpanelStripeMine.tif into the Sourceimages folder.
c07f087.tif

Figure 7-87: Create the B panel’s stripe in Photoshop using the UV snapshot.

c07f088.tif

Figure 7-88: Create the logo in Photoshop.

  1. Duplicate another Red shader and, as you did previously, assign the BpanelStripeMine.tif (or use the file provided, which is BpanelStripe.tif) as its color map. If necessary, disconnect the transparency from the shader as you did with the A panel’s shader. Name the shader BpanelStripe.
  2. Assign the BpanelStripe shader to the B panel, as shown in Figure 7-89.
c07f089.tif

Figure 7-89: The B panel has its decals.

Creating the Other B Panel Texture
c07f090.tif

Figure 7-90: Copying and flipping the UVs to the other B panel

Finally, you need to create the shader for the other side’s B panel. Assign the BpanelStripe shader to the other B panel. Nothing happens, because the UVs for the second B panel aren’t set up yet.

However, because there is a logo with text, setting up its UVs won’t be as simple as copying the UVs from the first B panel and then mirroring the mesh, as you did with the A panel with a Scale X value of –1.0. Doing so will make the logo and text read backward. First you’ll copy and flip the UVs to the other B panel.

  1. Select the first B panel with the correct texture; then select the other side’s B panel and choose Mesh ⇒ Transfer Attributes ❏. Make sure Sample Space is still set to Topology and set Flip UVs to U. Click Transfer to copy the UVs, flipping them over, as you can see in Figure 7-90.
  2. You have to go back to Photoshop and create a second BpanelStripe.tif image file with a mirrored logo. In Photoshop, create a marquee around the logo and mirror or flip the canvas horizontally. See Figure 7-91.
c07f091.tif

Figure 7-91: Flip the original image horizontally to fit the new UV layout of the second B panel.

  1. Select the logo portion of the image and flip that vertically, as shown in Figure 7-92. Save the image as BpanelStripeMine_2.tif. You may instead use the image provided—BpanelStripe_2.tif.
  2. Duplicate the BpanelStripe shader in the Hypershade by selecting the shader and choosing Edit ⇒ Duplicate ⇒ Shading Network. The copy is called BpanelStripe1.
  3. Select the newly copied BpanelStripe1 shader and graph its input and output connections (c07i003.tif) in the Hypershade. Select its file node to view it in the Property Editor. Click the Folder icon to select a new image file and then select the BpanelStripeMine_2.tif (or the provided BpanelStripe_2.tif) you just created in the Sourceimages folder. See Figure 7-93.
    c07f092.tif

    Figure 7-92: Flip the logo vertically and save the image as its own file.

    c07f093.tif

    Figure 7-93: Assign the new image file to the new BpanelStripe1 shader.

  4. The stripe and logo display on the wrong side of the B panel. Select the mesh and center its pivot.
  5. Set the Scale X attribute for the B panel to –1.0 to mirror it. The stripe and logo decals now show up on the correct side of the panel. Select the mesh and freeze its transforms. Figure 7-94 shows the wagon so far.
c07f094.tif

Figure 7-94: The wagon has decals on both sides.

Texturing the Floor

c07f095.tif

Figure 7-95: Select the floor faces.

Right now, the floor of the wagon is red, like the rest of its body. However, the real wagon has a blue floor, not red. If you select the mesh for the wagon’s floor (named wagonFloor) and assign the Blue shader you created, the whole body of the wagon turns blue, and that isn’t what you want. You need only the inside and bottom of the floor to be blue, not the front and back sides of the wagon’s body.

You’ll make a face assignment instead of dealing with UVs and image files. RMB+click the wagon floor mesh and select Face from the marking menu. Select the two faces for the floor, as shown in Figure 7-95.

With the faces selected, assign the Blue shader from the Hypershade window, and you’re finished! You have a blue floor. All that remains now are the screws, bolts, handle, and wood railings.

You can load the file RedWagonTexture_v03.ma from the Scenes folder of the RedWagon project to check your work or skip to this point.

Shading the Wood Railings

You’ll use procedural shading to use the Wood texture available in Maya to create the wood railings. Begin here:

  1. In the Hypershade, create a new Phong material.
  2. Click the Color attribute’s Map icon (c07i002.tif) and choose the Wood texture from the 3D Textures heading in the Create pane in the Hypershade.
  3. In the Attribute Editor for the Wood texture, set the Filler Color and Vein Color attributes according to Table 7-3.

    Table 7-3: Filler Color and Vein Color attributes

    AttributeH valueS valueV value
    Filler Color430.251.0
    Vein Color10.70.3150.9
  4. Set Vein Spread to 0.5, Layer Size to 0.5, Randomness to 1.0, Age to 10.0, and Grain Contrast to 0.33. In the Noise Attributes heading, set Amplitude X to 0.2 and Amplitude Y to 0.1, as shown in Figure 7-96. Name the shader Wood.
    c07f096.tif

    Figure 7-96: Setting the Wood texture

  5. Select all the wood railings and posts and assign the Wood shader to them. Render a frame and compare it to Figure 7-97. Notice the green cube place3dTexture node that is now in your scene. See Figure 7-98.
  6. The side wood railings look fine; however, the wavy pattern on the front and back wood railings looks a bit odd. In the Hypershade, duplicate the shading network for the Wood shader and call the new shader woodFront.
    c07f097.tif

    Figure 7-97: Assign the Wood shader.

    c07f098.tif

    Figure 7-98: The place3dTexture node for the wood texture

  7. Assign that shader to the front and back railings and posts. Graph the network on the woodFront shader in the Hypershade window’s work area.
  8. In the Hypershade, select the place3dTexture2 node (Figure 7-99) and the green cube in the viewports.
c07f099.tif

Figure 7-99: Select the placement node for the second wood texture.

  1. Rotate that placement node in the persp viewport 90 degrees to the right or left. Render a frame, and compare it to Figure 7-100. The wood should no longer have that awkward wavy pattern.

The wood railings are finished. Now, for some extra challenge, you can use pictures of real wood to map onto the railings for a more detailed look. The procedural Wood texture can give you only so much realism. If you create your own wood maps, use your experience with the side panels to create UV layouts for the railings so you can paint realistic wood textures using Photoshop. You’ll use custom photos and texture image maps next to simulate the rich wood in the decorative box later in the chapter.

c07f100.tif

Figure 7-100: The wood on the front and back railings looks better.

Finishing the Wagon

Now that the railings are done and you have test renders, there are only two parts left to texture: the bullnose front of the wagon and the metal handle and screws. From here, take your time and create a bump map based on a fractal, as you did for the tires, and apply it to the bullnose’s black shader. Figure 7-101 shows a nice subtle bump map on the bullnose.

c07f101.tif

Figure 7-101: A nice bump for the bullnose

c07f102.tif

Figure 7-102: Select all the metal screws, the bolts, and the handlebar and assign the Metal shader to them.

And last, you’ll need a metal shader for the screws, bolts, and handlebar for the wagon. Use a Phong shader with a blue-gray color and a low diffuse value and assign it to all the metal parts of the wagon, as shown in Figure 7-102. You can then add an environment map to the reflection color like you did for the table lamp stem earlier in this chapter to give the metal a reflective look.

Because metal is a tricky material to render and a lot of a metal’s look is derived from reflections, you’ll finish setting the Metal shader’s attributes in Chapter 11, when you render the wagon as well as the table lamp. You’ll enable raytracing to get realistic reflections and gauge how to best set up the Metal shader for a great look.

Figure 7-103 shows the wagon with all its parts assigned to shaders. Figure 7-104 shows a quick render of the wagon as it is now.

You can load the file RedWagonTexture_v04.ma from the Scenes folder of the RedWagon project to check your work or skip to this point.

c07f103.tif

Figure 7-103: The wagon in the Perspective panel

c07f104.tif

Figure 7-104: A current render of the wagon

Photo-Real Mapping: The Decorative Box

With all the references you can find to any given object on the Internet, why not use real photos to create the textures for a model? That’s exactly what you’ll do here, with the decorative box you modeled in Chapter 3, using pictures of the real box.

You’ll take this texturing exercise one important step further in Chapter 11 and experience how you can add detail to an object through displacement mapping, after you assign the colors in this chapter. This will allow you to add finer detail to a model without modeling those details.

Setting Up UVs (Blech!)

The UVs on the decorative box aren’t too badly laid out by default, as you can see in Figure 7-105. The only parts of the box that are missing in the UV layout are the feet. That is a common issue when extruding polygons: their UVs are rarely laid out automatically as you extrude them. Frequently, they’re bunched up together in a flat layout that is difficult, if not impossible, to see in the UV Editor.

c07f105.eps

Figure 7-105: The feet UVs are missing from the box model.

Open the file boxModel07.mb in the Scenes folder of the Decorative_Box project on the companion web page or continue with your own model.

First you have to make room for the feet UVs.

  1. Select all the UVs for the entire box in the UV Editor. Press R for the Scale tool and scale everything down uniformly to gain some space in the normalized UV space, shown in Figure 7-106.
    c07f106.tif

    Figure 7-106: Scale all the UVs down a bit.

  2. Now you have to create new UVs for the four feet and then move them to where they should be in the full box’s UV layout. Go into Component mode and select the poly faces for the four feet, as shown in Figure 7-107.
    c07f107.eps

    Figure 7-107: Select the faces for the feet.

  3. With the faces selected, go to the main Maya window. In the Modeling menu set, select UV ⇒ Automatic. The feet now have UVs that you can see in Figure 7-108. However, they’re all over the place. You have to individually select and move each face of each foot to its appropriate place on the box’s overall UV layout.
c07f108.tif

Figure 7-108: The automatic UV creation puts the UVs everywhere.

  1. Select all the feet UVs in the UV Editor and scale them all down uniformly together. You want to scale them all so that one of the squares fits into the corner of the top shape, as shown in Figure 7-109 (left). Then move them all together off to the side, as shown in Figure 7-109 (right). You’ll position and scale them to fit properly soon.
c07f109.tif

Figure 7-109: Scale the feet UVs to fit the size of the rest of the box’s UVs (left). Then move the feet UVs to the side of the UV editor (right).

  1. Now comes the task of figuring out which UV fits where. In the UV Editor window, select the edges shown in Figure 7-110 by Shift+single-clicking them. Do not use a marquee selection to make sure you select only the single edges you need. Notice that as you select each edge, they become selected in the model as well as the feet UVs off on the side of the UV Editor window. These are the edges where the outside sides of the feet meet the box. If you find it easier, you can select those edges from the model itself instead of the UV Editor.
    c07f110.eps

    Figure 7-110: Select these individual edges either in the model view or in the UV Editor.

  2. With those edges selected, in the UV Editor choose the Move And Sew The Selected Edges icon (Figure 7-111). This will snap the UVs for the outside sides of the feet to their respective sides on the box. If you did not scale the feet UVs in step 4 well enough, you will notice that the feet will stick out from the sides of the box’s UVs, as shown in Figure 7-112 (left). If that is the case, it’s easier to return to step 4 (press Z for undo until you reach step 4 again) and scale those feet UVs more accurately. This can have a little bit of a back and forth. As long as you are within reasonable size, you will be fine. Figure 7-112 (right) shows a better matching scale of the feet after the UVs are sewn together.
c07f111.tif

Figure 7-111: The Move And Sew The Selected Edges icon in the UV Editor

c07f112.tif

Figure 7-112: Sew the feet edges to the box. On the left, the feet UVs are scaled too big in step 4. On the right, the feet UVs are scaled properly.

  1. RMB+click in the UV Editor and select Shell from the marking menu. Select all the Shells together, including the feet shells on the side, and scale everything slightly smaller to better fit in the UV space allotted, and then move them together to re-center the layout, as shown in Figure 7-113 (left). Then select the shell for the bottom of the box and move it up away from the backside of the box, as shown in Figure 7-113 (right).
  2. Figure 7-113 (right) also shows the remaining feet UVs off on the left side of the UV Editor window. The four square shapes are the bottoms of the feet. Select one of the square shells and move it to fit to the bottom UVs of the box, as shown in Figure 7-114 (right).
  3. Repeat step 8 to place all the feet bottom shapes around the UVs of the bottom of the box, as shown in Figure 7-115.
  4. Individually select the shells of the remaining feet UVs on the side of the UV Editor and line them up to the side of the box bottom also shown in Figure 7-115. Those remaining feet UVs are the inside faces of the feet and share the same generic wood texture as the bottom of the box, so aligning and sewing them together like you did for the outside faces of the feet in steps 5 and 6 is not necessary (Figure 7-116).

When you’ve finished, your UV Editor should resemble the one shown in Figure 7-117. Because the box’s decorations are seamless from the top of the box down to the four sides, let’s lay out the UVs to make painting and editing in Photoshop easier.

c07f113.tif

Figure 7-113: Scale down and re-center the UV layout (left); then select the shell and move the bottom UVs up in the UV Editor (right).

c07f114.tif

Figure 7-114: Select one square UV shell and move it to fit the box bottom UV shape.

c07f015.eps

Figure 7-115: Place the feet bottoms to the box bottom and then line up the remaining feet UVs to the side.

c07f116.tif

Figure 7-116: These faces will have a generic wood texture like the bottom of the box and do not need to be carefully lined up.

c07f117.eps

Figure 7-117: Finally, you’re finished with the feet UVs.

In the UV Editor, select the box top’s edges, as shown in Figure 7-118 (left). Then click the Move And Sew The Selected Edges icon (shown earlier in Figure 7-111) in the UV Editor, and your UV layout should match Figure 7-118 (right). The top and sides of the box are all one UV shell now.

UV layout can be an exacting chore, but when it’s completed, you’re free to lay out your textures. You can check your work against the file boxTexture01.ma in the Scenes folder of the Decorative_Box project on the companion web page. You can also take a much needed breather. I sure hope you’ve been saving your work!

c07f118.eps

Figure 7-118: Select the box top edges (left) and sew them together (right).

Color Mapping the Box

Now that you have a good UV layout, you can output a UV snapshot and get to work editing your photos of the box to make the color maps. Start with the following steps:

c07f119.tif

Figure 7-119: Setting the UV Snapshot options

  1. Select the box and open the UV Editor window. From the UV Editor menu, select Polygons ⇒ UV Snapshot. In the UV Snapshot window, set Size X and Y to 2048. Change Image Format to TIFF.

    Click the Browse button and select a location for your UV snapshot image. Generally, the project’s Sourceimages folder is the best place for it. Make sure you don’t write over the UV snapshot already created for you. Type in a name for your UV snapshot and click OK to create the image. Figure 7-119 shows the option box, and Figure 7-120 shows the UV snapshot image.

  2. Open the UV snapshot image in Photoshop or your favorite image editor and set it as its own layer. Rename the layer to UV Snapshot. I’ve done the heavy lifting for you and have prepared five photos of the decorative box that you can use to map the model. Figure 7-121 shows the photos of the box. This image file is included as lineup.jpg in the Sourceimages folder in the Decorative_Box project on the companion web page.
    c07f120.tif

    Figure 7-120: The UV snapshot for the decorative box, shown as black lines on white. You may see white lines on black in Photoshop.

    c07f121.eps

    Figure 7-121: Photos of the box

  3. As you’ve probably guessed, you need to copy and paste the photos to their respective views over the UV Snapshot layer. Open the lineup.jpg file in Photoshop alongside the UV snapshot. Marquee+select a box around the top image (the one at the left in Figure 7-121) and copy it (Ctrl+C or Edit ⇒ Copy in Photoshop).
  4. Go to the UV snapshot image in Photoshop and paste the image on top. Rename the new layer to Box Top and set the layer’s Opacity to 50% so you can still see the UV layout, as shown in Figure 7-122.
c07f122.tif

Figure 7-122: Paste the top image onto the UV snapshot image.

  1. Use the Scale function in Photoshop (Edit ⇒ Transform ⇒ Scale) to move and scale the top image to fit over the top of the UV layout, as shown in Figure 7-123. Make sure you scale the box-top image uniformly to keep it from distorting. You can do this by holding the Shift key as you scale the image up or down.
    c07f123.eps

    Figure 7-123: Position and scale the top image in Photoshop to line up with the UVs of the top of the model. Notice the overlap of the sides and the top.

    These photo images of the box have been retouched and painted to create an overlap. This means that parts of the sides of the box show in the top image. As you can see in Figure 7-123, the top image extends slightly all around the four sides. This allows the different parts of the texture map (top and four sides) to overlap and blend with each other better when put on the model.

    Save your work as boxColorMap01.psd in the project’s Sourceimages folder. Saving as a Photoshop file will preserve the layers for easier editing.

  2. Marquee+select the right-side image of the box (immediately to the right of the top image in lineup.jpg) and copy it. Paste it into boxColorMap01.psd in Photoshop. Do your best to align the right-side image with the top image, using the features of the box to line them up, as you can see in Figure 7-124. You can fix this later by adjusting both the map and the UVs on the box for a tighter fit. For now, be fairly accurate and leave the finesse for later. Save the file.
  3. Use the same procedures in Photoshop to line up the other sides of the box, as shown in Figure 7-125. Set the box-top image to be the topmost layer, make sure all the layers are at 100% opacity, and then turn off the UV Snapshot layer so it’s not visible.
c07f124.tif

Figure 7-124: Align the right-side image with the right-side UVs.

c07f125.eps

Figure 7-125: Copy, paste, and line up the box sides and the back to their respective UV areas.

  1. And finally, open the file boxBottomAndFeet.jpg from the Sourceimages folder of the project. Select the entire image and copy and paste into your boxColorMap01.psd file. Position and place the image to fit the bottom UVs of the box in your map in Photoshop. Just get close; you will fine-tune the placement of image to UV later.
  2. Save the final Photoshop file. Then, resave the file as a JPEG called boxColorMap01.jpg. This is the file you’ll map. (See Figure 7-126.)
c07f126.tif

Figure 7-126: The color map layout file boxColorMap01.jpg

Mapping the Box

Let’s map this color image to the box and see how it fits. Based on rendering the box, you can make adjustments to the UVs and the image map to get everything to line up. This, of course, requires more Photoshop and/or image-editing experience, which could be a series of books of its own. If you don’t have enough image-editing experience, have no fear: the images have been created for you so you can get the experience of mapping them and learn about the underlying workflow that this sort of texturing requires. Follow these steps:

  1. In Maya, open the Hypershade window and create a new Phong shader. In the Property Editor, click the Map icon (c07i002.tif) next to the Color attribute and select File.
  2. In the Property Editor for the File icon, click the Folder icon next to the Image Name attribute, navigate to the Sourceimages folder for the project, and select the boxColorMap01.jpg file (not the PSD file). Graph the Input and Output Connections on the new Phong into the work area (see Figure 7-127).
    c07f127.tif

    Figure 7-127: The color map’s file node

  3. Select the file1 node and in the Property Editor rename it to boxColorMap. (See Figure 7-128.)
    c07f128.tif

    Figure 7-128: The icon is named properly.

  4. Select the box and assign the Phong shader to it. Rename the Phong to boxShader. In the persp viewport, press 6 for Texture view. The color map is fairly well aligned on the model. Not bad! (See Figure 7-129.)
c07f129.tif

Figure 7-129: The color map fits pretty well already, but there are a few alignment issues at the edges.

  1. Render a frame to see how the box looks. Notice that there are small alignment issues at the edges where the sides meet and where the top meets the sides. Save your Maya scene.

This gives you a pretty good place to work from. You need to adjust the color map image to be more seamless. The scene file boxTexture02.ma in the Scenes folder of the Decorative_Box project on the companion web page will catch you up to this point.

Photoshop Work

This is where image-editing experience is valuable. Here, it’s all about working in Photoshop to further line up the sides to the top and the sides to each other to minimize alignment issues and yield a seamless texture map. Although I won’t get into the minutia of photo editing here, I’ll show the progression of the images and the general workflow used in Photoshop to make the color map’s different sides and top line up or merge better. The images have already been created and are on the companion web page in the Sourceimages folder for this project.

For example, using masking in Photoshop, spend some time feathering the intersection of the box’s sides in boxColorMap01.psd so there is no hard line between the different sides and the top. Figure 7-130 shows a smoother transition between the different parts. This image has been created for you; it’s boxColorMap02.jpg in the Sourceimages folder. Make sure you don’t overwrite that file if you’re painting your own.

c07f130.tif

Figure 7-130: Use masks to feather the transitions between the different parts of the box.

In Maya, double-click the boxColorMap node in the Hypershade and in the Attribute Editor replace the original boxColorMap01.jpg file with the boxColorMap02.jpg file from the Sourceimages folder (or your own retouched image file). Render and compare the difference. The top and front should merge a little better. In the persp viewport, orbit around the box in Texture View mode (press 6) to identify any other alignment issues. In some cases, as you can see in Figure 7-131, gray or black is mapped onto the box on its right side, and there is a warped area. Also, the crease where the lid meets the box is lower than you’ve modeled.

c07f131.tif

Figure 7-131: There are blank areas on the box as well as a little distortion.

The blank areas on the box are outside the bounds of the image in the Photoshop image and can be fixed by adjusting the UVs in Maya. The same goes for the distorted areas on the side of the box—you just need to adjust the UVs.

  1. Select the box and open the UV Editor window. Figure 7-132 shows some primary areas for you to work on.
  2. In the UV Editor, select the UVs (RMB+click and choose UV) shown in Figure 7-133 on the left. Press W for the Move tool and realign the UVs to the seam where the lid meets the box, as shown in Figure 7-133 on the right. As you make the changes in the UV Editor, you should immediately notice them in the Perspective window (as long as you’re in Texture View mode).
c07f132.eps

Figure 7-132: Here are the main problems to fix.

c07f133.tif

Figure 7-133: Move the UVs.

  1. Look at the image on top in Figure 7-134. Move the appropriate UVs to align the edge of the UV layout to the image for the right side of the box, as shown on the bottom of Figure 7-134.
  2. The distortion is getting better, and the texture fits nicer. But notice in the image on the left of Figure 7-135 that the right side of the box and the back of the box don’t line up well. There are some other instances of the textures not lining up well all around the box. Using the Texture View mode (press 6) in the Perspective window and the UV Editor, go around the box in its entirety and adjust the UVs, point by point as needed, so that they all line up to the image in the UV Editor. Make sure that the sides line up at the edges of the box as well as you can. The image on the right of Figure 7-135 shows correctly aligned UVs for the right side/back side of the box. Don’t forget to line up the bottom of the box and feet, too. That part should be much easier.
c07f134.tif

Figure 7-134: Line up the UVs to the image for the right side of the box.

c07f135.tif

Figure 7-135: Line up the UVs for the right-side/back-side edge of the box.

This part of tweaking the UVs takes time and patience. The key is to keep looking back and forth between the UV Editor and the persp panel to see how the textures are lining up as you move the UVs. Figure 7-136 shows the UV Editor and a persp view of the box with UVs lined up and reasonably ready to go. You can compare your work to the scene file boxTexture03.ma in the Scenes folder of the Decorative_Box project on the companion web page. Render a few different views to take in all the hard work. In Chapter 10, you’ll light the box and prepare it for rendering, and in Chapter 11, you’ll use displacement maps created from these photos to detail the indentations and carvings that are in the actual box. You’ve had enough excitement for one chapter.

c07f136.tif

Figure 7-136: The UVs laid out for the decorative box

Toon Shading

Not everything needs to be textured to look real. Maya has a neat shading system that gives you a cartoon look using clever shaders and a powerful feature called Paint Effects, which you will look at a bit more in Chapter 12. The toon-shading system makes your scenes and animations render more like traditional cartoons with flat colors and outlines. Next, you’ll take a quick look at how to apply toon shading to the wagon you textured earlier in this chapter to make it render more like a cartoon.

  1. Try This Set your project to the RedWagon project and open the RedWagonModel.ma scene file from the Scenes folder.
  1. You’ll see the wagon in a 3/4 view in the persp viewport. Select all the parts of the body of the wagon without the railings or wheels, as shown in Figure 7-137.
c07f137.tif

Figure 7-137: Select the main body of the wagon, without the wheels or the rails.

  1. Switch to the Rendering menu set (F6) and select Toon ⇒ Assign Fill Shader ⇒ Shaded Brightness Two Tone. There is a new Ramp shader added to the scene in the Hypershade’s Materials tab. Select and graph it into the work area, as shown in Figure 7-138.
    c07f138.tif

    Figure 7-138: A Ramp shader is added to the scene and applied to the wagon’s body.

  2. Under the Color heading, set the color of the gray part of the ramp to a dark red and set the white part of the ramp to a bright red. Your wagon should turn red in the persp viewport if you’re in Shaded or Texture view. Render a frame, and you should see the wagon in only two tones of red but with gray railings and wheels (shown in grayscale in Figure 7-139).
  3. Select the rail objects and select Toon ⇒ Assign Fill Shader ⇒ Shaded Brightness Two Tone to create another Toon shader. Set the colors to a dark tan and a bright tan color in the Color ramp.
  4. Select the handlebar and all four wheels and create another two-tone fill shader with a gray and white Color ramp (which is the default).
  5. The frame, railings, and wheels now have a Toon shader as well. Notice the wheels in Figure 7-140 and how cool they look when toon-shaded. Of course, adjust any of the colors to your liking.
    c07f139.tif

    Figure 7-139: The wagon now has a toon-shaded body. The front side of the wagon is a darker red than the front because of the lighting in the scene.

    c07f140.tif

    Figure 7-140: The wagon has Toon shaders for the fill color applied.

  6. Now for the toon outlines. Select all the parts of the wagon and select Toon ⇒ Assign Outline ⇒ Add New Toon Outline. A black outline appears around the outside of the wagon’s parts, and a new node called pfxToon1 appears in the Outliner or Hypergraph. The outlining is accomplished with Paint Effects.
  7. Before you render a frame, set the background to white to make the black toon outlines pop. To do so, select the persp camera and open the Attribute Editor. Under the Environment heading, set Background Color to white.
  8. Open the Render Settings window and make sure that the renderer is set to Maya Software. Render a frame and compare your work to Figure 7-141. The outlines are too thick!
  9. Select the pfxToon1 node in the Outliner and open the Attribute Editor window. Click the pfxToonShape1 tab to open the attributes for the outlines. Set the Line Width attribute to 0.03 and render a frame. Compare your work to Figure 7-142.

Adjust the toon outline thickness the way you like and have some fun playing with the toon outline’s attributes to see how they affect the toon rendering of the wagon. As you can see, there are a lot of attributes for the toon outlines. Paint Effects is quite a complex system, but after you experiment with the toon outlines, it’ll make much more sense. You will return to Paint Effects in Chapter 12 for another quick look at that wonderful system.

c07f141.tif

Figure 7-141: The black outlines are applied, but they’re too thick.

c07f142.tif

Figure 7-142: The cartoon wagon

Feel free to adjust the colors and the ramps of the fill shader to suit your tastes, and you can easily try the other Fill shader types, such as a three-tone shader to get a bit more detail in the coloring of the wagon. This is just a quick primer to get you into toon shading. The rest, as always, is up to you. With some playing and experimenting, you’ll be rendering some pretty nifty cartoon scenes in no time.

For Further Study

For a challenge and more experience, create new image maps for the wagon and try your own decal designs with more traditional (non-toon) renders. You can even change the textures for the decorative box and make your own design. As previously suggested, you can try to create more realistic wood maps for the wagon’s railings. In Chapter 10, you’ll begin to see how shading and rendering go hand in hand; you’ll adjust many of the shader attributes you created in this chapter to render the toy plane and decorative box in Chapter 11.

Summary

In this chapter, you learned about the types of shaders and how they work. Each shader has a set of attributes that give material definition, and each attribute has a different effect on how a model looks.

To gain practice, you textured the toy plane scene using a couple of shaders and texture nodes.

Next, you learned about the methods you can use to project textures onto a surface, and you learned about the Maya texture nodes, including PSD networks and the basics of UVs, and how to use them to place images onto your wagon and decorative box models in detailed exercises exposing you to manipulating UVs and using Photoshop to create maps. And finally, you took a quick look at toon shading and created a cartoonish render of the wagon.

Texturing a scene is never an isolated process. Making textures work involves render settings, lighting, and even geometry manipulation and creation. Your work in this chapter will be expanded in Chapters 10 and 11 with discussions of lighting and rendering.

The single best weapon in your texturing arsenal, and indeed in all aspects of CG art, is your eye, specifically, your observations of the world around you and how they relate to the world you’re creating in CG.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset