'Maya Plugin Power': Shave and a Haircut

In the latest excerpt from Maya Plugin Power, author Mark Jennings Smith shows us how to use the Shave and a Haircut plugin to create a stylish hairy look for a bird.

All images from Maya Plugin Power © Course Technology.

This month, VFXWorld continues a series of six excerpts of the Course Technology PTR book Maya Plugin Power, which will give VFXWorld readers to learn how to take advantage of the myriad of plugins available to Maya users.

I have never come across a better and easier way to create and styled hair and fur in Maya than Shave and a Haircut from Joe Alter. It works in a very intuitive way with a paradigm of Beauty Shop/Barber tools. A quick look at styling feathers on a bird.

Introduction

The computer graphics community has set their sights on many goals. One of them has been realistic flowing hair. The magnitude of generating and rendering thousands of hair strands was a problem that seemed insurmountable. Today, computer animation and vfx films are filled with golden locks, tufted fur and regal manes. Innovative solutions have popped up over the past five years that have almost put the issue of hair generation to rest. Autodesk's Maya Unlimited solution is Maya Fur. A far superior Maya plugin solution is called Shave and a Haircut. This single plugin with a funny name plays tongue-in-cheek homage to the musical couplet, of unknown origin, first used in the early twentieth century. It is being used by dozens of studios and vfx houses. Shave and a Haircut is full of features that overshadow the Maya Fur solution by leaps and bounds.

Tip: The short list of films using Shave and a Haircut is impressive. While many studios use Maya as their primary package, they bypass Maya Fur and use Joe Alter’s Shave and a Haircut plugin to elicit hair effects that suit their needs. Films such as 300, Barnyard, Charlie's Angels: Full Throttle, Charlotte’s Web, Dr. Who, Dreamkeeper, The Exorcism of Emily Rose, Exorcist: The Beginning, Hellboy, Into the West, King Kong, The Magic Roundabout, Moongirl, Pirates of the Caribbean: At World’s End, Sin City, Space Chimps, Superman Returns, Ultraviolet, Underworld Evolution, When Animals Attack! and X2: X-Men United have visible uses of Shave and a Haircut in action.

Among its most powerful features are ease of use, exceptional rendering, and seemingly infinite flexibility. The feature set of Shave and a Haircut is impressive and integrates with Maya seamlessly in the following areas:

  • Sculpting: Shave and a Haircut is an aptly-named plugin. The moniker is not a clever euphemism. It truly allows the user to feel that barbershop paradigm. Hair can be grown, shaped, cut and shaved. Its tight integration with Maya allows novel ways of texturing, shaping, and cutting hair. These tools are already familiar to you as a Maya user. Being a virtual barber is great fun.

  • Rendering: The quality of the fur and hair rendering in Shave and a Haircut is incredibly photo-realistic. Shave and a Haircut uses its own renderer. Shave and a Haircut uses what's called Deep Accumulation for all shadows. Shadows are rendered first and displayed in the scene. The hair is then composited into the scene as a post process. Light penetrates within the hair mass to calculate more sophisticated and accurate shadows and self-shadowing than most other renderers do. There is little necessity for working around a situation. Maya functions, such as light properties and fog, work fine.

  • Instancing: Shave and a Haircut has brought a great deal to the table with its package. While hair is its primary focus, it is capable of a few other neat tricks. Shave and a Haircut does not prevent your favorite renderer from being used. Hair generated in Shave and a Haircut is proprietary, but can also be converted to a mesh version object, so that any renderer could be used. Hair can also be substituted by other geometry. Instancing mesh objects can open up a world of new possibilities -- a field of sunflowers, a pumpkin patch, sheep or even pimples are all possible.
  • Surface Dynamics: Shave and a Haircut hair strands are wired and ready for dynamics. Hair guides are created as a dynamic chain and carry their own dynamic properties contained in the normal Maya Attribute Editor. Since hair is best served on a living thing, hair is not dynamically controlled by the overall movement or transform, but rather by skin dynamics. This means that as the skin surface distorts or deforms, so does the hair it is attached to. As skin moves over bone or muscle, the dynamically-driven hair correctly imitates the action. Let's delve into Shave and a Haircut with a quick and easy example.

[Figures 1, 2, 3] The polygon bird model ready for hair (left). Shave and a Haircut's two menus are nestled among the Maya menus (top right). Two views of selected polygons shaded dark (bottom right). These polygons produce hair. 

Tip: Don’t fret if your picture does not exactly match that of the book. We regularly switch between renderers. Since Shave and a Haircut utilizes its own renderer, it doesn’t matter which renderer you are using (see Chapter 4 for other renderers). The hair should always turn out just fine. Hair can be converted to mesh objects and rendered in other renderers. However, unless otherwise noted, we are rendering fur and hair in the Shave and a Haircut renderer.

A Furry Bird

It is very easy to get hair to grow on something quickly. Load the scene file bird_1.mb into Maya. It is located on the companion DVD in the Chapter 3 folder. A quick render should reveal our polygon model with lighting, as shown in Figure 1.

This particular model is made of polygons, but Shave and a Haircut grows hair on just about any object type. When the plugin is loaded, Shave and a Haircut places two menus within the menus in the Maya menu bar, and they remain constant throughout all Maya menu sets. These two menu selections are shown in Figure 2.

There are many ways to direct Shave and a Haircut to place hair. This time we will select specific polygons on the model that will grow hair. It may help to make the box room invisible in the Channel Editor. This may make it slightly easier to select the specific polygons. It may also be easier to select all the polygons of the head and then deselect the face polygons that should be hairless. Figure 3 shows two alternate views of the bird's body, with polygons deselected.

[Figures 4, 5] Shave and a Haircut's menu selection for creating a new hair node (left). The pop-up window with preset hair types (right).

[Figure 6] Hair now appears from the model and is clearly represented in the Outliner window.

With the hair polygons selected, it's a simple matter of creating a hair node for them. Go to the Shave and a Haircut menu on the Maya menu bar. Select Shave > Create New Hair, as shown in Figure 4. This brings up a library of preset hair types to choose from (see Figure 5).

Select redhead from the presets. The bird model now looks something like Figure 6.

The node shaveHair1 is visible and selectable from the Hypergraph or the Maya menu bar. The Shave and a Haircut's Shave Select menu, shown in Figure 2, lists all available hair nodes. It is focused for quickly selecting the proper node to work with. Hair is not the only item generated with a hair node. Spline curves called guides appear evenly spaced on the hair surface.

Select the hair node shaveHair1. In the Attribute window, under the Hair Display tab, the guides may be toggled on and off. Let's toggle the guides for shave-Hair1, as shown in Figure 7. Hair guides are a nifty solution for handling large numbers of hairs. These guides provide a little order in the chaos of a bad hair day. Our bird looks as though he fell victim to a cartoon electrocution. Let's style his hair more appropriately. Save your work.

[Figure 7] The all-important guides are now turned on. 

Load bird_2.mb from the companion DVD in the Chapter 3 folder. This is our scene up to this point. Shave and a Haircut has tools aptly named Brush and Cut.

[Figures 8, 9] Selecting the Brush tool with option box circled (left). Brush option box with various Brush functions labeled. 

Tip: The bird model is faceted partly because it was built in another program. It is always better to work with lower-resolution models. Smoothing the polygons of the models smoothes our bird’s skin out. Shave and a Haircut adapts to new geometry by adding hair guides as needed.

This is where the virtual barbering takes place. Go to the Shave menu shown in Figure 8 and select Shave > Brush Tool. Select the option box as well. This brings up a small set of Brush functions in the Attribute Editor, as shown in Figure 9. The six Brush functions operate on the hair guides in some very helpful ways. Select the Translate Brush. This is all we will deal with at this point.

Experimentation with all the brushes is the key to styling the perfect coif. Brushing virtual hair in Shave and a Haircut is a very interactive procedure. It would be difficult to convey how to do this in still images. Figure 10 is a frame of a movie file that shows how to tame the bird's mangled mane. The red circle in Figure 10 is the Brush. It is very similar to a typical Maya Brush. You can change the Brush size interactively by holding down the B key and dragging the mouse right and left.

Play brushup_bird1.mov from the companion DVD in the Chapter 3 folder. As shown in the movie, it doesn't take long to wrangle the hairs. Figure 11 shows a before-and-after of the quick styling. With a little practice, it becomes quite easy to design a great look for whatever beast you are working on. The difference is how you utilize the other Brush tools available.

[Figures 10, 11] A familiar Maya-type Brush helps groom (left) an unruly hairstyle. A rushed styling job (right) makes the bird almost presentable.

Tip: When styling hair with the Brush tools, it is a good idea to turn off the display for hairs. The guides are what are actually being brushed. The display becomes quite fast, and it is visibly uncluttered by hundreds of hairs.

Save your work. The result of the quick grooming from the movie is available on the companion DVD in the Chapter 3 folder as bird_3.mb. There is also a small scene file called brush_practice.mb in the Chapter 3 folder. This is a simple tuft of hair on which you can practice brushing virtual hair. The effects of the brushes are easily seen here.

Mark Jennings Smith is a seasoned artist, animator and writer residing in Beverly Hills, CA. Smith has been fascinated by CG since 1972, when at age 10 a chance encounter with the first coin-op Pong changed his life. His interest in the entertainment field led Smith and a partner to establish Digital Drama in 1994, which focused on computer-generated imagery, animation, digital painting and special digital visual effects. Digital Drama designed the digital film effects and animation for companies such as Universal Pictures, Trimark Pictures, Fox Home Ent., HBO and Showtime. Smith has contributed to several books and magazines, including a chapter in Maya: Secrets of the Pros. He also created cover art for the book and a variety of other titles in the 3D arena. He served as the technical editor for Mastering Maya Complete 2 as well as consulted and beta-tested dozens of software packages. Smith has also taught visual effects and computer animation using Maya at New York University.

randomness