The Autodesk® Maya® software 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.
In this chapter, you will learn to
XGen is an arbitrary primitive generator. With XGen, you can place any number of primitive objects in a scene. Regardless of the type of object you use, XGen gives you the ability to control attributes such as size and shape. Using XGen, you can create grass, hair, or even an entire forest.
XGen works by creating primitives. A primitive can be a spline, sphere, card, or archive. (An archive is a polygon object that has been saved previously.) Primitives cannot be manipulated individually. Instead, you control primitives through guides, attributes, and expressions. This allows you to make changes to thousands, or even millions of primitives at once. Figure 14.1 shows the window used for controlling XGen.
There are four major components to XGen:
Descriptions These are the core of any XGen endeavor. A description is used to define everything about the look of the primitive. Multiple descriptions can be added to a polygon surface. They can also be saved and reused on different objects.
Patches Patches are attached to polygon faces, and they let the description know where and how to place the primitives. Patches are identified with a magenta X that is placed in the center of the polygon face to which it is connected. There are no attributes that you can modify in a patch.
Collections Descriptions are always placed within a collection, and collections are used to organize your descriptions. They create external folders in your project directory to keep the numerous associated description files from conflicting with other descriptions.
Guides Guides are representations of what your primitive objects will look like. Some guides can be selected and shaped. Shaping the guide is preferable when dealing with long hair.
XGen uses Ptex texture maps to store attribute information about your description. Most importantly, it uses Ptex texture maps to place your primitives on a polygon surface. As a result, your geometry does not need UVs to work with an XGen description.
The first step in using XGen is to create a description. Descriptions can be added to polygon surfaces or selected faces. In this exercise, you’ll build a description to define hair for a character’s head.
hairstyle_v01.ma
scene from the chapter14scenes
folder at the book’s web page, www.sybex.com/go/masteringmaya2016
.hairstyle_v02.ma
.To see a version of the scene, open the hairstyle_v02.ma
scene from the chapter14scenes
folder.
The XGen Library allows you to store hair and fur presets into an organized window. It works by creating an .xgp
file, which is a text document that contains the settings specific to your preset. Maya stores the preset and its corresponding files in a library folder under the Maya install directory. You can, however, create your own folder and add its path to the XGen Library. You can access the library from the Generate drop-down menu. Figure 14.9 shows the XGen Library window.
Maya 2016 comes with numerous preset descriptions in the XGen Library. These descriptions are a valuable resource from which you can start a new description or to analyze the preset’s properties to learn different techniques. Figure 14.9 shows the included presets.
Adding a preset to your geometry is a simple task. The following steps take you through the process:
When a description is created, Maya automatically assigns a mental ray® xgen_hair_physical shader based on Marschner’s hair shading technique. You can view the shader in Viewport 2.0 to see both color and lighting effects. Before visualizing the shader, you want to make sure that you have enough primitives to render. The next exercise takes you through the steps to render your character’s hairstyle:
hairstyle_v02
.ma
scene from the chapter14scenes
folder.The eyeball icon or preview button changes, and a check appears under the eye. You will also notice that primitive splines now cover the character’s head (see Figure 14.12).
The splines match the guide’s shape and position. However, they do not match the width. Under the Settings rollout, change Width to 0.01. Click the Preview button to see your changes.
Zoom in close to a few primitive strands of hair. The splines are tubular. Their start width is the same as their end width. To taper the hair, choose the Primitives tab. Under the Primitives Attributes rollout, set Taper to 0.7 and Taper Start to 0.5. Update the preview to see the results (see Figure 14.13).
To see a version of the scene, open the hairstyle_v03.ma
scene from the chapter14scenes
folder. To learn more about XGen, you can watch the movies in the chapter14movies
folder.
Dynamic curves are NURBS curves driven by the Nucleus dynamic simulation framework. The primary use of dynamic curves is to drive the dynamics of nHair systems applied to characters. They can also be used to drive fur. 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. 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. In addition, with all simulation, make sure to set the Playback Speed to Play every frame. To do so, follow these steps:
In Chapter 5, “Rigging and Muscle Systems,” 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 14.16).
armoredTail_v01.ma
scene from the chapter14scenes
folder at the book’s web page.Press Enter 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 Curves ➣ Rebuild command. In the options, specify how many spans you want to add to the curve. In this example, the curve should work fine with only four CVs.
Switch to the FX menu set. Select curve1, and choose nHair ➣ Make Selected Curves Dynamic. In the Outliner, a new hairSystem1 node is created, as are two groups: hairSystem1Follicles and hairSystem1OutputCurves (see Figure 14.17).
In the Stiffness Scale rollout panel under Dynamic Properties, set the Selected value to 0 and play the scene. You’ll see the dynamic curve droop a little. As the scene is playing, set the Stretch Resistance value under the Dynamic Properties rollout to 0.1.
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 decrease the Stretch Resistance 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 Nucleus solver controls the gravity, as discussed in Chapter 12, “Introducing nParticles.”
You’ll notice that both ends of the curve appear to be attached to the original curve (see Figure 14.18).
Under the Follicle Attributes rollout, set Point Lock to Base. Choose Interactive Playback, and move the follicle around again. Interactive Playback will continue until the simulation reaches end of the timeline. 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.
Select Auto Keyframe; go to various points in the animation, and move and rotate the follicle.
While Auto Keyframe is selected, 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 around in the scene like a sword slashing through the air.
armoredTail_v02.ma
.To see a version of the scene, open the armoredTail_v02.ma
scene from the chapter14scenes
folder.
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.
armoredTail_v02.ma
scene from the chapter14scenes
folder.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 (curve4) will move out of the hairSystem1OutputCurves group. That should not affect how the curve behaves.
Expand the Dynamic Properties and Stiffness Scale sections.
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.
armoredTail_v03.ma
.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.
To see a version of the scene, open the armoredTail_v03.ma
file from the chapter14scenes
folder.
The settings in the Forces section add 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 that you can see how they affect the motion of the tail.
Mass Affects the motion of the curve only when additional fields (created from the FX 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.
Drag Creates friction between the dynamic curve and the air. Increasing this value is a good way to simulate the motion of hair in thick fluids.
Tangential Drag Applies a resistance along the direction of the hair curve shape. Increasing this value is also a good way to simulate the motion of hair in thick fluids.
Motion Drag Similar to Drag. However, Motion Drag 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 setting can be used to fine-tune the motion of the dynamic curve.
Damp Used most often to control erratic motion of dynamic curves. Higher Damp values decrease the momentum of the curve as it follows the motion of the follicle.
Stretch Damp Used most often to control erratic motion of dynamic curves. Higher Damp values decrease the momentum of the curve as it follows the motion of the follicle.
Dynamics Weight Controls the amount of overall influence external dynamic fields (such as Turbulence and Drag) have over the dynamic curve. It does not influence how the Forces settings in the hairSystem node affect the dynamic curve.
Maya offers two methods for adding hair to a character, XGen and nHair. If you plan on animating the hair, you will have to connect your XGen guides to an nHair system. This section focuses on using nHair to build a head of hair. To learn how to use XGen for creating hair, watch the movies in the chapter14movies
folder. You should complete this section before creating XGen hair.
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 engines such as Pixar’s RenderMan® or creating 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.
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 approach 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, whereas another system may be 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.
The following procedure uses a rigged character head. 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 you use 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.
nancyHair_v01.ma
scene from the chapter14scenes
folder.In the scalpShape tab, expand the Render Stats section; then deselect Casts Shadows, Receive Shadows, Motion Blur, and Primary Visibility so that the surface will not render or affect any other geometry in the render.
For the scalp, you’ll create a simple grid and then add follicles if needed later.
Select 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 that 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.
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 14.21 shows the settings for the new hair.
nancyHair_v02.ma
.To see a version of the scene, open the nancyHair_v02.ma
scene from the chapter14scenes
folder.
In the next section, you’ll learn how to style the hair.
A number of settings in the hair system node determine the look of the hair. These are found in the Clump and Hair Shape section of the hair system’s attributes.
nancyHair_v03
.ma
scene from the chapter14scenes
folder.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.
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.
In the Clump and Hair Shape rollout, you can use the following settings to determine the look of the hair:
Baldness Map 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.
Sub Segments Use this setting to improve the details of the hair (such as curls and kinks) when rendered. Increasing this setting does not affect the dynamics of the hair.
Thinning Higher values decrease the number of hairs per clump to create a thin and wispy look to the hair.
Clump Twist This setting 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. Twisting the clump rotates all of the hairs uniformly. If you like the way the hair looks on one side of the clump, you can use the clump twist to rotate the preferred side toward the camera.
Bend Follow This setting 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.
Hair Width Hair Width adjusts the width of the hairs. This setting 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 that you have already created. The following describes how each ramp affects the look of the hair:
Clump and Hair Width Scale 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.
Clump Curl 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 or down (moving up creates values closer to 1; moving down creates values closer to 0), the curling twists in one direction or the other (see Figure 14.23).
Clump Flatness 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.
The final two settings in this section are sliders labeled Clump Interpolation and Interpolation Range:
Clump Interpolation Increasing the Clump Interpolation slider spreads the hair out between clumps. This slider 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 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.
nancyHair_v03.ma
.To see a version of the scene, open the nancyHair_v03.ma
scene from the chapter14/scenes
folder.
Once the hair has been set up, you can use a number of tools to style it. You can use dynamic fields as a hair-styling tool, paint follicle properties on the hair, or even manipulate the CVs of control curves.
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. Doing so 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; at other times, such as in the example described, the start and rest positions look different.
nancyHair_v03.ma
scene from the chapter14scenes
folder.Rewind the animation. The hair should now be down and relatively motionless at the start of the animation.
The start and rest positions are determined by two sets of curves that drive the follicles. You can activate the visibility of these curves in the Perspective window.
nancyHair_v04.ma
.To see a version of the scene, open the nancyHair_v04.ma
scene from the chapter14scenes
folder at the book’s web page.
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.
nancyHair_v04.ma
scene from the chapter14scenes
folder.From the FX menu set, choose nHair ➣ Paint Hair Follicles ➣ ❒.
The Tool Options area for the Artisan Brush interface opens as well as the Paint Hair Follicles Settings pop-up box.
Set Paint Mode to Trim Hairs. This setting allows you to reduce the length of the hair as you paint across the follicles.
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 by half, set Points Per Hair to 5. The Points Per Hair setting determines how the hair will be trimmed. When you set Points Per Hair to 5, the hair will be trimmed to half the original length regardless of the Hair Length setting.
To extend the hair, set Paint Mode to Extend Hairs, and increase Points Per Hair to a number larger than 10. Remember to reset the rest and start positions after extending the hair.
You can use the nHair ➣ Scale Hair Tool to apply global scaling to the hair. To use this tool, select it from the nHair menu and drag left or right. This tool will scale all aspects of the hair, so some adjustment to the shape and dynamics settings may be required after using the tool.
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 Paint Attributes area of the Artisan Brush interface determines the value painted on the follicles.
nancyHair_v05.ma
.To see a version of the scene, open the nancyHair_v05.ma
scene from the chapter14scenes
folder.
You can modify curves directly by moving their CVs or by using the tools in the nHair ➣ Modify Curves menu. By modifying curves directly, you can fine-tune a style.
You can modify only start or rest curves. To do this, use the Show menu in the viewport window to disable the visibility of strokes in the scene, and choose nHair ➣ Display ➣ Rest Position (or Start Position). Select the curve (or right-click the curve and choose Control Vertex to work just on selected CVs), and apply one of the actions listed in the nHair ➣ Modify Curves menu. You can also edit the shape of the curve directly using the Move tool to change the position of CVs on the curve (see Figure 14.26).
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 nHair ➣ Modify Curves ➣ Lock Length (or use the l hot key). Conversely, you can unlock the curve if you want to change its length.
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. You can find the Curl and Noise settings in the Displacements section of the hairSystemShape node.
The Sub Clumping setting causes the hair within clumps to bunch together. This helps when you are creating wet or kinky hair.
The Braid option is available as an attribute for individual hair follicle nodes. It is located on the follicleShape node under the Follicle Attributes rollout. For a braid to work successfully, you may need to alter the clump shape and the Hairs Per Clump. It may be a good idea to use a separate hair system to create a detailed braid.
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 10, “Paint Effects.”
Rendering hair is a straightforward process. If you’re not familiar with Paint Effects, you should review Chapter 10 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’s Sub Segments setting in the hairSystemShape tab, as well as Hairs Per Clump, Hair Width, and Hair Width Scale, in order to create fuller hair. You can always add follicles as well using the Paint Follicles tool.
In the Render Stats section of the hairSystemShape tab, you can enable Receive Shadows, Visible In Reflections, and Visible In Refractions when rendering with mental ray. If the hair will not render using mental ray, make sure that the Render Fur/Hair checkbox is selected on the Diagnostics tab in the mental ray Render Settings.
In this scene, the dreads.mel
preset, found on 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.
renderHair.ma
scene from the chapter14scenes
folder at the book’s web page.The scene is set up to render using mental ray. The render will take a couple of minutes. Figure 14.27 shows the results (shadows have been enabled for the lights in the image).
Most standard lights will render hair nicely. When you’re testing the look of the hair, using the hairLights.mel
preset makes it easy to see how the hair will look when rendered.
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 you can use the same techniques for more complex characters and models.
The Nucleus solver divides its computations into multiple threads for self-colliding surfaces and stretch resistance. Additional threading is also used to speed up playback of simulations with multiple nCloth objects on the same solver. Before starting this section, you should review Chapter 12 (“Introducing nParticles”) and Chapter 13 (“Dynamic Effects”) so that you understand how nDynamics and the Nucleus solver work.
The models that 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.
This scene has a simple cartoon character that has been rigged and animated. The character has a shirt and pants that have 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.
simpleMan_v01.ma
scene from the chapter14scenes
folder at the book’s web page (see Figure 14.28).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.
simpleMan_v02.ma
.To see a version of the scene, open the simpleMan_v02.ma
scene from the chapter14scenes
folder.
In the next section, you’ll create a constraint that will keep a character’s pants from falling down.
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.
simpleMan_v02.ma
scene from the chapter14scenes
folder at the book’s web page.simpleMan_v03.ma
.To see a version of the scene, open the simpleMan_v03.ma
scene from the chapter14scenes
folder at the book’s web page.
You can also constrain objects to components of nCloth objects, such as vertices. Using this technique, you can easily simulate the effect of buttons holding a shirt together.
simpleMan_v03.ma
scene from the chapter14scenes
folder.simpleMan_v04.ma
.To see a version of the scene, open the simpleMan_v04.ma
scene from the chapter14scenes
folder at the book’s web page.
The Component constraint differs from the Component To Component constraint that you just used; you can use it to replace nCloth’s internal Stretch constraints. As a result, you gain a high level of individual control. The following steps demonstrate the process and the potential for the Component constraint:
simpleMan_v04.ma
scene from the chapter14scenes
folder.The Component constraint now controls the stretch values of the edges. Open the nCloth’s Attribute Editor. Under the Dynamic Properties section, set the Stretch Resistance value to 0.0.
Click the Play button to see the effects. The shirt holds together well where the constraint was added, but the sleeves slink down with gravity since they have no stretch resistance (see Figure 14.37).
You can connect buttons to the shirt geometry using the Point On Poly constraint:
simpleMan_v04.ma
scene from the chapter14scenes
folder at the book’s web page.simpleMan_v05.ma
.To see a version of the scene, open the simpleMan_v05.ma
scene from the chapter14scenes
folder at the book’s web page.
You can also select a face of a polygon object and use the Point On Poly constraint to attach an object to a polygon face.
You can use wind or a directional force to move an nCloth object. You can assign these locally, affecting the object and leaving all other nCloth objects unaffected. This feature can be useful to give elements such as capes a cinematic feel. The settings to modify a local force or local wind are located on the nCloth shape node (see Figure 14.40).
nCloth properties can be painted to gain detail in your simulation. You can paint properties such as Bounce, Stretch, and Wrinkle onto an nCloth object. All of the properties can be painted as vertex maps or texture 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 that you have in your object, the more detail that 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 do remain within the 0 to 1 range in the UV Texture Editor. Texture property maps for nCloth objects are similar to texture property maps created for fur. 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.
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, you’ll use the wrinkle map 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 it inward. There are a few peculiarities about painting Wrinkle values, which you’ll explore in this exercise:
simpleMan_v05.ma
scene from the chapter14scenes
folder.Rewind the animation again; select the pants object, and from the FX menu set, choose nCloth ➣ Paint Vertex Properties ➣ Wrinkle ➣ ❒.
The pants turn white, indicating that a value of 1 is applied to the vertices of the pants for the Wrinkle property. Make sure that the Renderer in the Viewport menu is set to Legacy Default Viewport so that you can see the color values painted onto the pants geometry.
Rewind and play the animation. The pants suddenly bloat outward even though you have not made any changes (see Figure 14.41). What just happened?
When you start to create the wrinkle map, Maya applies a value of 1 to all of 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.
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 of the vertices of the pants geometry
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 goes only from 0 to 1.
In the Tool Settings dialog box, look at the Min/Max value fields. Set the first field, which is the Min Value, to -1, and the second field, which is the 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.
Scroll down to the bottom of the Tool Settings dialog box, and expand the Display rollout panel. Make sure that Color Feedback is on. Set Min Color to -1 and Max Color to 1 (see Figure 14.42).
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.
simpleMan_v06.ma
.To see a version of the scene, open the simpleMan_v06.ma
scene from the chapter14scenes
folder.
To learn more about fur, hair, and nCloth, check out Maya Studio Projects: Photorealistic Characters (Sybex, 2011).
Add XGen descriptions to characters. XGen is a primitive generator that adds realistic short hairs to the surface of character. The placement, length, and other attributes of the hairs can be controlled by painting on the surface using the XGen grooming tools.
Master It Create eyebrows for the head used at the beginning of this chapter.
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 top of the giraffe’s head from Chapter 9.
Style hair. Hair can be styled by painting attribute values on follicles or by directly editing the CVs of start or rest curves.
Master It Create an avant-garde hairdo for the nancy character by painting attributes.
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, you may need to alter the Min and Max Value ranges in the Artisan interface 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.