Chapter 15. Fur, Hair, and Clothing

Maya offers a number of tools for adding fur, hair, and clothing to characters. Creative use of these tools adds believability and originality to your animated characters. In addition, many of these tools can be used to create engaging visual effects. This chapter takes you through a number of techniques that can be used to add fur, hair, and clothing to characters.

In this chapter you will learn to:

  • Add fur to characters

  • Add dynamic motion to fur

  • Render fur with mental ray

  • Create dynamic curves

  • Add hair to characters

  • Style hair

  • Use hair constraints

  • Render hair

  • Create clothing for characters

  • Paint nCloth properties

Add Fur to Characters

In this section you'll add Maya Fur to a model of a hound dog's head. Maya Fur can be used on NURBS, polygon, and subdivision surfaces. There are some limitations when using NURBS and subdivision surfaces. For instance, rendering fur on trimmed NURBS surfaces can add to render time, and many of the paintable fur attributes do not work when using subdivision surfaces. For this reason, it's recommended that you use polygon geometry whenever possible.

Maya Fur works best for short-haired characters. Think about using fur for hair that is two inches or shorter in the real world. If your character's hair is longer than that, then consider using Maya Hair or Paint Effects.

Prepare Polygons for Maya Fur

Polygon models need to have properly mapped UV coordinates that lie within to 0 to 1 range in texture space. You should make sure that there are no overlapping UVs. This can cause problems and may even crash Maya when rendering.

Try as best as you can to maintain consistency in texture space as you create UV coordinates. Seams between separate UV shells and between parts of the model's texture coordinates are easily seen in the distribution of fur across the surface, and they can be very difficult to eliminate. Figure 15.1 shows an example of a visible seam in the fur attached to the hound dog model. This seam appears because the end of the nose is a separate shell from the rest of the hound's head. In some cases it may be impossible to eliminate all seams.

The best strategy is to place UV seams on parts of the surface that are less noticeable than others. Once you have an understanding of how fur works after completing this chapter, you should test a simple fur preset (such as the duckling preset) on your models as you map the UV texture coordinates. You'll see where the problem areas are before you spend a great amount of time perfecting the fur itself. Props, such as clothing, can also be used strategically to hide UV seams.

Chapter 11 has detailed information on how to create UV texture coordinates for polygon models.

A seam is visible in the fur on the nose of the hound.

Figure 15.1. A seam is visible in the fur on the nose of the hound.

In this example the hound model has been created and the UVs have been properly prepared.

  1. Open the hound_v01.ma scene from the chapter15scenes folder.

  2. Select the houndHead model and choose Window

    Using the Example Scenes

The UVs for the houndHead model are displayed in the UV Texture Editor (see Figure 15.2).

If you are applying fur to a subdivision surface, you may want to convert the model to polygons first and prepare the UVs before applying the fur. You can convert the model back to subdivision surfaces after the fur has been applied. Working with subdivision surfaces and polygons is covered in Chapter 4.

The UV texture coordinates have already been created for the houndHead model.

Figure 15.2. The UV texture coordinates have already been created for the houndHead model.

Create a Fur Description

The fur description node contains all the settings for the fur, such as length, color, width, density, and so on. A single fur description node can be applied to more than one surface.

A number of preset fur descriptions are available on the Fur shelf or in the Presets button in the Attribute Editor for the fur description node. You can use a preset as a starting point. In this exercise, you'll build the fur description from the default fur settings.

  1. Select the houndHead model. Switch to the Rendering menu set, and choose Fur

    Create a Fur Description

    The houndHead surface is covered in long spikes. These spikes are a preview that approximates how the fur will look on the surface. This approximation is a visual aid you can use while editing the fur. If you do not see the spikes (Figure 15.3), the display of locators may have been disabled in the Viewport window. To fix this, choose Show

    Create a Fur Description

    The controls for the fur preview are found in the Attribute Editor for the houndHead_FurFeedbackShape node. This node is parented under the FurFeedback node in the Outliner.

  2. In the Outliner, expand the FurFeedback group and select the houndHead_FurFeedback node. Open the Attribute Editor and click the houndHead_FurFeedbackShape tab.

  3. To increase the number of fur strands displayed in the viewport, set U Samples and V Samples to 128.

    The fur is displayed as long spikes on the surface. Locators must be visible in the perspective view in order to display the spikes.

    Figure 15.3. The fur is displayed as long spikes on the surface. Locators must be visible in the perspective view in order to display the spikes.

    You can set these values higher for a more accurate display; however, higher settings will slow the performance of Maya on your computer. The U and V Samples affect only how the fur is displayed in Maya; they do not affect how it will look when rendered.

  4. Switch to the FurDescription1 tab in the Attribute Editor. Here you'll find the settings that determine how the fur will look when rendered.

  5. In the Fur Description field, rename FurDescription1 as houndFur.

  6. Save the scene as hound_v02.ma. To see a version of the scene to this point, open the houndFur_v02.ma scene from the chapter15scenes folder on the DVD.

Edit the Fur Description: Baldness

There are several ways to design the look of fur applied to your model. You can adjust the slider settings in the fur description node to create an overall look for the fur, or you can apply texture maps to the fur settings. These texture maps can be procedural nodes (such as ramp, fractal, checker), or they can be file textures painted in other programs. You can also use the Artisan Brush tool to paint settings directly on the model. In this section, you'll use Artisan to determine where fur grows on the model.

Fur is applied uniformly across the surface of a model. In order to control exactly where the fur grows, you'll use the Baldness attribute. The Baldness value ranges between 1 and 0. The confusing aspect about the Baldness setting in particular is that a setting of 1 means fur covers the surface. A setting of 0 means the fur does not grow at all. This is confusing because intuitively more baldness (higher values) should mean less fur. In Maya the settings are reversed, so higher Baldness values mean more fur. Fortunately this is the only setting that suffers from this counterintuitive behavior.

Settings between 0 and 1 determine the sparseness of the fur. Using a low Baldness setting, such as 0.1 or 0.2, might work well when creating whiskers for a man's face.

In this exercise, you'll apply Baldness values so that fur does not grow on the end of the nose, in the eye sockets, or on the inside of the mouth.

  1. Open the hound_v02.ma scene from the chapter15scenes directory.

  2. In the Outliner, select the houndHead_FurFeedback node parented to the FurFeedback group. In the Attribute Editor, select the houndFur tab.

  3. Set the Base and Tip Color attributes to bright red. This makes it easier to see the fur as you paint attribute maps. If the fur does not turn red when you adjust the sliders, make sure Color Feedback Enabled is turned on in the houndHead_FurFeedbackShape node.

  4. Switch to the houndFur tab. To make it easier to see what's going on, set the Length slider to 0.1. This reduces the overall length of the fur. Later on you'll fine-tune the length of the fur on the model using Artisan.

  5. Move the Baldness slider back and forth between a value of 1 and 0. You'll see the fur become sparser when the value is lower.

    The slider works well to establish an overall value. For precise control you'll paint Baldness values directly on the model.

  6. Set the Baldness slider to 1 so that the fur covers the entire model evenly.

  7. In the Outliner, select the houndHead object. Choose Fur

    Fur Global Scale
  8. In the Paint Fur Attributes Tool Settings pop-up, make sure Fur Attribute is set to Baldness and Fur Description is set to houndFur. Set Attribute Map Width and Height to 1024.

    The Attribute Map Width and Height determine the resolution of the baldness map that will be created when you use the Paint Fur Attributes tool. In the case of the hound model, you'll need a higher resolution so that you can more precisely paint Baldness values around the tight areas of the eyes, nose, and lips. If the attribute you are painting does not require precision, you can use lower values for Height and Width.

  9. In the options for the Artisan Brush, set Paint Operation to Replace and Value to 0. Wherever you paint on the surface of the model, fur will be removed.

  10. In the Tool Options section, under the Display rollout, activate Color Feedback. This colors the model according to the values you paint on the fur. The colors act as a guide as you paint.

  11. Zoom in on the nose of the model. Hold the cursor over the nose of the hound. Hold the b key and drag left or right to interactively adjust the width of the brush.

  12. Start painting in the nose; you'll see the spikes start to disappear as you paint. The area where you paint also turns black (see Figure 15.4).

    Sometimes you need to paint over a spike a couple times to get it to update. If you need more detail in the Fur Feedback, you can increase the U and V Samples values in the houndHead_FurFeedbackShape tab.

    The surface of the hound turns black as you paint the Baldness value on the model. The fur spikes disappear in the black areas.

    Figure 15.4. The surface of the hound turns black as you paint the Baldness value on the model. The fur spikes disappear in the black areas.

  13. Paint on the nose and the inside folds of the nose until all the fur spikes are gone. You'll edit the Baldness values more later, so don't stress out if it's not absolutely perfect.

  14. When you have finished the nose, use the Show menu in the perspective view to turn off the visibility for NURBS surfaces. The eyes disappear. Paint inside the eye sockets to remove the fur from inside of the eye (see Figure 15.5).

  15. To remove fur from the lips, you can move the perspective view inside the model and paint on the backside of the surface (Figure 15.6).

    Use the Paint Fur Attributes tool to remove fur from inside the eye sockets.

    Figure 15.5. Use the Paint Fur Attributes tool to remove fur from inside the eye sockets.

    Remove fur from the lips by painting from the inside of the model.

    Figure 15.6. Remove fur from the lips by painting from the inside of the model.

  16. In the Attribute Editor for the houndFur node, scroll down and expand the Details section. Find the Baldness rollout and expand the Maps section. This lists the maps painted for the houndHeadShape. Currently the baldness map is listed as UNNAMED. This refers to the map you have been painting on the hound. It exists as a temporary file until you save the scene (see Figure 15.7).

  17. Save the scene as hound_v03.ma.

An unnamed map is listed in the Maps section for the Baldness attribute.

Figure 15.7. An unnamed map is listed in the Maps section for the Baldness attribute.

When you save the scene, the maps that you have painted for the fur attributes are saved to disk. They can be found in the current project's furfurAttrMap directory. The maps are saved in the Maya .iff format (see Figure 15.8).

If you reopen the scene, the UNNAMED label is replaced in the Maps section of the Attribute Editor for the houndFur node with the path to the baldness map that has been saved to disk (Figure 15.9).

When you save the scene, the baldness map is written to disk.

Figure 15.8. When you save the scene, the baldness map is written to disk.

When you reopen the scene, the UNNAMED label is replaced with the path to the baldness map that has been written to disk.

Figure 15.9. When you reopen the scene, the UNNAMED label is replaced with the path to the baldness map that has been written to disk.

Edit the Fur Description: Direction

You can use the Artisan Brush interface to comb the fur by painting the Direction attribute.

  1. Continue with the scene from the previous section or open the hound_v03.ma scene from the chapter15scenes directory on the DVD.

    You'll notice that there is no Direction or Comb attribute listed in the attributes for the houndFur node. Painting the Direction attribute is the same as painting the Polar attribute.

  2. In the houndFur node's Attribute Editor, set Inclination to 1 and move the Polar slider back and forth. The Polar slider determines the direction in which the fur strands face, but you'll notice that the direction is not uniform across the surface.

    Inclination sets the angle at which the hair stands from the surface. A value of 0 is perpendicular to the surface; a value of 1 causes the fur to lie flat against the surface. If the value is 0, then the fur strand sticks straight up, so changing its direction has no visible effect.

    Roll rotates the fur around its root. A value of 0 is −90 degrees; a value of 1 is 90 degrees.

    Base Curl and Tip Curl determine the amount of curling applied to the base and tip of the hair. A value of 0.5 produces straight hair; a value of 0 or 1 curls the hair from one side or the other.

    The change in direction created by the Polar attribute is based on the direction of the UV texture coordinates. This means that a value applied to fur on one part of the model has a different result than a value applied on another part of the model. In order to comb the hair correctly, you use the Direction attribute in the Paint Fur Attributes tool to apply a Polar value based on the direction that you drag across the surface. So when you choose to paint the Direction attribute in the Paint Fur Tool options, you're really painting values for the Polar attribute but in a way that is a bit more intuitive.

    When painting the direction, set Inclination to a value other than 0, and the Roll value must be something other than 0.5. The Base Curl and Tip Curl values must be something other than 0.5 as well. If these values are not set properly, painting the Direction has no effect. In addition, Color Feedback has no bearing on the direction of the fur, so you can turn this option off in the options for the Artisan tool.

  3. Open the Attribute Editor for the houndFur node. Set Inclination to 0.8, and set Roll to 0.2. Set Base Curl to 0.7 and Tip Curl to 0.3.

  4. Select the houndHead surface. Choose Fur

    Edit the Fur Description: Direction
  5. In the Options box for the Artisan tool, scroll to the bottom. In the Display options, turn off Color Feedback.

  6. In the pop-up options for the Paint Fur Attributes Tool settings, set Fur Attribute to Direction. Make sure Fur Description is set to houndFur and the Attribute Map Width and Height are set to 1024.

  7. Drag across the surface to push the fur in the general direction you want it to go. Use Figure 15.10 for reference. Figure 15.11 shows how the paint stroke influences the direction of the fur on the model.

    Paint lightly and slowly using repeated strokes to make the fur point in the desired direction. Combing the fur requires some patience and practice. It's helpful to increase the U and V samples on the FurFeedback node so that you can see more fur as you are painting. It can be difficult to maintain a consistent direction across UV seams. The fewer seams you have in your UV texture coordinates, the easier it will be to paint the direction of the fur.

    The Direction attribute responds to the direction in which you move the cursor over the surface. The Paint Operation or Value settings in the Artisan options do not affect how the fur is combed.

  8. Save the scene as hound_v04.ma. To see a version of the scene to this point, open the hound_v04.ma scene from the chapter15scenes directory.

Observe the direction of the fur in this photo of an American foxhound.

Figure 15.10. Observe the direction of the fur in this photo of an American foxhound.

Paint the direction of the fur on the surface of the hound. Increase the U and V Samples in the fur feedback node to 256 to make it easier to see details in the fur direction.

Figure 15.11. Paint the direction of the fur on the surface of the hound. Increase the U and V Samples in the fur feedback node to 256 to make it easier to see details in the fur direction.

Edit the Fur Description: Length

The Length attribute can be edited using the Paint Attributes tool as well. When editing lengths you need to pay attention to the values used in the options for the Artisan Brush. For the hound, the fur is shorter near the end of the nose, medium length on the face, and long on the back of the head and neck.

  1. Continue with the scene from the previous section or open the hound_v04.ma scene from the chapter15scenes directory.

  2. Select the houndHead object and choose Fur

    Edit the Fur Description: Length
  3. In the houndHead_furFeedbackShape tab, set U and V Samples to 128.

  4. In the pop-up menu for the Paint Fur Attributes Tool settings, set Fur Attribute to Length. Make sure Fur Description is set to houndFur and Attribute Map Width and Height are set to 1024.

  5. In the options for the Artisan Brush, set Paint Operation to Replace and Value to 0.5.

  6. Paint around the area of the neck. You'll see the fur become longer as you paint (Figure 15.12).

  7. Set Value to 0.25 and paint on the ears, under the ear, the top of the head, and the upper part of the throat.

  8. Set Value to 0.1 and paint the area near the nose and the front of the snout near the lips.

  9. To even out the transition between the fur lengths, set Paint Operation to Smooth, and paint the areas on the border between the different lengths of fur.

    After painting fur lengths you may decide to touch up the Direction attribute of the fur as well. You can change the paint operation mode (from Length to Direction, for example) in the Paint Fur Attributes Tool Settings pop-up whenever you need to, but remember that Maya may pause for a few moments to update the maps when you change attributes.

  10. Save the scene as hound_v05.ma. To see a version of the scene to this point, open the hound_v05.ma scene from the chapter15scenes.

Edit the length of the hair by painting on areas of the houndHead surface.

Figure 15.12. Edit the length of the hair by painting on areas of the houndHead surface.

Test Render Fur

Now that you have the basic fur description created for the houndHead, you may want to see what it looks like when rendered. You can render the scene using either mental ray or Maya Software. The results should be fairly similar. In this example, you'll use mental ray.

  1. Continue using the scene from the previous section or open the hound_v05.ma scene from the chapter15scenes folder.

  2. Open the Render Settings window, and set the Render Using menu to mental ray.

  3. In the Quality tab, set Quality Presets to Production: Rapid Fur (see Figure 15.13). This preset uses the Rasterizer as the primary renderer instead of raytracing. For more information on rendering with mental ray, consult Chapter 12.

  4. Open the Render View window, and create a test render using the perspective camera.

    Choose the Rapid Fur preset in the Quality tab of the Render Settings window.

    Figure 15.13. Choose the Rapid Fur preset in the Quality tab of the Render Settings window.

    You'll notice immediately that the fur does not look very realistic (see the upper-left image in Figure 15.14). It is very sparse and bright red. You need to increase the Density setting of the fur so that enough hair covers the surface of the model.

  5. Set Density in the houndFur tab to 100,000, and create another test render (see the upper-right image in Figure 15.14).

    The fur is much denser without adding too much to the render time. To improve the look of the fur, you can edit the base and tip widths as well as the basic color.

  6. In the houndFur tab in the Attribute Editor, click on the color swatch next to Base Color, and use the Color Chooser to set the color to a dark brown.

  7. Set Tip Color to a light brown.

  8. Make sure Base Opacity is set to 1. Set Tip Opacity to 0.1. Set Base Width to 0.01 and Tip Width to 0.005.

  9. Create another test render (see the lower-left image in Figure 5.14).

  10. Raise Density to 500,000, and create another test render (see the lower-left image in Figure 15.14).

  11. Save the scene as hound_v06.ma. To see a version of the scene, open the hound_v06.ma scene from the chapter15scenes directory.

The fur should cover the model completely; however, you will notice that some attributes, such as the baldness map and the direction, may require further editing.

Create test renders of the fur as you adjust the settings.

Figure 15.14. Create test renders of the fur as you adjust the settings.

Apply a Color Map

Adding a texture map to the color greatly helps the realism of the fur. You can increase the efficiency of the render by applying the same file texture to the fur color and the shader as applied to the model. This technique should work as long as the model does not get extremely close to the camera.

A texture map that has been carefully painted in Photoshop or in a 3D texturing program works better than a map created by painting color on the fur. In this case ZBrush was used to create the color texture map for the hound model.

  1. Continue with the scene from the previous section or open the hound_v06.ma scene from the chapter15scenes directory on the DVD.

  2. Open the Hypershade, select the houndShader material, and open its Attribute Editor.

  3. Click on the checkered button next to the Color channel to open the Create Texture Node window. Click the File button to create a file texture node.

  4. In the Attribute Editor for the file node, click the folder icon next to File Name. Use the browser to select the houndBaseColor file texture from the chapter15sourceimages directory on the DVD. Press the 6 key to switch to textured view so you can see how the color is placed on the model.

  5. Keep the Hypershade window open. In the Outliner, expand the FurFeedback group and select the houndHead_FurFeedback node. In the Attribute Editor, select the houndFur tab.

  6. In the Hypershade, switch to the Textures tab. MMB-drag the file1 texture onto the Base Color swatch in the Attribute Editor for houndFur (see Figure 15.15).

  7. In the Hypershade, create a second file texture node (Create 2D Texture

    Apply a Color Map
    Drag the file1 node from the Textures tab of the Hypershade onto the Base Color channel of the houndFur node.

    Figure 15.15. Drag the file1 node from the Textures tab of the Hypershade onto the Base Color channel of the houndFur node.

  8. Lower Specular Color to a dark gray, and set Specular Sharpness to 80. This makes the specular highlight on the fur smaller and less reflective.

  9. Set the Density value of the fur to 250,000 in the houndFur tab, and create a test render (see the left image in Figure 15.16).

  10. To increase the realism of the fur, turn on shadows for the scene lights. Select the spotlight1 object and open its Attribute Editor. Under Shadows, turn on Use Depth Map Shadows. Set Resolution to 1024 and turn off Use Auto Focus. Create another test render (see the right image in Figure 15.16).

  11. Save the scene as hound_v07.ma. To see a version of the scene, open the hound_v07.ma scene from the chapter15scenes directory.

Add a color map to the fur description (left image) and render the scene shadows (right image).

Figure 15.16. Add a color map to the fur description (left image) and render the scene shadows (right image).

Map Offsets and Multipliers

In the Details section of the houndFur node, you'll notice each attribute has Map Offset, Map Multiplier, Noise Amplitude, and Noise Frequency settings. These sliders can apply an additional adjustment to the fur map attributes.

The Map Offset and Multiplier attributes are used to change the range of values for any of the attributes. Most of the attributes are limited to a range between 0 and 1, which corresponds to the grayscale values painted on the surface with the Paint Fur Attributes brush. If you would like to change the range so that it can go beyond 1, you can use Map Offset or Map Multiplier.

Offset adds a number to the overall range. If you want to offset the range for an attribute so that instead of a range of 0 to 1 the range becomes 2 to 3, set Offset to 2.

If you want to expand or diminish the range of values use Multiplier. For example if you want the range of a value to be between 0 and 10 instead of 0 to 1, set Multiplier to 10.

The Noise Amplitude and Frequency sliders add randomness to the map values.

  1. Continue with the scene from the previous section or open the hound_v07.ma scene from the chapter15scenes directory.

    The fur for the hound is a little too long to be appropriate for a typical foxhound. Rather than repaint the Length values, you can simply adjust Multiplier for the Length attribute.

  2. Open the Attribute Editor for the houndFur node. Expand the Details

    Map Offsets and Multipliers
  3. Expand the Tip Ambient Color attribute, and set Noise Amplitude to 0.5 and Noise Frequency to 25. This adds variation to the brightness of the fur tips.

  4. Create a test render from the perspective camera (Figure 15.17).

  5. Save the scene as hound_v08.ma. To see a version of the scene, open the hound_v08.ma scene from the chapter15scenes directory.

Shorten the overall length of the hair by reducing the Multiplier value for the Length attribute. Add variation to the tip color by adding noise to the Tip Ambient Color attribute.

Figure 15.17. Shorten the overall length of the hair by reducing the Multiplier value for the Length attribute. Add variation to the tip color by adding noise to the Tip Ambient Color attribute.

Additional Fur Attributes

The basic fur description for the hound has been created, but to make it look realistic a fair amount of editing still needs to be done. There are many additional attributes you can use to help accomplish this. This section describes how these attributes work. As with the Baldness, Length, Direction, and Color attributes, you can use a single value to determine the overall setting for each attribute, paint values for the attribute on selected areas, or use a texture map to determine the strength of the selected values.

Inclination, Roll, and Polar are attributes that determine the direction the fur is pointing along the surface of the model. As noted before, Inclination determines whether the hair points straight up from the surface (at values closer to 0) or lies along the surface (at values closer to 1). The Roll setting rotates each hair around the base, and the Polar attribute determines the direction the fur points along the surface. Roll and Polar can be used together to fine-tune the direction of the hair. If you have painted a map for the Direction attribute using the Paint Fur Attributes tool, changing the Polar setting has no effect.

After painting a map for the Direction attribute using the Paint Fur Attributes tool, you may want to paint values for the Inclination and Roll attributes. This can help define more exactly the direction in which the fur points along the surface. You may find yourself switching back and forth among Direction, Inclination, and Roll as you edit the fur on the surface. If you need precise control over the styling of the fur, be prepared to spend some time working with these attributes.

Base Opacity and Tip Opacity are self-explanatory attributes. The base of the fur is the part of the fur strands closest to the surface; the tip is the part of the fur farthest from the surface. Opacity is applied as a gradient across the length of the fur. To create the look of soft, fine fur, set Base Opacity to 1 and Tip Opacity to a very low setting or even 0. You can experiment with these values to create special effects; try a low Base Opacity and a high Tip Opacity.

Base Width and Tip Width establish the shape of the fur strands. A small Tip Width coupled with a large Base Width produces a pointy shape for the fur. A very low Tip Width helps to create the look of soft, fine fur.

The Base Curl and Tip Curl attributes add curl to the fur strands at the base or tip. A value of 0.5 produces no curling. A value of 1 or 0 produces curling in one direction or the other.

The Scraggle, Scraggle Frequency, and Scraggle Correlation attributes add random kinks to the hair to create a messy appearance. The Scraggle setting determines the strength of the scraggle. Scraggle Frequency determines how many kinks appear in each strand of fur. Scraggle Correlation determines how the Scraggle value of one strand affects another. A setting of 0 for Scraggle Correlation creates random kinks throughout the fur strands, and a Scraggle Correlation of 1 means all the fur strands kink the same way, creating a wavy appearance for the fur.

The Clumping, Clumping Frequency, and Clump Shape settings cause the fur strands to attract each other into bunches on the surface. This is useful for making a surface appear wet or matted. The Clumping setting sets the strength of the clumping, and Clumping Frequency determines the number of clumps created across the surface. Clumping Frequency ranges between 0 and 100; higher values take longer to render. Clump Shape determines whether the clumps themselves are convex or concave. Settings closer to −10 produce concave clump shapes, while settings closer to 10 produce convex clumps (Figure 15.18).

Clumping is demonstrated on two planes. The plane on the left has a Clump Shape value of −10; the plane on the right has a Clump Shape value of 10.

Figure 15.18. Clumping is demonstrated on two planes. The plane on the left has a Clump Shape value of −10; the plane on the right has a Clump Shape value of 10.

Add Dynamic Motion to Fur

Creating dynamic motion for fur is actually quite easy. A fur description node uses dynamic hair curves to control the movement of the fur.

Attach a Fur Description to Hair Curves

In this example, you'll add a hair system to a simple NURBS sphere that already has fur applied. The hair curves will then be used to add dynamic motion to the fur.

  1. Open the furBall_v01.ma scene from the chapter15scenes directory on the DVD.

    The Baldness attribute of the fur has been created using a ramp texture that has been baked into the fur description.

  2. Right-click on the sphere and choose Surface Point. Hold the Shift key and select 10 or 12 surface points at the top of the sphere (see Figure 15.19).

  3. Switch to the Dynamics menu set. Choose Hair

    Attach a Fur Description to Hair Curves
    Select surface points at the top of the sphere.

    Figure 15.19. Select surface points at the top of the sphere.

  4. Click the Create Hairs button to make the hairs. The hair curves appear as longer curves coming out of the surface of the sphere.

  5. Open the Outliner and select the hairSystem1 node. Switch to the Rendering menu set and choose Fur

    Adding Hairs to Polygons
  6. Set the timeline to 200 and play the scene. As the hair curves fall, the strands of fur follow. Try animating the sphere so that it moves around the scene (see Figure 15.20).

    To keep the hair from penetrating the NURBS sphere, you need to make the sphere a collision object for the hair curves. This along with other dynamic properties of hair curves is discussed later in the chapter. Essentially, any dynamics added to the hair curves are inherited by the fur.

  7. Save the scene as furBall_v02.ma. To see a version of the scene, open the furBall_v02.ma scene from the chapter15scenes folder on the DVD.

The strands of fur follow the motion of the hair curves.

Figure 15.20. The strands of fur follow the motion of the hair curves.

Render Fur Using mental ray

You can render fur using mental ray or Maya Software. When rendering with Maya Software, you'll need to add a fur shadowing node to the lights in the scene. In this section, you'll learn how to render fur with mental ray, which generally produces a more realistic result than Maya Software.

If you plan to use depth map shadows, use the Production: Rapid Fur preset. If you plan to use ray trace shadows, use the Production: Fine Trace Render preset. If you need the fur to appear in reflections or refractions, use raytracing.

Fur renders use indirect lighting techniques such as Final Gathering. Be aware that the render times for dense fur descriptions when Final Gathering is enabled can be quite long.

Render Fur Using Raytracing

To create a realistic render of the hound using raytracing, follow these steps:

  1. Open the hound_v08.ma scene from the chapter15scenes directory.

  2. Open the Hypershade and select the houndShader material. In the attributes for the material, set the Diffuse attribute to 1. Increasing the Diffuse quality of the shader can sometimes help blend the surface material with the color of the fur.

  3. Open the Render Settings window and select the Quality tab. Set Quality Presets to Production: Fine Trace.

  4. In the Outliner, select the spotlight and open its Attribute Editor. Under Shadows, turn on Use Ray Trace Shadows.

    The Fur/Shadowing attributes listed below the Use Ray Trace Shadows settings are used specifically when rendering with Maya Software, which requires that the shadow-casting lights be connected to the fur description. This is not necessary when rendering with mental ray.

  5. Create a directional light. Rotate the light so that it is shining toward the camera. This creates nice fill lighting as well as a fringe of light along the edge of the fur. In the settings for the directional light, turn off Emit Specular and set Intensity to 0.8.

  6. In the Outliner, expand the FurFeedback group and select the houndHead_FurFeedback node. In the Attribute Editor, click the houndFur node.

  7. Set Density to 500,000. Scroll down to the list of Attributes. Set Tip Opacity to 0 and Base Opacity to 0.5. This helps soften the look of the fur.

  8. Set Base Width to 0.008 and Tip Width to 0.001.

  9. Create a test render from the perspective camera. The scene takes between 5 and 8 minutes to render depending on your machine (see Figure 15.21).

    Render the hound using ray trace shadows.

    Figure 15.21. Render the hound using ray trace shadows.

    You can continue to improve the look of the fur by improving the texture maps applied to the fur description as well as by improving the lighting in the scene.

  10. Save the scene as hound_v09.ma. To see a finished version of the scene, open the hound_v09.ma scene from the chapter15scenes directory on the DVD.

Maya Fur does a pretty good job creating fur effects for many typical situations. For truly stunning fur and hair effects, you may want to consider using the Shave and a Haircut plug-in developed for Maya by Joe Alter. This plug-in has been used for many feature films and television shows. For more information visit www.joealter.com.

Dynamic Curves

Dynamic curves are NURBS curves that have dynamic properties. The primary use of dynamic curves is to drive the dynamics of hair systems applied to characters. However, the usefulness of dynamic curves goes far beyond creating hair motion. Curves used to loft or extrude surfaces, curves used for Paint Effects strokes, curves projected on NURBS surfaces, curves used as IK Splines, curves used as particle emitters, and so on can be made dynamic, thus opening up a large number of possibilities for creating additional dynamic effects in Maya. Furthermore, dynamic curves calculate fairly quickly compared to nCloth, making surfaces created from lofted dynamic curves a useful alternative to nCloth for some situations.

While working through the scenes in this chapter, you may want to set the timeline preferences to loop so that you can see the hair update continuously as you adjust its settings. To do this, choose Window

Dynamic Curves

Use Dynamic Curves with IK Splines

In Chapter 7 you learned about the IK Spline tool, which uses a curve to control the Inverse Kinematics (IK) of a joint chain. The curve itself can be converted into a dynamic curve that can be used to drive the IK Spline tool. This is a great way to add dynamic motion to a rig used for tails or tentacles.

In this example, you'll use a dynamic curve to control a segmented armored tail. The armored tail consists of polygon pieces, each of which has been parent-constrained to a joint in a chain. The first step is to create a curve (see Figure 15.22).

  1. Open the armoredTail_v01.ma scene from the chapter15scenes folder on the DVD.

  2. Switch to a side view and turn on Point Snapping.

    The armored tail consists of polygon pieces constrained to a joint chain.

    Figure 15.22. The armored tail consists of polygon pieces constrained to a joint chain.

  3. In the viewport's Show menu, turn off the visibility of polygons so only the joints are visible. Choose Create

    The armored tail consists of polygon pieces constrained to a joint chain.
  4. Press the Enter key to complete the curve.

    The EP Curve tool creates a curve that has four CVs. Using the EP Curve tool is an easy way to create a straight curve. If you want to add more vertices, you can use the Edit Curves

    The armored tail consists of polygon pieces constrained to a joint chain.
  5. Switch to the perspective view. Turn off the visibility of Joints in the Show menu, so only the curve is visible.

  6. Switch to the Dynamics menu set. Select curve1 and choose Hair

    The armored tail consists of polygon pieces constrained to a joint chain.

    The hairSystem1 node controls the dynamics of the curve; it is similar to the Nucleus solver when using nDynamics.

    The hairSystem1Follicles group contains the follicle1 node and the original curve1. The follicle node contains settings to control the dynamics of the individual follicles. Some of these settings can override the hairSystem settings. If you selected a number of curves before issuing the Make Selected Curves Dynamic command, the hairSystem1Follicles group would contain a follicle node for each curve. This is explored later on when creating hair for a character.

    The hairSystem1OutputCurves group creates a duplicate curve named curve2. This curve is a duplicate of the original curve. The output curve is the dynamic curve; the curve in the follicle group is the original, nondynamic curve. The purpose of the nondynamic curve is to serve as an attractor for the dynamic curve if needed. The dynamic curve gets its shape from the follicle curve.

  7. Set the timeline to 200 and click the Play button. You'll see the dynamic curve move a little (it can be a little hard to see; this will be more obvious in the next step).

  8. Stop the playback and switch to the hairSystem1 tab. In the Dynamics rollout, set the Stiffness Scale Selected value to 0 and play the scene. You'll see the dynamic curve droop a little. As the scene is playing, increase Length Flex.

    A number of nodes are added to the scene when a curve is made dynamic.

    Figure 15.23. A number of nodes are added to the scene when a curve is made dynamic.

    The Stiffness setting controls the rigidity of the curve. A higher Stiffness setting makes the curve less flexible. Lowering the Stiffness value makes the curve bend easily.

    As you increase the Length Flex value, the curve stretches as much as it needs to in order to accommodate the dynamic forces applied to the curve. You'll notice the curve droop downward, indicating that it has weight. The hairSystem1 shape has a Gravity setting built in, much like the Nucleus solver discussed in Chapter 13.

    You'll notice that both ends of the curve appear to be attached to the original curve (Figure 15.24).

  9. Stop the playback and rewind the animation. Set Length Flex to 0.5 and Stiffness to 0.1. Select the follicle1 node in the Outliner, and switch to the Move tool (turn off Grid or Point Snapping if it is still on).

  10. Choose Solvers

    A number of nodes are added to the scene when a curve is made dynamic.
    The dynamic curve droops as if it is attached at both ends to the original curve.

    Figure 15.24. The dynamic curve droops as if it is attached at both ends to the original curve.

  11. Stop the animation and switch to the follicleShape1 tab in the Attribute Editor.

  12. Set the Point Lock menu to Base. Turn on Interactive Playback and move the follicle around again. You'll see that the dynamic curve is attached at only one end.

    If you wanted the curve to be attached to the other end, you'd set Point Lock to Tip. To detach the curve entirely, set Point Lock to No Attach.

  13. Stop the animation and rewind the playback. Select the follicle node, and set the Translate channels to 0 to return the curve to its start position.

  14. With the follicle selected, turn on Point Snapping. Hold the d key, and use the Move tool to move the pivot point of the follicle to the end of the curve on the side where the dynamic curve is still attached, as shown in Figure 15.25. (As you are moving the pivot point, the curve should not move; sometimes it takes a couple of tries to get Maya to properly switch to move pivot mode. An alternative to the d hotkey is to press the Insert key (on a PC, the Home key on a Mac) on the keyboard while the Move tool is activated—not every keyboard has an Insert key, however.)

  15. When the pivot point is repositioned, Shift+click the Translate and Rotate channels in the Channel Box, right-click, and choose Key Selected from the pop-up menu.

    Move the pivot point of the follicle to the end of the curve.

    Figure 15.25. Move the pivot point of the follicle to the end of the curve.

  16. Turn on Auto Keyframe; go to various points in the animation and move and rotate the follicle. While Auto Keyframe is on, a keyframe is placed on all of the Translate and Rotate channels as you make changes to the position of the follicle. The dynamic curve may not update correctly as you make changes; don't worry about that at the moment.

    You want to create an animation where the curve moves about in the scene like a sword slashing through the air.

  17. Rewind and play the animation; you'll see the dynamic curve follow the movements of the follicle as it moves through the air.

  18. Save the scene as armoredTail_v02.ma. To see a version of the scene, open the armoredTail_v02.ma scene from the chapter15scenes directory.

Create an IK Spline Handle from the Dynamic Curve

In this section, you'll create an IK Spline handle for the armored tail and attach it to the dynamic curve. The dynamics of the curve will be edited to change the behavior of the tail.

  1. Continue with the scene from the previous section or open the armoredTail_v02.ma scene from the chapter15scenes directory. In the perspective view, turn on the visibility of joints in the Show menu.

  2. In the Outliner, select and hide the follicle1 node. This prevents you from selecting the wrong curve when creating the IK Spline handle.

  3. Switch to the Animation menu set and choose Skeleton

    Create an IK Spline Handle from the Dynamic Curve
  4. With the IK Spline Handle tool active, select the first joint in the chain and the last joint in the chain. Zoom in closely, and carefully select the blue curve that runs down the center of the chain.

    If the operation is successful you'll see the ikHandle1 node appear in the Outliner. The Dynamic curve (curve2) will move out of the hairSystem1OutputCurves group. That should not affect how the curve behaves.

  5. Rewind and play the scene. The joints follow the motion of the curves.

  6. In the Show menu of the perspective view, turn the visibility of polygons back on, and play the scene. The armored tail thrashes around when you play the animation.

  7. In the Outliner, select the hairSystem1 node, and open its Attribute Editor to the hairSystemShape1 tab. Scroll down and expand the Dynamics section.

    The Stiffness Scale edit curve changes the stiffness of the curve along the length of the curve. The left side of the curve corresponds to the stiffness at the base; the right side of the curve corresponds to the stiffness at the tip.

  8. Add a point to the Stiffness Scale edit curve by clicking on the left side of the curve and dragging downward.

  9. Play the animation, and you'll see the end of the tail lag behind the motion more than the front of the tail. You should be able to edit the curve while the animation is playing and observe the changes (see Figure 15.26).

    The Stiffness setting creates the overall stiffness value for the dynamic curve. Stiffness Scale modifies that value along the length of the curve. Both settings, like almost all of the dynamic curve settings, can be animated.

  10. Save the scene as armoredTail_v03.ma. To see a version of the scene, open the armoredTail_v03.ma file from the chapter15scenes directory.

Editing the Stiffness Scale curve changes the stiffness along the length of the dynamic hair.

Figure 15.26. Editing the Stiffness Scale curve changes the stiffness along the length of the dynamic hair.

Use Forces

The settings in the Forces section add additional levels of control for the curve's motion. Play the animation in the armoredTail_v03.ma scene and adjust these settings while the scene loops so you can see how they affect the motion of the tail.

The Iterations setting affects how the hair responds to stiffness and dynamics. Iterations refers to the number of times the hair solver calculates per time step, similar to the Substeps setting on the Nucleus node. Raise this to improve the accuracy of the hair motion; higher values slow down Maya's playback.

Drag creates friction between the dynamic curve and the air. Increasing this is a good way to simulate the motion of hair in thick fluids.

Motion Drag is similar to Drag; however, it is affected by the Stiffness Scale attribute. In other words, the Drag setting creates a drag in the motion across the length of the dynamic curve, whereas Motion Drag creates a drag along the length of the curve that is influenced by the Stiffness Scale curve. This can be used to fine-tune the motion of the dynamic curve.

Damp is most often used to control erratic motion of dynamic curves. Higher Damp values decrease the momentum of the curve as it follows the motion of the follicle.

Friction reduces the motion of dynamic curves when they collide with surfaces. This won't produce a visible effect unless the curve comes in contact with a collision surface. Collisions are discussed in more detail later in the chapter.

Mass affects the motion of the curve only when additional fields (created from the Dynamics menu set) are applied to the curve, for example, a Turbulence or a Drag field. Mass does not change how the curve responds to forces created in the hairSystem1 shape node. Increasing Mass increases the simulated weight of each CV on the curve as the curve moves through a dynamic field.

Dynamics Weight is used to control the amount of overall influence external dynamic fields (such as Turbulence and Drag) have over the dynamic curve. It does not affect how the Forces settings in the hairSystem node affect the dynamic curve.

Start Curve Attract creates an attraction between the original curve (curve1 in the armoredTail example) and the dynamic curve. This can be used to blend between the dynamic curve and animation created through the use of deformers on the original curve. The Attraction Scale curve can be used to edit the strength of the attraction along the length of the curve, similar to the Stiffness Scale.

Add Hair to a Character

Hair is created by attaching follicle nodes to a surface. Each follicle node controls a number of hairs. The follicles themselves are styled using a combination of control curves and forces. Follicles and control curves are connected to a hair system node. A single hair system node can control hair connected to any number of surfaces, and a single surface can be attached to multiple hair systems.

When you create hair you have to consider how you plan to render it. You have the choice of creating Paint Effects strokes for the hair or curves that can be used to render in third-party rendering engines such as Render Man, or you can create both Paint Effects strokes and curves. Even though hair uses Paint Effects, it renders using mental ray without the need to convert the hair to polygons.

In this section, you'll create and style hair for a character.

Apply Hair to a Surface

When you want to apply hair to a character, you can either apply the hair uniformly to the entire surface or paint the hair selectively on parts of the surface.

It is common practice to create a nonrendering scalp surface that can be parented to a character's head and then apply the hair to the scalp surface rather than directly to the character's head. This allows flexibility because scalp surfaces and their attached hair can easily be swapped between characters. It also speeds up playback in the animation because the hair dynamics are not factored into the calculations required to deform the character's surface if it has been skinned to a skeleton or to other deformers.

Some animators like to apply separate hair systems to each part of the scalp to control the various sections of a particular hairstyle. For instance, one hair system may be applied to the bangs that hang over the character's forehead, while another system is used for the hair on the back of the head. In this exercise, you'll keep things simple by using a single hair system for the character's hairstyle. Both methods are valid, and as you become comfortable working with hair, you may want to experiment with different techniques to see which approach works best for you.

  1. Open the nancyHair_v01.ma scene from the chapter15scenes directory.

    This scene contains the rigged nancy character used in Chapter 6. The head is rigged to a series of joints. You can select and rotate the headCtrl curves above the head to change the position of the head. A scalp surface has been created by duplicating part of the head geometry. This scalp geometry is parent-constrained to one of the joints in the head rig.

    You can apply hair to NURBS or polygon surfaces. When using polygon surfaces, the UV texture coordinates must be mapped so that none of the UVs overlap and the coordinates fit within the 0 to 1 range in the UV Texture Editor. As with fur, you'll get better results from your hair system if the UV coordinates have been carefully mapped. Remember to delete history for the surface once you have created UV texture coordinates to keep the coordinates (and attached hair) from moving unpredictably during animation.

  2. In the Outliner, select the scalp surface and open its Attribute Editor. In the scalpShape tab, expand the Render Stats section; then turn off Casts Shadows, Receive Shadows, Motion Blur, and Primary Visibility so the surface will not render or affect any other geometry in the render.

    There are a number of ways to add hair to a surface. You can paint hair on the surface using the Artisan Brush interface, you can select faces on polygons or surface points on NURBS surfaces and apply hair to the selected components, or you can create a uniform grid of follicles on a surface. Once you attach follicles to a surface, you can add more follicles later to fill in blank areas by painting them on the surface. For the scalp you'll create a simple grid and then add additional follicles if needed later.

  3. Select the scalp surface, switch to the Dynamics menu set, and choose Hair

    Apply Hair to a Surface
  4. Set the Output to Paint Effects and choose the Grid option. Set U and V Count to 24 and Points Per Hair to 20. Set Passive Fill to 1. Set Randomization to 0.1.

    Follicles can be dynamic, passive, or static. Dynamic follicles react to forces and dynamic fields based on the settings in the hairSystem node or on any dynamic overrides created in the follicle shape node. Dynamic follicles can collide with surfaces. Passive follicles inherit the dynamic motion of nearby dynamic follicles, which can reduce computational overhead, especially when collisions are involved. Static follicles have no dynamic motion but can be used to style parts of the hair. You can change the mode of a follicle after creating the hair system if you decide to make a passive follicle dynamic, a dynamic follicle static, or any other of the three modes.

    The Randomization setting randomizes the arrangement of the grid to make the hair placement look less even.

    By increasing the Passive Fill option, a number of the follicles created when the hair is attached to the surface will be passive rather than dynamic. If the Passive Fill option is set to 1, every other row and column of the follicles based on the settings for U and V Count will be passive follicles. If the setting is 2, every two rows and every two columns of follicles will be passive.

    When you first create a hair system, you can create a number of passive follicles using this setting. This speeds up the dynamics as you create the initial hairstyle. Later you can convert the follicles to dynamic or static follicles as needed.

  5. Turn on the Edge Bounded and Equalize options.

    When the Grid method is used, the follicles are placed uniformly on the surface based on the U and V coordinates. If Edge Bounded is on, the follicles are placed up to and including the edge of the UV coordinates. In the case of the example, this means hairs are placed along the edge of the scalp surface. The Equalize option evens out the spacing of the follicle placement to compensate for areas of the U and V coordinates that may be stretched or squashed.

  6. Set Points Per Hair to 20 and Length to 5.

    Hairs that have more points per curve are more flexible and have more detail in their motion as they respond to dynamics; they also slow down the playback speed of Maya in the scene. The Length attribute can be modified after creation.

    The Place Hairs Into option should be set to New Hair System. If a hair system exists in the scene already, you can use this option to add the newly created hairs into the existing system by selecting it from the list. Figure 15.27 shows the settings for the new hair.

  7. Click Create Hairs to make the hair. The hairs appear as long spikes coming out of the head.

  8. Click Play on the scene, and the hairs start to fall. After a few moments, the hairs start to settle. In the next section you'll learn how to style the hair (see Figure 15.28).

  9. Save the scene as nancyHair_v02.ma. To see a version of the scene, open the nancyHair_v02.ma scene from the chapter15scenes directory.

The Create Hair Options area

Figure 15.27. The Create Hair Options area

The hairs appear as long spikes on the top of the head. When you click the Play button, the hairs fall and settle into a basic hair shape.

Figure 15.28. The hairs appear as long spikes on the top of the head. When you click the Play button, the hairs fall and settle into a basic hair shape.

Hair Collisions

Polygon and NURBS surfaces can collide with hair, and there are a number of settings on the hairSystemShape node that can affect how the collisions are calculated as well as how the hair behaves when it collides with a surface.

To understand how to create collisions between surfaces and hair, you'll follow an example that is a slight detour from working with characters.

  1. Open the underseaPlants_v01.ma scene from the chapter15scenes directory. This scene contains a very simple NURBS plane that has been sculpted to look like the floor of the ocean.

  2. Switch to the Dynamics menu set and choose Hair

    Hair Collisions
  3. In the Paint Hair Follicles Settings box, make sure Hair System is set to Create New, and set Output to NURBS Curves.

  4. Set Follicle Density U and V to 6, leave Points Per Hair set to 6, and set Hair Length to 3.

  5. Paint on the surface to add a few follicles. The interaction may be faster if the shaded mode is set to wireframe or if Color Feedback is turned off in the Display section of the Artisan Tool options.

  6. When you have 15 to 20 curves painted on the surface, you can close the Paint Hair Follicle Settings box and switch to the Select tool.

  7. In the Outliner, select the hairSystem1 node and open its Attribute Editor.

  8. In the hairSystemShape1 tab enter the following settings:

    • Stiffness: 0.03

    • Drag: 0.7

    • Gravity: 0

  9. In the Turbulence settings, set Intensity to 0.8, Frequency to 1, and Speed to 1.

  10. Set the timeline to 300 and play the scene. The curves appear to move a bit like some undersea plant life (see Figure 15.29).

  11. Create a polygon sphere. Animate the sphere moving around randomly through the hair curves in such a way that the sphere contacts the hair curves.

  12. When you are happy with the animation, select the polySphere and Ctrl+click the hairSystem node in the Outliner. Choose Hair

    Hair Collisions
  13. Play the scene.

    You may not see much of a collision just yet, or the sphere may appear to collide with some but not all of the hairs.

  14. Select the hairSystem node and open its Attribute Editor. Scroll down to the Collisions section.

    Paint a hair system on a model of the ocean floor. Set the dynamics to simulate undersea plant life.

    Figure 15.29. Paint a hair system on a model of the ocean floor. Set the dynamics to simulate undersea plant life.

  15. Play the animation. As the animation is playing, increase the Collide Over Sample value. This setting adjusts how often collisions are calculated per time step. Higher values increase accuracy but slow down playback in Maya. Set the value to 6.

    You'll notice that the hair sticks to the sphere as it passes. This is a common problem when using geometry to collide with hair. There are some techniques you can use to reduce this problem.

  16. Turn on Draw Collide Width and increase the Collide Width Offset value.

The Draw Collide Width setting creates circles around the hair curve that represent the collision width. Increasing Collide Width Offset increases the collision boundary, making the collision thickness of each hair larger (Figure 15.30).

To reduce the stickiness of the hair, you can lower the Friction setting in the hairSystem's Dynamics settings as well as increase the Iterations value and lower the Stiffness value. Increasing Friction makes the hair stick to the surface longer, which may work well when animating the tendrils of a jellyfish.

Ultimately, if you are unable to eliminate the hair sticking to the collision surface, you may need to consider some alternative techniques. Some models experience more or fewer sticking problems than others.

One technique for eliminating the stickiness is to attach a radial field to the hair and parent the field to the collision object. The max distance of the field can be adjusted to reach just beyond the edge of the sphere.

The best way to eliminate the sticking problem is to use hair collision constraint primitives. This is a special type of hair constraint that uses simple primitives as collision objects. The collision constraints can be parented to objects, and collisions between the hairs and the constraints are faster and more accurate than collisions between geometry and hair. In addition, a collision constraint can be made to collide only with specific follicles. Collision geometry, on the other hand, collides with all of the hairs in a hair system.

The collision width of the hair is displayed as circles around each hair.

Figure 15.30. The collision width of the hair is displayed as circles around each hair.

In the next section, you'll use collision constraints to control how the hair interacts with the character's head. The collision example used in this section is available in the chapter15scenes directory as the underseaPlants_v02.ma scene.

Hair Collision Constraints

Hair collision constraints are simple spherical and cubical primitives that can be used to collide with dynamic hair. The accuracy and speed of collision constraints is superior to collision geometry. Multiple collision constraints can be added to a hair system and scaled to approximate the surface of colliding objects in the scene. In this section, you'll add collision constraints to the nancy character's hair.

  1. Open the nancyHair_v02.ma scene from the chapter15scenes directory.

  2. In the Outliner, select the hairSystem1 node and open its Attribute Editor. To improve the playback of simulations during animation, set Display Quality at the top of the editor to 1 and set Simulation Method to Dynamic Follicles Only.

  3. In the Outliner, expand the hairSystemFollicles group. Select the top node in the group, hold the Shift key, scroll down, and select the bottom node in the group. From the Dynamics menu set, choose Hair

    Hair Collision Constraints
  4. In the Perspective window, switch to wireframe mode. Select the hairConstraint1 node, represented by a wire sphere, and position it roughly in the center of the head. Use the Scale tool to scale the sphere to match the size of the cranium (see Figure 15.31).

    Scale the collision constraint to match the size of the cranium.

    Figure 15.31. Scale the collision constraint to match the size of the cranium.

  5. Switch to the front view and scale the constraint in a little to match the head.

  6. Repeat steps 3 through 5 to create additional collide spheres. Position these to match the jaw, neck, and ears.

  7. When you have positioned the collide spheres to match the basic shape of the head, turn off the visibility of polygons in the perspective view and turn on the visibility of joints.

  8. Use a parent constraint to connect the collide sphere in the head, jaw, and ears to the large joint that runs down the center of the head. (Select the joint first and then the collide sphere to be constrained. In the options for the parent constraint, make sure the Translate and Rotate channels are selected as well as Maintain Offset.)

  9. Use a parent constraint to connect the collide sphere in the neck to the middle neck joints.

  10. Play the scene. The hairs should not penetrate the head, thanks to the constraints. This is more obvious if you lower the Stiffness attribute to a low value such as 0.03 in the hair shape node so that the hairs droop more (see Figure 15.32).

  11. Save the scene as nancyHair_v03.ma. To see a version of the scene, open the nancyHair_v03.ma scene from the chapter15scenes directory.

Parent constrain the collide spheres to the joints in the head rig. When you lower the Stiffness value and play the scene, the hairs are prevented from moving through the collide spheres.

Figure 15.32. Parent constrain the collide spheres to the joints in the head rig. When you lower the Stiffness value and play the scene, the hairs are prevented from moving through the collide spheres.

Hair Shape

There are a number of settings in the hair system node that determine the look of the hair. These are found in the Clump And Hair Shape section of the hair system's attributes.

  1. Open the nancyHair_v03.ma scene from the chapter15scenes directory.

  2. Select hairSystem1, and open its Attribute Editor to the hairSystemShape1 tab.

  3. Set Display Quality to 100 so you get a more accurate preview of the hair. Leave Simulation Method set to Dynamic Follicles Only.

    This improves performance while working in the scene. Keep in mind, though, that you are viewing about half the hair that is actually on the head. If you look at the scalp surface, you'll see the small colored spikes indicating the position of the follicles. Red follicles indicate dynamic follicles; blue follicles indicate passive follicles. The passive follicles are hidden until you switch Simulation Method to All Follicles.

    The hair appears as groups bunched around long spikes that shoot out from the scalp. Each group of hairs is a clump. The movement of each clump of hair is driven by the movement of the follicles. This way Maya can create dynamics for thousands of hairs using a much smaller number of follicles.

  4. The hair remains as long spikes until you play the simulation and let the hair fall down. For the moment, leave the animation at frame 1. It's easier to see how the clumps work when the hair is in its spiky state.

  5. In the Clump And Hair Shape section, increase the Hairs Per Clump number to 60 to increase the fullness of the hair.

    The Baldness Map field allows you to apply a texture to control where the hair grows on the head. The texture must be a black and white, 2D texture. The texture itself does not need to be baked as it does with fur. Just like with fur, black areas of the map indicate no hair (or baldness), and white areas indicate places where the hair grows. Texture maps can also be used, much like the texture maps created for fur baldness.

    The Sub Segments attribute improves the details of the hair (such as curls and kinks) when rendered. Increasing this setting does not affect the dynamics of the hair.

    Increasing Thinning shortens a number of hairs per clump to create a thin and wispy look to the hair.

    Clump Twist rotates each clump around the base of the follicle. Positive values rotate the clump in one direction; negative values rotate it in the opposite direction.

    Bend Follow determines how closely the rotation of the clump affects the shape of the hair clumps. This is most noticeable at the end of each clump.

  6. Play the animation until frame 20 and then stop the animation. Zoom in to the end of a clump, and move the Bend Follow slider back and forth.

    When Bend Follow is at 0, the end of the clump appears flat if the follicle is curved. When Bend Follow is 1, the clump shape is more tubular toward the end of the clump. This attribute should be used to fine-tune the look of your hair as you develop the overall shape.

  7. Rewind the animation and set Clump Width to 0.7. This expands the overall width of the clumps, which helps fill out the hairstyle without the need to add more follicles.

    Hair Width adjusts the width of the hairs. This can be used to thicken or thin the hair. The effect of changing hair width is seen when the hair is rendered. This is a setting you'll probably want to return to when you are setting up your hair for a render.

    Below the Clump And Hair Shape setting sliders are a number of edit curves that can be used to further refine the hair shape. The left side of each curve represents the area of the clump closest to the root; the right side represents the area closest to the tip. Each scale uses the setting in the sliders in the Clump And Hair Shape section as a starting point, so each scale is a modifier for the settings you have already created.

    You can exaggerate or reduce the amount of tapering in the clumps by changing the Clump Width Scale edit curve. Hair Width Scale modifies the width of the hairs based on the setting in the Hair Width slider.

    The Clump Curl edit curve can be used to twist the clumps around the central axis of the follicle. By default the graph is set so that the value of the curling is at 0.5. By moving a point on the curve up (moving up creates values closer to 1; moving down creates values closer to 0) or down, the curling twists in one direction or the other (see Figure 15.33).

    Adding and moving points along the various edit curves can shape the overall look of the hair.

    Figure 15.33. Adding and moving points along the various edit curves can shape the overall look of the hair.

  8. Play the animation to frame 50 and stop. Remove any extra points you may have placed on the Clump Width Scale and Clump Curl so that there are only two points on the scales, one on the far right and one on the far left.

  9. Set the value of the point on the left side of the Clump Width Scale to 1; set the point on the far right to 0.32.

  10. Set the point on the far right of the Clump Curl curve to 0.6.

    The Clump Flatness scale can be used to make the clumps appear as flat planks of hair. Higher values along the curve flatten out the clumps. This setting works well for creating the shape of wet hair.

  11. Set the point on the far left of the Clump Flatness scale to 0.5. Add a point to the far right side of Clump Flatness and move it to 0.7. This helps the roots of the hair to lie closer to the head, creating less of a "poufy" shape.

    Increasing the Clump Interpolation slider spreads the hair out between clumps. This can be used to even out the shape of the hair so that the clumping is much less obvious. Dynamics are calculated based on the position of each clump. If you set a high Clump Interpolation value, you may find that hairs do not appear to collide correctly. This is because the interpolation can push hairs outside the boundary of the original clump width, and thus their placement exceeds the collision width of their clump.

    Interpolation Range sets the limits for how far a hair can move out of the width of the clump when Clump Interpolation is increased. The value set in Interpolation Range is multiplied against the Clump Width setting.

  12. Set Clump Interpolation to 0.3. Leave Interpolation Range set to the default value of 8.

  13. Rewind and play the animation, and make any changes you'd like to the shape of the hair. The length, color, and other properties are further defined in the next section.

  14. To get a better sense of the overall look of the hair, set Simulation Method to All Follicles; then rewind and play the animation (see Figure 15.34).

  15. Save the scene as nancyHair_v04.ma. To see a version of the scene, open the nancyHair_v04.ma scene from the chapter15/scenes folder.

Establish the basic shape of the hair using the settings in the hairSystem1 node.

Figure 15.34. Establish the basic shape of the hair using the settings in the hairSystem1 node.

Style Hair

Once the hair has been set up, there are a number of tools you can use to style the hair. You can use dynamic fields as a hair styling tool, paint follicle properties on the hair, or even manipulate the CVs of control curves.

Start and Rest Positions

Before styling the hair properly, you should create a start position for the hair so that the animation does not start with the hair sticking straight out of the head. This makes styling much easier.

The start position represents the shape of the hair at the start of the simulation. The rest position represents the hair's shape when no forces are acting upon it. These are very similar, but you can distinguish between the two by thinking of it like this: Imagine an animation where a character is jumping up and down and then stops. The animation starts with the character in midair. You want to set the start position to represent what the hair looks like when the character is in midair. Once the character stops jumping and the hair settles, the hair assumes its rest position. For some animations the start and rest positions may look exactly the same; other times, such as in the example described, the start and rest positions look different.

  1. Continue using the scene from the previous section or open the nancyHair_v04.ma scene from the chapter15scenes directory.

  2. Select the hairSystem1 node, and open its Attribute Editor to the hairSystemShape1 node. Set Simulation Method to Dynamic Follicles Only and Display Quality to 50.

  3. Play the animation until the hair has completely settled.

  4. Once the hair has settled, expand the hairSystem1Follicles group in the Outliner, and Shift+click all of the follicle nodes. Choose Hair

    Start and Rest Positions
  5. Set the rest position by choosing Hair

    Start and Rest Positions

    Notice that you can set the start position from the rest position and vice versa. These positions can be changed at any time as you continue to work on the hair and any animations. Notice also that the start and rest positions are applied to the follicles themselves rather than to the hair system. This means you can set start and rest positions for individual follicles if needed.

  6. Rewind the animation. The hair should now be down and relatively motionless at the start of the animation.

    The start and rest positions are actually determined by two sets of curves that drive the follicles. You can activate the visibility of these curves in the Perspective window.

  7. In the Viewport menu, use the Show menu to turn off the visibility of Strokes. This hides the Paint Effects hair.

  8. Select the hairSystem1 node, and choose Hair

    Start and Rest Positions
  9. Choose Hair

    Start and Rest Positions
  10. Save the scene as nancyHair_v05.ma. To see a version of the scene, open the nancyHair_v05.ma scene from the chapter15scenes directory on the DVD.

Paint Follicle Attributes

Using the Artisan Brush interface you can paint follicle attributes. Before doing this you must make sure that the hair is in its rest or start position. Some attributes, such as Inclination, require that the animation be on frame1.

  1. Continue with the scene from the previous section or open the nancyHair_v05.ma scene from the chapter 15scenes directory.

  2. Select the hairSystem1 node and open its Attribute Editor. Switch to the hairSystemShape1 tab, and set Simulation Method to All Follicles. The Display Quality value can be raised to 50.

  3. In the Outliner, select the hairSystem1 node (or the scalp surface). From the Dynamics menu set choose Hair

    Paint Follicle Attributes
  4. The Tool Options area for the Artisan Brush interface opens as well as the Paint Hair Follicles Settings pop-up box.

  5. Set Paint Mode to Trim Hairs. This setting allows you to reduce the length of the hair as you paint across the follicles.

    In order for the dynamics to remain consistent, you must adjust the number of points on the hair as you paint. When you created the hair originally, the Points Per Hair attribute was set to 10, so to trim the length of a hair to half, set Points Per Hair to 5. The Points Per Hair setting is the setting that actually determines how the hair will be trimmed. Whether you set Hair Length to 1,000 or 0.1 and set Points Per Hair to 5, the hair will be trimmed to half the original length regardless of the Hair Length setting.

  6. Set Points Per Hair to 5, and paint across the follicles in the front of the scalp to create bangs for the nancy character (Figure 15.35).

  7. Once you have trimmed the hair, select the follicles in the Outliner (it's easiest just to Shift+click all the follicles rather than figure out which ones were painted) and choose Hair

    Paint Follicle Attributes
  8. To extend the hair, set Paint Mode to Extend Hair, and increase Points Per Hair to a number larger than 10. Remember to reset the rest and start positions after extending the hair.

    The Hair

    Quick Select Follicles

    To paint other attributes set Paint Mode to Edit Follicle Attributes, and choose an attribute from the Follicle Attribute menu. When painting these attributes, the Value setting in the Brush Options area determines the value painted on the follicles.

  9. Save the scene as nancyHair_v06.ma. To see a version of the scene, open the nancyHair_v06.ma scene from the chapter15scenes directory.

Trim the hair at the front of the head using the Paint Hair Follicles tool.

Figure 15.35. Trim the hair at the front of the head using the Paint Hair Follicles tool.

Style Hair with Fields

You can use dynamic fields to style hair. To do this, simply apply a field to a hair system, run the simulation, and then set the rest and/or start position once the hair assumes the desired shape. Follow these steps to create a unique hairstyle for the nancy character.

  1. Continue with the scene from the previous section or open the nancyHair_v06.ma scene from the chapter15scenes directory.

  2. In the Outliner, select hairSystem1. From the Dynamics menu set choose Fields

    Style Hair with Fields
  3. Move the icon for the Newton field above the head, and open its Attribute Editor. In the Attribute Editor, set Magnitude to 100 and Attenuation to 0 (Figure 15.36).

  4. Play the animation. The hair should be sucked up into the field.

  5. After about 100 frames or so, stop the animation. Shift+click the follicles in the Outliner, and choose Hair

    Style Hair with Fields
  6. Delete the Newton field and rewind the scene.

  7. Select the hairSystem1 node and open its Attribute Editor. In the Dynamics section, set the Start Curve Attract attribute to 0.3. This helps the hair maintain its shape when the scene is played.

    If motion continues in some of hairs after the field has been deleted and the start and rest position have been set, try lowering the Stiffness value and raising Iterations. Also changing the Attraction Scale for specific follicles in the Dynamics Override section of the follicle's Attribute Editor can help fix problem areas.

  8. Save the scene as nancyHair_v07.ma. To see a version of the scene, open the nancyHair_v07.ma scene from the chapter15scenes directory on the DVD.

Style the hair using a Newton field.

Figure 15.36. Style the hair using a Newton field.

Modify Curves

You can modify curves directly by moving their CVs or by using the tools in the Hair

Modify Curves

You can modify only start or rest curves. To do this, disable the visibility of Strokes in the scene and choose Hair

Modify Curves

As you are editing the curve, you can lock the length so that the changes you make do not stretch the curve beyond its original length. Select the curve and choose Hair

Modify Curves
Modify the CVs of a start curve using the Move tool.

Figure 15.37. Modify the CVs of a start curve using the Move tool.

Curling, Noise, Sub Clumping, and Braids

Curling, Noise, and Braids all work best when the Sub Segments attribute in the Clump And Hair Shape section of the hair system node is increased. The Curling and Noise settings are found in the Displacement section of the hair system node.

The Sub Clumping setting causes the hair within clumps to bunch together. This helps when creating wet or kinky hair.

The Braid option is available as an attribute for individual hair follicle nodes. For a braid to work successfully, you may need to alter the clump shape and the hairs per clump. Often it may be a good idea to use a separate hair system to create a detailed braid.

Hair Constraints

Hair constraints are another way to shape hair and are a useful tool for making hair follow other objects in the scene, such as rubber bands or ribbons.

Create a Constraint

Constraints are applied to selected follicles, and they work only with active follicles. If you try to apply a constraint to a passive follicle, you get a warning that says no hair curves have been selected for the constraint.

You've already used the collision constraint. When you create a constraint, the position of the constraint is indicated by a locator. The locator's position at the start of the animation determines the constraint's starting position. The position of the constraint on subsequent frames of the animation determines how it pulls the hair relative to its position at the start of the animation.

This exercise demonstrates how to add a constraint to a hair system. The example demonstrates the constraint in a simplified scene, making it easier to see how the different types of constraints affect a hair system.

  1. Open the constraintsStart_v01.ma scene from the chapter15scenes directory.

    This scene has a simple hair system applied to the top of a polygon sphere. The output of the system is curves.

  2. Play the scene until about frame 60. The hair curves at the center of the bunch should be visible and easy to select. Select all the curves at the center, as shown in Figure 15.38.

  3. Rewind the animation while the curves are still selected. Choose Hair

    Create a Constraint
    You can easily select the hair curves at the center of the bunch when the animation is played.

    Figure 15.38. You can easily select the hair curves at the center of the bunch when the animation is played.

    When you move the locator, blue lines appear connecting the hairs to the locator. Since the animation is at frame1, the current position of the locator is the start position of the constraint.

  4. With the Move tool still active, choose Solvers

    You can easily select the hair curves at the center of the bunch when the animation is played.
  5. Rewind the animation and change the position of the locator. Start Interactive Playback again. The position of the locator at the start frame affects how the blue lines are attached to the hairs as well as how the constraint pulls the hairs on subsequent frames.

  6. Select the hairConstraint1 node in the Outliner, and open its Attribute Editor.

You can change how the constraint is attached to the hairs (the position of the blue lines that attaches the constraint to the hairs) by changing the Point Method setting.

The Nearest setting uses the closest distance along the hair to the locator at the start frame of the animation to determine where the constraint is connected to the hairs.

The U Parameter setting allows you to specify the precise U parameter along the length of the curve as the connection point between the constraint and the hairs. The U parameter of the curve ranges between 0 and 1.

As you move the locator, the hairs react to its new position.

Figure 15.39. As you move the locator, the hairs react to its new position.

The U Distance setting defines the distance between the start of the curve and the connection point in U space. So if the curve is six units long, the U distance ranges between 0 and 6.

The two primary controls for hair constraints are Glue Strength and Stiffness. Setting Glue Strength to a value below 1 allows the constraint to be broken depending on the amount of force applied to it during the simulation.

The Stiffness value can be used to determine the amount of influence the constraint has over the hair curves.

You can add as many constraints as you need to a hair system. You can also change which curves are connected by selecting the curves, Ctrl+clicking the constraint, and choosing Hair

As you move the locator, the hairs react to its new position.

Rubber band constraints are somewhat stretchy. The distance between the constraint and the hair on the first frame of the animation establishes the length of the rubber band. If the constraint is moved beyond this length later in the animation, the hairs are pulled toward the constraint.

The stick constraint maintains the initial length of the constraint throughout the animation. If the constraint is moved away from the hairs, it pulls them, and if the constraint is moved closer to the hairs, it pushes the hairs.

Transform is similar to stick in that the constraint both pulls and pushes the hairs. The rotation of transform constraints also affects the hairs.

Hair-to-hair constraints create a clump. To use this constraint properly, play the simulation until some of the hairs are close together; then select the hair curves and create a hair-to-hair constraint. Rewind and play the animation. The hairs are connected by blue lines and should react as if they are bound together. Moving the locator changes the position of the constraints along the hair curves depending on the setting used for Point Method in the constraint properties. Moving the constraint locator around after the initial frame has no effect on how the constraint behaves (see Figure 15.40).

Use a hair-to-hair constraint to bind the ends of selected hairs together.

Figure 15.40. Use a hair-to-hair constraint to bind the ends of selected hairs together.

Hair bunch is a method of simulating self-collision between hairs that is more computationally efficient than the built-in Self Collide feature available in the Collision section of the hairSystem node. This constraint is meant to keep hairs from intersecting one another.

To see a version of the scene with an attached hair constraint, open the constraintsStart_v02.ma scene from the chapter15scenes directory on the DVD.

Render Hair

Rendering hair can be done using Maya Software or mental ray. The hair should be either Paint Effects strokes or Paint Effects strokes converted to geometry. Paint Effects strokes are discussed in detail in Chapter 7.

Color Hair

If you decide to render hair as Paint Effects strokes, you can change the Hair Color, Translucence, and Specular properties using the settings in the hairSystemShape tab's Shading section.

Tips for Rendering Hair

Rendering hair is a very straight-forward process. If you're not familiar with Paint Effects, you should review Chapter 8 before reading this section.

When you convert hair to geometry, the Hair Tube shader is automatically applied. You can render Paint Effects hair using mental ray without the need to convert the hair to geometry.

When you are ready to render the hair, you'll want to increase the Hair Sub Segments setting in the hairSystem's Attribute Editor, as well as the Hairs Per Clump, Hair Width, and Hair Width Scale, in order to create fuller hair. You can always add additional follicles as well using the Paint Follicles tool.

In the Render Stats section of the hairSystem node, you can enable Receive Shadows, Visible In Reflections, and Visible In Refractions when rendering with mental ray.

In the Quality tab of the mental ray render settings, you can use the Rapid Motion Hair preset to render hair without raytracing or the Production: Fine Trace preset for rendering with raytracing.

If the hair will not render using mental ray, make sure the Render Fur/Hair setting is activated in the Features tab of the mental ray Rendering section.

  1. Open the renderHair.ma scene from the chapter15scenes folder on the DVD.

    In this scene the dreads.mel preset, found in the Hair Examples tab of the Visor, is applied to the nancy model. The hairLights.mel file has also been imported from the Visor and applied to the scene.

  2. Switch to the quarterSide camera, and create a test render in the Render View window. The scene is set up to render using mental ray. The render will take a couple minutes (see Figure 15.41).

Most standard lights will render hair nicely. When you're testing out the look of the hair, using the hairLights.mel preset makes it easy to see how the hair will look when rendered.

Apply the dreadlocks preset hair to the nancy model and render it with mental ray.

Figure 15.41. Apply the dreadlocks preset hair to the nancy model and render it with mental ray.

Create Clothing for Characters

Chapter 14 introduced the nCloth dynamic simulation tools in the context of creating advanced simulations with nParticles. As the name suggests, nCloth was originally developed to simulate the dynamic properties of clothing. In this section, you'll explore techniques for using nCloth to add dynamic motion to a character's clothes. The example files are simple, but the same techniques can be used for more complex characters and models.

Before starting this section you should review Chapters 13 and 14 so that you understand how nDynamics and the Nucleus solver work.

Model Clothes for nCloth

The models you create for use with nCloth must be polygon meshes. Beyond that, there is nothing special about how you model your clothing. Smooth mesh polygons work just as well as standard polygons. You'll start by taking a look at an example scene.

  1. Open the simpleMan_v01.ma scene from the chapter15scenes directory on the DVD (see Figure 15.42).

    The simpleMan_v01.ma scene contains a simple cartoon character. Clothes have been modeled using polygons.

    Figure 15.42. The simpleMan_v01.ma scene contains a simple cartoon character. Clothes have been modeled using polygons.

    This scene has a very simple cartoon character who has been rigged and animated. He has a shirt and pants that have both been created using standard polygon modeling techniques. Both objects are currently smooth mesh polygons. The scene has been arranged so that the display layers contain the major components of the model and the animation rig.

  2. Turn off the visibility of the SHIRT and PANTS layers and play the scene. Starting at frame 50 you'll see the man has been animated so that he moves up and down. This is just a simple animation cycle suitable for testing basic nCloth properties.

  3. Rewind and restore the visibility of the PANTS layer. If you select the pants geometry, you'll see it's a basic polygon mesh. Press the 1 key and you'll see the pants as standard nonsmoothed polygons.

Convert Smooth Mesh Polygons to nCloth

You can convert smooth mesh polygons to nCloth objects. When you do this, the smooth mesh polygons switch to standard polygon mode automatically. You can then switch them back to smooth mesh polygons.

  1. Continue with the simpleMan_v01.ma scene from the previous section.

  2. Switch the nDynamics menu set. Select the pants and choose nMesh

    Convert Smooth Mesh Polygons to nCloth
  3. Select the pants and press the 3 key to switch back to smooth mesh polygons.

  4. Play the scene. You'll see the pants fall down (this kind of thing can be embarrassing, but it happens a lot to cartoon characters; see Figure 15.43).

    The first step in preventing the pants from falling is to make the character's body a Passive Collider object. It does not matter that the character is already rigged and animated. However, it's a good idea to convert the polygons to nCloth objects (both nCloth and Passive Collider objects) when the character is in the default pose and there are no intersections between the nCloth and Passive Collider geometry.

    When you play the scene, the character's pants fall down.

    Figure 15.43. When you play the scene, the character's pants fall down.

  5. Rewind the animation. In the Display Layer Editor, click the R next to the MAN layer to turn off Reference mode so you can directly select the man geometry.

  6. Select the man geometry and choose nMesh

    When you play the scene, the character's pants fall down.

    The geometry used for the man is fairly simple. If you have a very complex character, you may want to use a lower-resolution copy of the geometry as a collision object. This lower-resolution copy should have its Primary Visibility setting turned off in the Render Stats section of its Attribute Editor, and the geometry should be skinned to joints or deformers in a way that matches the deformations of the higher-resolution objects.

  7. Rewind and play the scene. The pants still fall down, but they are stopped from falling indefinitely by the character's feet. In the next section you'll create a constraint that will keep his pants from falling down.

  8. Save the scene as simpleMan_v02.ma. To see a version of the scene, open the simpleMan_v02.ma scene from the chapter15scenes directory.

Add a Transform Constraint

The simplest way to keep the character's pants on is to create a transform constraint. A transform constraint attaches the selected vertices on an nCloth object to the pivot point of another object without affecting the position of the nCloth vertices. When the constraining object is translated or rotated, the vertices follow along, dragging the rest of the nCloth object with them.

  1. Continue with the scene from the previous section or open the simpleMan_v02.ma scene from the chapter15scenes directory on the DVD.

  2. Turn off the visibility of the MAN layer, and turn on the visibility of the JOINTS layer.

  3. At the center of the pelvis you'll see a locator. This is the rootControl locator used to animate the character's skeleton. You can use this locator as the constraining object for the nCloth pants.

  4. Right-click on the pants, and choose Edges to switch to edge selection mode.

  5. Double-click on one of the edges at the top of the pants. This selects all the edges that run around the top of the pants (left image, Figure 15.44).

  6. Hold the mouse over the selected edges, press the Ctrl key, and RMB-drag to the left; then select the To Vertices label from the marking menu. This converts the selection to vertices (center image, Figure 15.44).

  7. With the vertices selected (they should be highlighted in yellow) in the Outliner, Ctrl+click the rootCtrl locator and choose nConstraint

    Add a Transform Constraint
  8. Turn the visibility of the MAN layer back on, and play the animation. The pants should now stay in place, and when the man starts moving, they should collide with the character's legs (right image, Figure 15.44).

  9. Save the scene as simpleMan_v03.ma. To see a version of the scene, open the simpleMan_v03.ma scene from the chapter15scenes directory on the DVD.

Select the edges at the top of the pants (left image). Convert the edge selection to vertices (center image). When you constrain the vertices to the rootCtrl locator, the pants stay up and collide with the animated character (right image).

Figure 15.44. Select the edges at the top of the pants (left image). Convert the edge selection to vertices (center image). When you constrain the vertices to the rootCtrl locator, the pants stay up and collide with the animated character (right image).

Use Component Constraints

Components of nCloth objects, such as vertices, can be used as constraints. Using this technique, you can easily simulate the effect of buttons holding a shirt together.

  1. Continue with the scene from the previous section or open the simpleMan_v03.ma scene from the chapter 15scenes directory.

  2. In the Display Layer Editor, turn on the visibility of the SHIRT layer.

  3. Before converting the shirt to an nCloth object, make sure it does not intersect with the pants. Rotate the view so you can see the back of the character; here you can see that the shirt is intersecting the pants (top image, Figure 15.45).

  4. Right-click on the faces near the intersection and choose Faces. Use the Move tool to move the faces outward just enough that they do not intersect the pants (bottom image, Figure 15.45).

    The surface of the shirt intersects the pants in the back of the character. Use the Move tool to move the faces of the shirt outward to fix the problem.

    Figure 15.45. The surface of the shirt intersects the pants in the back of the character. Use the Move tool to move the faces of the shirt outward to fix the problem.

  5. Select the shirt and choose nMesh

    The surface of the shirt intersects the pants in the back of the character. Use the Move tool to move the faces of the shirt outward to fix the problem.
  6. Rewind and play the animation. The shirt falls until it collides with the character geometry. It moves as the character moves; however, you can see the front of the shirt fly open (see Figure 15.46).

    As the character moves, the front of the shirt flies open.

    Figure 15.46. As the character moves, the front of the shirt flies open.

  7. Zoom in to the front of the shirt. Turn off the visibility of the MAN and PANTS display layers. Right-click on the shirt and choose Vertices.

  8. Switch to wireframe mode. Select the two vertices at the top of the shirt close to the collar (Figure 15.47, top image).

  9. Choose nConstraints

    As the character moves, the front of the shirt flies open.
  10. Repeat step 8 and 9 to create constraints for the other three pairs of vertices running down the shirt. You don't need to constrain the two at the very bottom. You should end up with four constraints running down the front of the shirt (Figure 15.47, bottom image).

  11. Switch to shaded mode, turn on the MAN and PANTS layers, and rewind and play the scene. The front of the shirt is now bound as if it has buttons (see Figure 15.48).

  12. Save the scene as simpleMan_v04.ma. To see a version of the scene, open the simpleMan_v04.ma scene from the chapter15scenes directory on the DVD.

Select vertices near the collar and turn them into a constraint (top image). Then create four pairs of constraints on the front of the shirt (bottom image).

Figure 15.47. Select vertices near the collar and turn them into a constraint (top image). Then create four pairs of constraints on the front of the shirt (bottom image).

When you play the animation, the shirt stays closed as if it has buttons.

Figure 15.48. When you play the animation, the shirt stays closed as if it has buttons.

Connect Buttons to the Shirt

There is an interesting technique that you can use to attach objects to polygons. This involves converting a polygon edge to a NURBS curve. The object can then be connected to the curve using a motion path. As long as history is not deleted on the shirt, the curve and the connected object will move with the shirt.

  1. Continue with the scene from the previous section or open the simpleMan_v04.ma scene from the chapter15scenes directory on the DVD.

  2. Zoom in to the front of the shirt.

  3. Right-click on the shirt and choose Edge. Select the edge closest to the top constraint on the shirt.

  4. With the edge selected, choose Modify

    Connect Buttons to the Shirt

    A small curve is created at the position of the selected edge. The curve is listed as polyToCurve1 in the Outliner.

  5. Select the polyToCurve1 curve and choose Modify

    Connect Buttons to the Shirt
  6. Use the Move tool to move the curve out just slightly in front of the shirt.

  7. In the Outliner, select polyToCurve1 and Ctrl+click button1. Switch to the Animation menu set and choose Animate

    Connect Buttons to the Shirt
  8. In the options, set Time Range to Start. Click Attach to make the motion path. The button appears at the position of the curve (center image, Figure 15.49).

    Why not parent constrain the button to the curve? The reason a motion path works better than a constraint in this situation is that the curve's transform node does not update as the shirt animates. The history that connects the shirt to the curve acts only on the curve's shape node. So if you constrain the button to the curve, the button will not move with the shirt even though the curve appears to.

    Rewind and play the animation. The button moves with the shirt, but notice that the rotation of the button is incorrect. To fix this you can use a normal constraint.

  9. Select the shirt and Ctrl+click button1. From the Animation menu set choose Constrain

    Connect Buttons to the Shirt
  10. In the Options box for the normal constraint, choose Edit

    Connect Buttons to the Shirt
  11. Click Apply to create the constraint.

  12. Rewind and play the animation. The button now moves with the shirt and rotates to align itself correctly with the surface of the shirt.

    This method works pretty well. However, if the camera is close, you may need to make some adjustments to the position of the curve, as the button may intersect with the shirt from time to time.

  13. Repeat these steps to attach the other buttons to the shirt (bottom image, Figure 15.49).

  14. Save the scene as simpleMan_v05.ma. To see a version of the scene, open the simpleMan_v05.ma scene from the chapter15scenes directory on the DVD.

Convert an edge of the shirt geometry into a curve (top image). Attach a button to the curve using a motion path (center image). Then add more buttons to the shirt (bottom image).

Figure 15.49. Convert an edge of the shirt geometry into a curve (top image). Attach a button to the curve using a motion path (center image). Then add more buttons to the shirt (bottom image).

Paint nCloth Properties

nCloth properties, such as Bounce, Stretch, and Wrinkle, can be painted onto an nCloth object. There are two ways to do this: vertex property maps and texture property maps.

When you paint a vertex property map, you paint property values directly onto the vertices of the object, similar to painting smooth skin weights for joints. The more vertices you have in your object, the more detail you can create for your vertex property map. The vertex map values are saved with the object, so you do not need to link to external map files.

Texture property maps are independent of the number of vertices in the object, but they do require that UVs are properly created for the object, meaning that the UVs do not overlap and remain within the 0 to 1 range in the UV Texture Editor. Texture property maps for nCloth objects are very similar to texture property maps created for fur (this was demonstrated earlier in the chapter). However, you do not need to bake the maps after applying them.

When you paint a vertex or texture map, the map is listed in the Attribute field in the Dynamic Properties section of the nCloth shape node's Attribute Editor.

Paint a Vertex Property Map

In this example you'll paint Wrinkle attributes for the simple man character's pants. A wrinkle map displaces an nCloth object to create folds in the surface. You can paint detailed wrinkles into objects with a lot of vertices. In this example, the wrinkle map will be used to add cartoonish embellishments to the pants, which have a fairly low number of vertices.

When applying a Wrinkle attribute, positive values push the nCloth outward, while negative values push inward. There are a few peculiarities about painting Wrinkle values, which we'll explore in this lesson.

  1. Continue with the scene from the previous section or open the simpleMan_v05.ma scene from the chapter15scenes directory.

  2. Turn off the visibility of the SHIRT and JOINTS layers.

  3. Rewind and play the animation. The pants maintain their shape until they start to collide.

  4. Rewind the animation again, select the pants object, and choose (from the nDynamics menu set) nMesh

    Paint a Vertex Property Map

    The pants turn white, indicating that a value of 1 is applied to the vertices of the pants for the Wrinkle property.

  5. Rewind and play the animation. The pants suddenly bloat outward, even though you have not made any changes. What just happened (left image, Figure 15.50)?

    When you start to create the wrinkle map, Maya applies a value of 1 to all the vertices of the object at the moment the map is created. Prior to creating the wrinkle map, no Wrinkle value is applied to the pants, so they do not bloat outward until the map is made. This behavior is specific to the wrinkle map.

  6. Open the Tool Options box and set the value to 0. Click the Flood button and rewind the animation.

    The pants turn black and the bloating disappears. The wrinkle values are now set to 0 for all the vertices of the pants geometry (right image, Figure 15.50).

    When you create the wrinkle map and play the animation, the pants bloat outward. When you apply the value 0 to all the vertices, the pants turn black and the shape returns to normal.

    Figure 15.50. When you create the wrinkle map and play the animation, the pants bloat outward. When you apply the value 0 to all the vertices, the pants turn black and the shape returns to normal.

    At this point you'll paint the area where the pant legs emerge from the pants with a value of −0.2 so that the pant legs shrink inward. Notice, however, that the Value slider in the Artisan Tool options only goes from 0 to 1.

  7. In the Tool Options box, set Min Value to −1 and Max Value to 1.

    Now it is possible to paint negative numbers, but you'll notice that since the black color on the pants indicates a value of 0, there is no color feedback for negative numbers. This can be changed as well.

  8. Scroll down to the bottom of the Tool Options box and expand the Display rollout. Make sure Color Feedback is on. Set Min Color to −1 and Max Color to 1 (see Figure 15.51).

    The Min/Max value fileds can be adjusted to allow for a wider range of values for the Paint nCloth Attributes tool. Adjusting the Min Color and Max Color sliders allows you to visualize the new values painted on the surface.

    Figure 15.51. The Min/Max value fileds can be adjusted to allow for a wider range of values for the Paint nCloth Attributes tool. Adjusting the Min Color and Max Color sliders allows you to visualize the new values painted on the surface.

    The pants turn gray, indicating that the current value applied to the vertices (0) is in the middle range of colors between black and white. As you paint negative values on the pants, you'll see darker areas appear.

  9. Set the Value slider to −0.2, and paint around the area where the pant legs meet the pants (see Figure 15.52).

    Paint a value of −0.2 around the belt area of the pants. Paint positive values near the pant cuffs to create flares.

    Figure 15.52. Paint a value of −0.2 around the belt area of the pants. Paint positive values near the pant cuffs to create flares.

  10. Rewind and play the scene. You'll see the tops of the pant legs shrink in a little.

  11. To create flares (flares on shorts are apparently all the rage now), set the value to 0.4, and paint the cuffs of the pants.

  12. To create the impression of a drawstring, paint a value of −1 around the area of the pants where a belt would go.

  13. Press the q hot key to switch to the Select tool. Doing this will close the Artisan tool; the pants return to green. Rewind and play the animation. Experiment making more changes by painting various Wrinkle values on the pants.

  14. Save the scene as simpleMan_v06.ma. To see a version of the scene, open the simpleMan_v06.ma scene from the chapter15scenes directory.

The Bottom Line

Add fur to characters

Maya Fur is a rendering module that adds realistic short hairs to the surface of characters to simulate fur. Fur can be rendered using both Maya Software and mental ray. The placement, length, and other attributes of fur can be controlled by painting on the surface with the Artisan tool interface. When adding fur to polygons, the success of the fur is largely dependent on how well the UV texture coordinates have been mapped.

Master it

Create furry whiskers for the old man model used in Chapter 11.

Add dynamic motion to fur

Using hair curves as a control, fur can be made to react to dynamic forces.

Master it

Create a field of grass that blows in the wind.

Render fur with mental ray

Fur can be rendered using mental ray or Maya Software. The Rapid Fur mental ray Quality preset works well when rendering fur with depth map shadows. The Fine Trace mental ray Quality preset works well when rendering with mental ray and ray trace shadows and reflections.

Master it

Add a Physical Sun and Sky network to the hound dog scene, and render with mental ray.

Create dynamic curves

A standard Maya curve can be made dynamic by using the Make Dynamic Curves action in the Hair menu. A copy of the curve is created that will respond to dynamic motion and forces. The curve can be used in skeletons for IK Spline tools, as a source for Paint Effects strokes, as a modeling tool, or for any other effect that requires curves.

Master it

Create a flag using dynamic curves.

Add hair to characters

Hair is created using Paint Effects strokes that are controlled by follicles. The follicles are dynamic curves that respond to forces and movement. Follicles can be applied to polygon or NURBS surfaces as a grid or by painting on the surface. The Visor contains a number of hair presets that can be imported into a scene.

Master it

Add hair to the old man character from Chapter 9.

Style hair

Hair can be styled by painting attribute values on follicles, by using dynamic fields, or by directly editing the CVs of start or rest curves.

Master it

Create an avant-garde hairdo for the nancy character using fields.

Use hair constraints

Hair constraints can be used to control the motion of hair or to connect the hair to props, such as hair ties and scrunchies.

Master it

Use a constraint to create a ponytail for a character.

Render hair

Hair can be rendered using mental ray or Maya. You can render as Paint Effects strokes or convert the strokes to geometry. Either method works in both Maya Software and mental ray (in spite of the fact that Paint Effects cannot normally render in mental ray).

Master it

Apply the Hair preset examples found in the Visor to a character, and render with mental ray.

Create clothing for characters

Clothing is created by converting polygon geometry to an nCloth object. The object can be attached to a character using constraints.

Master it

Create sweatpants and a sweatshirt with a hood for the simple man character.

Paint nCloth properties

Properties such as Bounce, Stretch, and Wrinkle can be painted onto nCloth objects using either texture or vertex painting techniques. When painting properties, the Min and Max Value ranges in the Artisan interface may need to be altered to allow for values beyond the range of 0 to 1. Vertex maps have the advantage that the values are not stored in an external texture file.

Master it

Add starch to the simple man's shirt by painting a Rigidity value on the shirt geometry.

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

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