Maya Hair

Maya Hair is an extension of Maya

Paint Effects that is designed to make long hair and short hair dynamics. Maya Hair can also be used for other long strand dynamics, such as ropes or cables. Its base is a dynamically simulated NURBS curve, so it can be applied for numerous effects. Previously, the process of setting up a dynamically simulated NURBS curve had to be done manually. Currently, Maya Hair automates much of the workflow for complex hair dynamics. This chapter primarily focuses on creating realistic hair dynamics for a character such as the hair shown in Figure 25-1.

Maya Tutorial Realistic Hair
FIGURE 25-1 Hair as it is rendered in the view window

Using Hair

Maya Hair grows out of a base surface and comes with a default dynamics system. Your task is to modify various hair attributes to find the best setting for a particular kind of hair you are making, create a collision object so that the hair won't penetrate through the base surface, edit a shape of the start/rest curve to regulate the flow of the hair, and finally tweak the rendering of the hair.

Since Maya is designed with dozens of preset hair styles, let's first use these presets to see how Maya Hair actually works.

Hair Overview: Maya Hair Presets

Using Maya Hair presets is a good way to familiarize yourself with how Maya Hair is constructed and utilized. It also comes with a skull model, so you don't need to construct one yourself. Some hair styles are more complex than others. A few come with collision surfaces, so you can see how various hair styles react. These hair styles can be easily transferred to other surfaces, so you can use them for your own characters later.

  1. Start Maya, set Menu Set to Dynamics, and choose Hair | Get Hair Example. The visor opens and you will see a variety of hair style examples available.
  2. Select StraightLongHilight.ma and MMB-drag the icon into the Maya Workspace. Close the visor window.
  3. This is the typical setup for long hair. Open the Outliner and check out what's there. It features three primary components:
  • hairBase The surface from which the hair grows. All the hair extends out of this surface along the surface normals and reacts to the animation of this base surface. It is usually a good idea to construct separate geometry for hair since you can easily limit and paint where the hair should be. The surface can be either NURBS or polygon objects. There is also a way to grow hair out of particular UV sets of polygon objects.
  • pfxHair1 A Paint Effects node to represent actual hair. When you create hair, you have a choice of outputting hair as this Paint Effects node, outputting it as NURBS curves, or both. pfxHair comes with various Paint Effects attributes, such as hairSystemShape. Open the Attribute Editor and click the tab called hairSystemShape1. By adjusting this node, you can change the general color, the way in which hair follows the curve, the width of the hair, etc. Paint Effects hair can only be rendered with the Maya software renderer. To render in other renderers, you'll need to convert Paint Effects hair to polygons in the case of Mental Ray, for example, or simply output dynamically simulated NURBS curves for a renderer like Pixar's Renderman. More information about this topic follows in later chapters.
  • hairLineFollicles Representations showing from where the hair grows. You can actually paint these follicles to add/erase on a base surface. Open the Attribute Editor and click hairLineFollicleShape. This is the follicleShape node, which allows you to edit the hair's appearance per individual follicle. Dynamic follicles (or just follicles) are represented in red and passive follicles are represented in blue. Dynamic follicles come with fully simulated dynamic curves, so they accurately interact with forces and collisions. Passive follicles don't have fully simulated curves, so they instead average neighboring curves to determine their animation. Passive follicles are superior in terms of speed, but dynamic follicles are necessary for more realistic motion.

4. To see the effect of hair dynamics, select hairBase and create a quick animation. Try adding a quick translation and rotation and then play it back to see how the hair reacts. Figure 25-2 shows the hair template after it has been dynamically simulated.

Hair Templates
FIGURE 25-2 Maya's hair templates

5. Check how the rendering of Paint Effects hair looks by framing a full view of the hair in a perspective view and then rendering it. Use Render the Current Frame at the top right of the interface for a quick Maya software render

Next, let's try making our own hair system from scratch.

Tutorial: Creating Hair from Scratch

In this tutorial, we will create hair from scratch. There are approximately five steps to consider when creating a hair system:

  1. Draw a hair style that you wish to create using pen and paper. It is much easier to achieve your goal if you first create a visual representation of it. Sketching also points out possible problems before you tackle the project. The more you learn about Maya Hair, the more you'll understand how crucial this process is to achieving better results.
  2. We need to construct a hair base surface. This can be a NURBS or polygon surface that is extracted from the actual head model by copying and deleting the face portions. If you are using polygons, make sure their UVs fit within 0 to 1 and that they are not on top of each other. You may also make a separate UV set and apply the hair to only that UV set. The hair system will follow this surface for dynamics simulation.
  3. Apply the hair to the surface by automatically spreading the hair follicles to the entire base surface, or by painting the hair follicles yourself. Painting the follicles yourself gives you more control over the process. The density and number of follicles can be edited by painting the follicles directly to the base surface later as well. For this tutorial, we will use the automatic method and then paint some attributes.
  4. Adjust the hair by scaling and adding more follicles. Create a collision object so that the hair stays away from the face. When you create hair, it comes with start and rest curves, which are both NURBS curves. A start curve represents where the hair begins, and a rest curve determines how the hair appears when there is no dynamic motion to the hair. It's like the "goal" or target for the hair. By editing these curves to desirable shapes, you can comb the hair. Next, tweak the hairShape node to change attributes such as the amount of clump hair, clump width, hair color, etc. for the final adjustment.
  5. Render the Paint Effects hair using the Maya software renderer.

Create a hairBase Surface

First you need to create a base surface for the head. For this tutorial, we have a polygon head already modeled. Copy this head model and erase the poly faces where the hair isn't needed.

Open a scene called mcr8_ch25_hair_01.ma in the Chapter 25 folder on the DVD. It comes with a character's head, eyeballs, and skeleton (in template mode) for the animation of the head.

Select the head surface and duplicate it. Make sure that none of the options are turned on in the Duplicate option except for the Geometry Type, which should be set to Copy, and the Group, which should be set to Parent. Name the newly duplicated surface hairBase.

Create a new layer in the Layer Editor and name it hairBase_layer. Add only hairBase to the layer.

In the Layer Editor, make buukla_head_layer invisible by clicking V in the display option.

Select hairBase and go to the face selection mode. Delete the faces where the hair won't be growing. Mainly, the front face, jaw, neck, and ears have to be deleted. Think of it as a wig. Make sure to leave an area around the sideburns.

A very important step before applying hair to the hairBase surface is creating a UV that fits within 0 to 1. Select the hairBase surface and choose Window | UV Texture Editor.

Currently there is no UV created for this object. Change to the Polygon menu set and choose Create UVs | Spherical Mapping. The UV should appear on the UV Texture Editor. LMB-drag the blue corner of the scale manipulator and make the UVs fit within the color 0 to 1 area. You may need to pick some UVs individually to fit within the 0 to 1 area. For more information on the UV Texture Editor, refer to Chapter 18.

Bind the hairBase surface with the joint2 skeleton, so that the wig follows the head animation. Take off the joint from template mode by clicking T twice for "skeleton," so it is showing an empty box (make sure that it isn't showing an R). Select hairBase and joint2 (second joint from the bottom) and choose Skin | Bind Skin | Smooth Bind □ in the Animation menu set. Set the Bind To option to "Selected joints" and click Bind Skin. The bound scalp should look like this illustration.

Apply Hair to the hairBase Surface

Next, we will add some hair systems to the hairBase surface using an automatic method. We'll make final tweaks later.

  1. Select the hairBase surface and, in the Dynamic menu set, choose Hair | Create Hair □. The Create Hair Option window will open.
  2. The Output option determines which type of hair will be created after creating hairs. There are three main options:

• Paint Effects Creates Paint Effects brush strokes on the hair curves. This method works well if your final output is rendered in the Maya software renderer since other renderers won't support Paint Effects. (You can still explore this and convert Paint Effects to a polygon surface in the end, so that other renderers will work with it.) The Paint Effects option also creates a pfxHair node, which has many attributes that change how hair appears.

Parent Constraint Nurbs Hair Maya

Maya Hair

  • NURBS Curves Outputs dynamic NURBS curves only. You can extrude a circle to make the hair or use a renderer that supports curves in order to render in many other renderers. This is also a good method if you are not designing hair, but are instead creating a dynamic NURBS curves system.
  • Paint Effects and NURBS Curves Allows you to use both of the preceding options just in case you may be using two different renderers or need the curves to interact with other objects in the scene.

For this tutorial, let's use the Paint Effects output option.

3. After you select the Paint Effect option, adjust the following attributes:

  • Create Rest Curves Makes a variety of curves for hair in rested positions. Turn it on.
  • Grid Places follicles in regular intervals. Turn it on. The At Selected Points/Faces check box enables you to add follicles in only selected points and faces. This is a good method to add more localized hair.
  • U Count and V Count Determines how many follicles are created. Set them to 15 and 15.
  • Passive Fill Adds more hair between active dynamic hairs. It's a good way to give more volume to the hair without making the entire system too heavy. Set the value to 0 for now. You can add more hair follicles later on by interactively painting them in.
  • Randomization Gives random placement of follicles; 0 means no randomization. Change it to 1.
  • Edge Bounded Makes the follicles right on the line of UV parameters. Keep this unchecked.
  • Equalize Smoothes out uneven UV space, so that the follicles are not bunched up in one place. Keep it unchecked.
  • Dynamic and Static Lets you decide whether the hair should be dynamically driven. Keep this set to Dynamic. We want to simulate the hair with gravity and movement of hairBase.
  • Points Per Hair Determines how many segments are on the hair. The greater the number of points, the smoother the hair will be. Usually, longer hair requires more segments to be smoother. 10 might be a good number.
  • Length Determines how long the hair will be. The number corresponds with Maya units. Keep this value at 5.
  • Place Hairs Into Determines how you want to place the hair in a new system or pre-existing system. Choose New Hair System.
  1. Click the Create Hairs button.
  2. Hair grows right out of the hairBase surface. Click the Play button in Playback Controls to see how the dynamics work. It should close to rest in frame 190 or so.
  3. Turn on buukla_head geometry's visibility and try rendering by clicking Render the Current Frame button for Maya Software. The image here shows what the hair render looks like.

Adjust Hair Dynamics

There are numerous ways to adjust hair dynamics:

Adjust hair length First of all, the hair is a bit too long. There is a very easy tool to adjust hair length called the Scale Hair tool. Go to frame 1, select hair, and choose Hair | Scale Hair Tool. LMB-dragging left and right changes the hair length. Make it about half as long. It's pretty important to go to frame 1, because otherwise the scaling effect will not appear correctly on the screen.

Add more hair The easiest way to add hair is by painting follicles directly on the hairBase surface. Select hairBase and choose Hair | Paint Hair Follicles □. The Paint Hair Follicles options window and Paint Scripts Tool settings should open.

Create passive follicles Passive follicles get dynamics information from active follicles close by. Adding passive follicles is much less calculation intensive than adding active follicles. Return to frame 1Set Paint Mode to Create Passive Follicles, set Follicle Density to 10 in both U and V, set Points Per Hair to 8, and set Hair Length to around 0.5. Adjust the brush size in the Paint Scripts Tool settings by changing Radius U to 0.1, and paint passive follicles on the hairBase geometry. This tool allows you to adjust hair in many other ways, such as creating active follicles with the Create Follicles option, or deleting follicles with the Delete Follicles option. You can also adjust individual attributes for follicles or trim and extend hairs.

Create hair collision constraints If you play with the hair dynamics now, the hair noticeably penetrates through the face. Next, let's make the hair collide with collision

EE 0

hair constraints so that the hair will not penetrate. Open the Outliner and select hairSystemlFollicles. To apply collision hair constraints, you need to select actual follicles as a whole or an individual follicle. Choose Hair | Create Constraint | Collide Sphere. The Outliner will show a new node called hairConstraintl. Go to wireframe mode in the Workspace to reveal the spherical object. This is the volume sphere collision object. Scale and translate this object to make it look like a skull inside the head. Play the dynamics and see how the collision works. The upper side of the head is now covered with this collision sphere. For this collision sphere to move with the head, select the hairConstraintl node in the Outliner, shift-select hairBase, and choose Edit | Parent. You can have several of these collision hair constraint objects to achieve more accurate collision with the face. Another method of making actual head geometry as a collision object is by selecting buukla_head geometry, shift-selecting hair, and choosing Hair | Make Collide. But collision hair constraints are much faster and stable compared to colliding with a geometry.

• Using Rest Curves Some of the hair is in front of the character's face and blocking its view. We can "comb" the hair by adjusting Rest Curves. Rest curves are the goal shape for the hair. When hair isn't dynamically simulating, it will try to conform to this shape. You can see rest curves by choosing Hair | Display | Rest Position. They will be extending out from the head. They are NURBS curves with ten vertices. They are ten points because when we created the hair system in the beginning, we set the Point Per Hair option to 10. By the way, Start Curves is the starting position of the hair simulation, and Current Position is the hair's real position.

Now, let's comb the hair:

  1. It would be too labor intensive to bend each rest curve one by one, so there is a shortcut to make all of the rest curves bend at once. Play the simulation until 50 frames or so. Select the hair and choose Hair | Set Rest Position | From Current. This will bend the entire rest curve to the current curve's position. You will need to switch between Rest Curve and Current Position display to do this.
  2. Select the rest curve in front of the character's forehead. Go to component mode and bend the rest curve slightly to the right side of the screen by moving the points around, so it appears combed. Click the Play button to see if the hair follows the rest curve. It probably won't since some attributes' settings are making the hair too relaxed to follow the rest curve. Those attributes are hairSystemShapel node's Iterations and Stiffness attributes.
  3. Select hair and open the Attribute Editor. Click the hairSystemShapel tab. Scroll down to Dynamics. Set Iteration to around 50 and Stiffness to 1. When you play the simulation, the hair that belongs to the rest curve now should follow the shape of the rest curve. Modify the hair curve all around the head to give direction to the character's hair style. Rendering the image, shown here, should return a much better result than our initial attempt.
Maya Outliner Icon Overview

Summary

Dynamically simulated hair used to be a very difficult effect to create. But thanks to Maya Hair, almost anyone can achieve realistic hair motion. However, there are many attributes to adjust and lots of tweaks are necessary to make a perfect simulation. Practice creating various kinds of hair styles to familiarize yourself with the attributes that control the dynamics and visual appearance of hair. Also, don't forget that you can use Maya Hair for many other curve-based effects.

+1 0

Average user rating: 5 stars out of 1 votes

Post a comment

  • Receive news updates via email from this site