• | Table of Contents
• | Index
Maya® Character Creation: Modeling and Animation Controls
By Chris Maraffi
Publisher | : New Riders Publishing
Pub Date | : September 05, 2003
ISBN | : 0-7357-1344-8
Pages | : 368

A unique, in-depth approach to creating realistic characters in Maya. Maya Character Creation: Modeling and Animation Controls' author, Chris Maraffi, has expertise in the field and in the classroom that translates to the knowledge and solid teaching skills needed to make this book a "must-have"!

The current trend in computer graphics is greater organic realism. Many of the top-grossing movies today, such as Spiderman, Lord of the Rings, Jurassic Park 3 , and Star Wars Episode 2, all feature realistic 3D characters. There is a major need in the 3D community for educational material that demonstrates detailed techniques for achieving this organic reality. Maya is one of the main packages used on such cutting-edge films, and has an established toolset for creating believable 3D characters. Maya Character Creation: Modeling and Animation Controls is designed to take you through the process of designing, modeling, and setting up animation controls for complex 3D characters. The concepts, techniques, and Maya tools used for each step in the process are presented in each chapter, followed by many hands-on exercises. NURBS, polygon, and subdivision surface modeling techniques are shown for creating the character's skin, and skeleton-based animation controls are covered in detail. You will learn how a character's skin should deform when the skeletal joints and muscles move. Advanced MEL scripted animation controls are also covered extensively.


• | Table of Contents
• | Index
Maya® Character Creation: Modeling and Animation Controls
By Chris Maraffi
Publisher | : New Riders Publishing
Pub Date | : September 05, 2003
ISBN | : 0-7357-1344-8
Pages | : 368

Copyright
About the Author
About the Technical Reviewers
Acknowledgments
Tell Us What You Think
Introduction
 | Who Should Read This Book
 | Who This Book Is Not For
 | Overview
 | Conventions
CHARACTER GALLERY
Chapter 1. Creating Organic 3D Characters
 | A Trend Toward Organic Realism
 | Designing an Organic Character
 | Wrapping It Up
Chapter 2. Modeling the Skin of a Biped Character
 | Creating a Head from NURBS Surfaces
 | Modeling a NURBS Torso and Limbs
 | NURBS Multipatch Modeling
 | Creating a Polygon Skin
 | Preparing to Render Your Character's Skin
 | Wrapping It Up
Chapter 3. Character Skeleton Setup
 | Creating Basic Animation Controls
 | Increasing Rig Functionality
 | Advanced Animation Controls
 | Wrapping It Up
Chapter 4. Deforming the Skin
 | Deforming the Skin with Skeletons
 | Deforming the Skin with Muscles
 | Deforming the Skin with Bones, Wrinkles, and Fat
 | Additional Smooth Skin Binding Techniques
 | Wrapping It Up
Chapter 5. Character Setup for Animating the Face
 | Creating Basic Face Controls
 | Creating Blend Shapes
 | Creating Advanced Face Controls
 | Wrapping It Up
Chapter 6. Scripting MEL Character Controls
 | Basic MEL Controls
 | Advanced MEL Controls
 | Going Further with MEL
 | Wrapping It Up
Chapter 7. Finishing Your Character for Animation
 | Preparing to Animate Your Rig
 | Animation Methods
 | Streamlining the Animation Process
 | Wrapping It Up
Index


Copyright

Copyright © 2004 by New Riders Publishing

All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means—electronic, mechanical, photocopying, recording, or otherwise—without written permission from the publisher, except for the inclusion of brief quotations in a review.

Library of Congress Catalog Card Number: 2002112489

Printed in the United States of America

First printing: September, 2003

08 07 06 05 04 03 7 6 5 4 3 2 1

Interpretation of the printing code: The rightmost double-digit number is the year of the book's printing; the rightmost single-digit number is the number of the book's printing. For example, the printing code 03-1 shows that the first printing of the book occurred in 2003.

Trademarks

All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. New Riders Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Maya is a registered trademark of Alias.

Warning and Disclaimer

Every effort has been made to make this book as complete and as accurate as possible, but no warranty of fitness is implied. The information is provided on an as-is basis. The authors and New Riders Publishing shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the CD or programs that may accompany it.

Publisher

Stephanie Wall

Production Manager

Gina Kanouse

Acquisitions Editor

Elise Walter

Development Editor

Chris Zahn

Project Editor

Michael Thurston

Copy Editor

Keith Cline

Indexer

Lisa Stumpf

Proofreader

Ben Lawson

Composition

ContentWorks

Manufacturing Coordinator

Dan Uhrig

Interior Designer

Kim Scott

Cover Designer

Aren Howell

Media Developer

Jay Payne

Marketing

Scott Cowlin

Tammy Detrich

Hannah Onstad Latham

Publicity Manager

Susan Nixon

Dedication

This book is dedicated to the many colleagues, students, and professional character artists who have inspired me over the years.


About the Author

Chris Maraffi is currently the course director of the Character Modeling and Character Rigging classes at Full Sail Real World Education in Orlando. He was a presenter, with other Full Sail faculty, of the Maya Tips and Tricks master class at SIGGRAPH 2001 for Alias|Wavefront. Chris has taught advanced 3D classes at New York University's Center for Advanced Digital Applications; Parsons Design School; School of Visual Arts; and NYIT in New York City. In the San Francisco Bay area, Chris has taught 3D classes at the Academy of Art, Mesmer Animation Labs, and The Master's Institute. He is also the author of Softimage|XSI Character Animation FX & Design (Coriolis, 2000). Other publications include numerous online and magazine 3D tutorials and articles. Before becoming a teacher, he worked as a full-time artist and animator in New York City, and did work for clients in broadcast, the Internet, and film.


About the Technical Reviewers

These reviewers contributed their considerable hands-on expertise to the entire development process for Maya Character Creation: Modeling and Animation Controls. As the book was being written, these dedicated professionals reviewed all the material for technical content, organization, and flow. Their feedback was critical to ensuring that Maya Character Creation: Modeling and Animation Controls fits our readers' need for the highest-quality technical information.

Pete Bandstra is program director for the Computer Animation Degree Program, Full Sail Real World Education, in Orlando, Florida.

Greg Berridge is currently the head instructor of the Digital Character Animation program at Vancouver Film School. He is a certified Maya instructor holding accreditation in several areas of Maya expertise. Greg has completed work for several local Vancouver companies, including Lorax International. He has also spent time teaching Maya to content creators at Mainframe Entertainment. Greg has completed work for the NAIC (NASA Institute for Advanced Concepts) on the international front. First and foremost an instructor, Greg has been teaching Maya since it arrived six years ago. In addition to his professional endeavors, Greg is working as an independent producer and is currently developing several concepts for television and film. He is also an aspiring author, hoping to have his own book published soon on the intricacies of Maya. Above all else, he is engrossed in Maya and breathes 3D content creation at every possible moment.


Acknowledgments

I first want to thank all the professional character artists who contributed directly, or indirectly, through inspiration, to the information contained in this book. A special thanks to Tim Naylor of ILM, and Maricela Perdomo of Tippett Studios, for taking the time to provide insights on working as professional character modelers and rigging artists.

I also want to thank all the excellent Full Sail students who contributed images of their characters for use in this book, including Chris Frobose, Sat Nam Kaur Hartigan, Peet Cooper, Gregory Hearne, Allan Norico, Ken Shaffer, George Vasiliadis, Travis Burcham, Michael DelGiudice, Adam Fisher, Zachariah Inks, Jonathan Mariucci, Giles O'Dell, James Procopio IV, Samson Tsehaye, Chelsea Kibler, Adam Smith, Maegan Walling, Michael Donovan, Joshua Betts, William (Forrest) Crump, Dena Light, Shawn Rinehart, Carlos Saldivar, Jeff Unay, Eliezer Zayas, Carla Merrell, Paul Browder, Greg Hearne, Nick Miulli, and Arturo Pulecio. A special thanks to Michael DelGiudice, Jeff Unay, Carlos Saldivar, and Maegan Walling for contributing their character renders for use on the cover of this book. All these students have the potential to become great character artists. Most of these students are just now starting out in their professional careers. If any potential employers want to contact any of the artists featured in this book, I will be happy to forward their contact information. You can reach me by email at mayacharactercreation@yahoo.com.

Another group of people I want to thank personally is my many Full Sail colleagues in the computer-animation program. All of them continue to inspire me daily with their understanding of the subjects they specialize in and with their dedication to teaching. These include Jeanne Kiraly, my associate course director of the Modeling and Rigging classes, who really did a great job developing the modeling class. In addition, I want to thank my lab specialists—John Capozza, Carlos Breban, Fidel Cibeira, Todd Patterson, and Marcus Scarsella—for all their help testing out new techniques in the labs. I also want to give a big thanks to the directors of the computer-animation program, Pete Bandstra and Erik Noteboom, who completely supported the writing of this book.

Finally, I want to thank the many professionals who made up the New Riders team for this book. These especially include my development editor, Chris Zahn, and my Acquisitions Editor, Elise Walter.


Tell Us What You Think

As the reader of this book, you are the most important critic and commentator. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way.

As an editor for New Riders Publishing, I welcome your comments. You can fax, email, or write me directly to let me know what you did or didn't like about this book—as well as what we can do to make our books stronger. When you write, please be sure to include this book's title, ISBN, and author, as well as your name and phone or fax number. I will carefully review your comments and share them with the author and editors who worked on the book.

Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of email I receive, I might not be able to reply to every message.

Fax: | 317-581-4663
Email: | elise.walter@newriders.com
Mail: | Elise Walter Acquisitions Editor New Riders Publishing 800 E 96th Street, 3rd Floor Indianapolis, IN 46240 USA


Introduction

This introduction provides an overview of the scope of this book. It is meant to give you a good idea of the book's focus and the intended audience. Each of the chapters is described, so you will have a good understanding of their contents and how the information is organized and presented.


Who Should Read This Book

This book is intended for beginning-intermediate Maya users who want to expand their understanding of how to create complex 3D characters for animation. The typical reader should have a basic understanding of the Maya interface and know how to navigate around in 3D space. For brand new Maya users, it is recommended that you first go through all the basic learning tutorials that came with your software documentation. In addition, I recommend that the beginning Maya user consider purchasing Maya 4.5 Fundamentals by Jim Lemmers and Lee Gooding, which provides a thorough introduction to the Maya software.


Who This Book Is Not For

Maya is a robust 3D program that includes many different tools for every aspect of the 3D production process. The focus of this book is on how to model and set up 3D characters for animation. Although this book shows you how to create the controls essential for animating a 3D character, it is not a how-to-animate book. If you want to learn how to animate your character, consider buying George Maestri's Digital Character Animation books. This book also does not cover in detail the lighting, texturing, and rendering aspects of the 3D production process. Two books that cover these skills in detail are Digital Lighting and Rendering by Jeremy Birn, and Digital Texturing and Painting by Owen Demers.


Overview

Maya Character Creation: Modeling and Animation Controls is designed to take the reader through the process of designing, modeling, and setting up animation controls for a biped 3D character. The concepts, techniques, and Maya tools used for each step in the process are presented in each chapter, followed by many hands-on exercises and examples.

Chapter 1: Creating Organic 3D Characters

This chapter begins by describing the trend in computer graphics toward creating realistic 3D characters. This is followed by interviews with professionals in the fields of character modeling and character setup. The chapter ends by showing you how to create preproduction character designs that are used for accurate modeling of your character in Chapter 2.

Chapter 2: Modeling the Skin of a Biped Character

This chapter shows you how to model the skin of your character using NURBS, polygons, and subdivision surfaces. The advantages and limitations of NURBS surfaces are presented, as well as how to use specific NURBS modeling tools in Maya. Special consideration is given to edge placement and tangency between NURBS patches. You are also shown how to convert your NURBS skin into a polygon skin, so you can take advantage of polygon modeling techniques. In addition, you are shown how to smooth your characters skin by converting it to a subdivision surface. The chapter ends by introducing how you can approach creating skin textures on a NURBS or polygon skin.

Chapter 3: Character Skeleton Setup

This chapter shows you how to create detailed animation controls for all the main body parts of a biped character. It begins by explaining how to draw the skeletons that will be used to deform your character's skin. Then it details how to parent the skeletons with icon controls to create a complex character rig. The chapter also shows you how to refine the controls by connecting channels through the use of math expressions, and by setting driven keys.

Chapter 4: Deforming the Skin

This chapter details how to bind the skeletons created in the preceding chapter to the character models created in Chapter 2. Both smooth and rigid binding methods are presented, with a main focus on developing a good smooth skin bind. Several methods for improving the deformations on your skin are described, including manually adjusting the smooth skin weighting. In addition, how to create muscle flexing, skin wrinkles, and fat jiggle on the skin are shown.

Chapter 5: Character Setup for Animating the Face

This chapter covers the creation of more detailed controls for animating the face of a character. It shows techniques for simulating the muscles of the face using skeletons and influencing objects. You also learn how to create and animate blend shapes, with special consideration given to properly ordering the deformers.

Chapter 6: Scripting MEL Character Controls

This chapter shows you how to use MEL scripting to create custom window interfaces for your character. MEL is a powerful tool that enables you to create more efficient, fast, and intuitive animation controls. Details are given on how to write, save, and access MEL procedures and scripts. Many practical examples of MEL character controls are presented.

Chapter 7: Finishing Your Character for Animation

This chapter shows you how to complete your character controls, and how to prepare for animating them. It describes how to easily keyframe your rig controls by creating a character node. In addition, you are shown an approach to using multiple resolutions of character rigs by storing animation as clips in the Trax editor.


Conventions

This book follows a few typographical conventions:

  • A new term is set in italics the first time it is introduced.

  • Program text, functions, variables, and other "computer language" are set in a fixed-pitch font—for example, Sphere.translateY = 5 + Cube.rotateZ.

  • Code lines that do not fit within the margins of the printed page are continued on the next line, and the continuation of the line is preceded by a code continuation character [image].


CHARACTER GALLERY

Josh Betts

Travis Burcham

Peet Cooper

Forrest Crump

Mike Del Giudice

Michael Donovan

Adam Fisher

Chris Frobose

Sat Nam Kaur Hartigan

Greg Hearne

Zachariah Inks

Chelsea Kibler

Dena Light

Jonathan Mariucci

Nick Miulli

Allan Norico

Giles O'Dell

James Procopio

Arturo Pulecio

Shawn Rinehart

Carlos Saldivar

Ken Shaffer

Adam Smith

Samson Tsehaye

Jeff Unay

Jeff Unay

George Vasiliadis

Maegan Walling

Eliezer Zayas


Chapter 1. Creating Organic 3D Characters

Character designs by Carla Merrell

Bringing digital 3d characters to life in an animation involves many steps. Each step involves artists with a variety of interests and talents. Most people who consider a career working in digital 3D production usually first want to be animators, because that is the glamorous position associated with creating character animations. They do not often consider the many other career paths available to them. As this industry matures, animators are getting work more because of their talent as performers than because of their software knowledge. Just like not everyone has the talent to be a successful actor, not everyone has the talent to be a successful animator. If you find you are not cut out to be the next Tom Hanks, what is an aspiring 3D character artist to do?

Not to worry, plenty of other kinds of jobs—which pay well and require many different talents—are absolutely essential in the 3D character animation process. For instance, the job of a storyboard artist requires the drawing talent to produce inspiring designs and story sketches. The job of a character modeler requires the sculpting talent to create the skin and clothes of the character; and the job of a texture artist requires the painting talent to make the skin and clothes look believable. In addition, the character setup artist must have the talent to create logical and user-friendly character controls for the animator. The lighting technical director must have the talent to create the proper mood for each scene. The special effects artists must have the talent to be able to re-create natural effects such as water, wind, and fire; and the compositor must have the talent to put all the elements together so that they all fit as a whole. This book prepares you for the career options of two of these roles, namely that of a character modeler and character setup artist. In the process, you learn the basic skills necessary to create an animation-ready 3D character in Maya. To begin, this chapter introduces you to what is involved in working as a character modeler and setup artist through interviews with industry professionals. To get you started in the process, you also are shown preproduction design steps that make creating your character model in Maya easier.


A Trend Toward Organic Realism

This section describes the trend in films, TV, and games to push digital technology toward creating more realistic 3D characters. You also learn what is involved in working as a character modeler and setup artist for a large film company through two interviews with industry professionals.

From Jurassic Park to The Lord of the Rings

It is a good time to be working in the digital 3D character animation field. Even though the economy has declined in recent years, entertainment products such as films and games are more popular than ever. It is easy to see that the most successful films in the past few years contain large amounts of digital 3D imagery. Books that never could have been realized successfully in film before, such as Tolkien's The Lord of the Rings trilogy, are now being done to box-office and critical acclaim. Others include Shrek, Monsters Inc., Harry Potter, the Star Wars prequels, The Matrix, Gladiator, Moulin Rouge, and the list goes on. Although some of these films fall into the realm of surrealistic 3D cartoons, many integrate digital 3D imagery with live action in ways that are very subtle. Many of these films contain digitally created extras, stunt doubles, and digital location sets seamlessly integrated with live-action footage. A few even contain digital actors in main roles playing next to live actors. The success of these films is pushing the industry toward using digital technology more and more to realize a filmmaker's vision, regardless of whether it is realistic.

Films are increasingly going digital for two main reasons. The first is that, in many cases, it is cheaper to create a virtual set in the computer than to build and shoot on a live set. Filming extensively at famous locations, such as Times Square in New York City, can be extremely expensive for a filmmaker. Such a shoot can require paying the city, state, owners of private property, union operators, actors, extras, and rental agencies. It also is becoming cheaper to create computer-generated "settings" for large-scale fantasy or period films than it is to make them as full-scale live sets. Populating these virtual sets with digital actors is just the next step in the process. It is becoming standard practice to add digital extras for large crowd scenes and use digital doubles for dangerous stunts. Going beyond this to using digital actors in main roles is already beginning to happen. Companies are even trying to capitalize on proven personalities by buying the rights for using the images of popular dead actors. It won't be long before digital versions of Marylyn Monroe, John Wayne, and Bruce Lee will be seen acting on the big screen again. At first, a digital 3D face of the famous personality will be placed on the bodies of live acting doubles. This technology was first developed to make talking animals in movies such as Babe in the 1990s. Since then, it has been thoroughly tested for replacing human faces with realistic digital faces by companies such as Disney, as demonstrated at SIGGRAPH Electronic Theatre in 2002.

The second reason why films are increasingly going digital is the control it gives to filmmakers. Shooting a live performance can lead to problems in the film and acting process that require reshooting of the scene. If the lighting wasn't quite right, or an actor flubbed part of an otherwise perfectly good scene, in many cases the scene must be redone. If, however, you are capturing the performance digitally, and your set is also digitally created, you can fix all those problems in postproduction. The director has the power to alter the performance for whatever effect is needed if the performance is digitized into the computer and then placed onto a digital 3D character. Notice that this process doesn't remove live actors as the source of the performance. Actors don't have to worry about their jobs; it will be a long time before a computer can generate the subtleties that a live actor can produce. The delivery of the performance, however, will increasingly be wrapped in a realistic digital skin.

Some definite milestones mark this road to digital actors populating films. Industrial Light + Magic (ILM) began introducing computer-generated character effects in films such as the Abyss and Terminator 2: Judgment Day, in the early 1990s. However, the first major use of digital 3D creatures was in 1993, when Steven Spielberg decided to have ILM animate digital 3D dinosaurs instead of strictly using puppets and animatronics for Jurassic Park. In the following years, some limited attempts were made at organic human characters. Pixar's Toy Story incorporated brief moments of very stylized humans. Digital Domain populated the sinking Titanic with digital extras. The next stage was to create a more anatomically realistic character that would replace main actors for whole scenes. A big step in this direction occurred with the making of The Mummy. Due to the necessity of seeing inside parts of the decaying creature, ILM was forced to create a digital version that had working muscles and bones inside. This not only looked good, but it also produced a much more realistic animation because it closely mimicked how a real body works. Because this technique worked so well in The Mummy, ILM used the similar techniques to remake the Jurassic Park dinosaurs to be more realistic in Jurassic Park 3. Sony Pictures Imageworks extended this approach when they created a digital version of Kevin Bacon for Hollow Man. In this case, they not only created all the working muscles and bones inside the character, they also created organs, so that everything worked correctly when the character's skin faded away.

In both The Mummy and Hollow Man, however, the digital actors were used only as brief stand-ins for the live actors, whenever a special effect was required. Only recently have completely digital characters been used for realistic acting roles in feature films. In 2001, although not entirely successful, Square pushed the technology further by creating close to realistic digital 3D characters in the Final Fantasy film. Since then, more successful digital characters have been seen in Star Wars Episode II: Attack of the Clones, Harry Potter and the Chamber of Secrets, and The Lord of the Rings: The Two Towers. The second Star Wars prequel introduced a fully digital Yoda, which actually had to be scaled back to make it fit with earlier versions of Yoda that had quirks due to the rubber material from which the puppet was made. The second Harry Potter film introduced a digital companion for Harry in the form of Dobby. As impressive as Yoda and Dobby were, however, neither achieved the dramatic intensity of Gollum in the second installment of Peter Jackson's The Lord of the Rings. For the first time onscreen, people could see the incredible possibility of digital 3D characters. The scene when Gollum fights with himself over his relationship with Frodo was the most talked about scene in the movie, and helped win the Academy Award for visual effects. With the success of these digital characters, many other even more impressive ones will surely follow.

One other important trend is the reduction of the price of professional 3D animation software. The same software used to create many of the impressive digital characters in movies and games is now available to anyone at a much more accessible price. In the past, only large companies could afford a powerful 3D program such as Maya. However, the dropping of the cost of programs such as Maya in the past few years has made it possible for the average consumer to use professional-level 3D character tools. This enables the individual artist to produce 3D animations that are just as sophisticated as those seen in the biggest blockbuster film. When you add the ability to instantly and cheaply broadcast your animations to the entire world through the Internet, the possibilities are mind-boggling. Never before in history have individual artists been able to broadcast their work to the entire world in about an hour. As this trend continues to develop, opportunities for unknowns to become sources of entertainment content will increase. Recently, many character animations created by individuals and small companies have become extremely popular. Some of these include South Park, the Power Puff Girls, and Jimmy Neutron. Many 3D artists lose sight of the benefits of creating original characters, and instead only focus on creating characters for their demo reel that they can use to get a job at a large production facility. Keep in mind that Maya is an artist's tool, and if you create an interesting character that becomes hugely popular due to the Internet, you own all the rights to it. If your characters then get picked up in a major network series, or are made into a blockbuster movie, you will reap the benefits. Such benefits can include the complete artistic and financial freedom to create more original content.

Sculpting Characters for a Living

The job of a character modeler consists of creating the skin, clothes, and, sometimes, props of a 3D character. People who are good at character modeling are usually good at sculpting with traditional materials such as clay. To successfully model a character, they require the talent to visualize 2D designs in 3D, and are able to simplify complex objects into their basic shapes. For creating realistic characters, a modeler also must have an excellent understanding of anatomy, to create skin that deforms correctly at all the joints.

Maricela Perdomo is a professional character modeler at the renowned Tippett Studios in the San Francisco Bay Area. She has created many character models for films, including ones for Evolution, Blade 2, The One, Men in Black 2, League of Extraordinary Gentlemen, Matrix 3, and Stepford Wives. The following interview describes what is involved in working as a character modeler at a large film-effects studio:

Q: What does the job of a character modeler consist of at Tippett Studios?

A: A character modeler at Tippett is responsible for building models that will work effectively throughout our pipeline. Generally, we begin modeling either from scratch, from a scan, or one from our own library. It all depends on the type of reference we have available. When I start building an actor, I try to gather as many photographs as possible and I constantly compare them to my working surface. I cross-reference every angle of the actor's face and body so that there's no doubt that he/she looks as realistic as possible. People have little details in their face that make their features unique. It is important to pick out those subtleties and convey them in your 3D model. Scanned models come with good detail and provide you with a template that has the right proportion and height and volume of the person, but they don't always capture the tiny details around the nostrils or the way the eyelids fold. It's the modeler's job to fill in the blanks and still maintain the integrity of the model. We use NURBS, polygons, and subdivision surfaces for our models. Our models are required to be built as neatly and as cleanly as possible, but are not unnecessarily dense.

Q: What skills and knowledge did you need to develop to successfully perform your job at Tippett?

A: One of the most important skills that I have developed, which has served me at Tippett and other places, is to be flexible and open to change. Every employer so far has asked for me to use and learn different kinds of software, or has different procedures for how models need to be built and shared with others. I also need to have good visual and verbal communication skills so that I can translate into 3D everything the CG supervisor or art director asks me to do. I have to be able to build anything that is asked of me, no matter how difficult it may seem at first. When you have experience, nothing seems impossible, and you feel like there's nothing you can't build.

Q: Do you have any advice for people who want to get a job as a character modeler?

A: I've always said this, and will never stop saying it: "Never give up." If you can't get in the first, second, or tenth time to the studio of your dreams, don't stop trying. But, every time you apply, your work has to be recent, better than before, and it should show that you have kept up with the latest technology. Aspects of your work must match the quality that a studio expects for a production. At Tippett, the new employees that get in through these doors are the ones who never stopped trying; worked very hard to get here; have talent, great skills, and a great demo reel. They really wanted to be here. Once you are in, it's wonderful. You work even harder, and get to work with some very smart and talented people. You have the opportunity to create things you never dreamt of, and some that you did have dreams about. It's challenging, rewarding work of which you can be proud.

Rigging Characters for a Living

The job of a character setup artist consists of creating the controls for animating the character's skin and clothes, called a character rig. The talent required to do this successfully is a logical mind that likes to come up with solutions to technical problems. When a character setup artist creates a rig, they are creating hierarchies of skeletons and objects that must all work together to make the task of animating the character easier. In addition, riggers must have a strong understanding of anatomy so that they can emulate the way real bones, muscles, and skin work in a digital 3D character. Finally, a character setup artist must also have a good understanding of MEL scripting to create custom tools and interfaces in Maya.

Tim Naylor is a character setup artist, called a creature TD, at world-famous Industrial Light + Magic in the San Francisco Bay Area. He worked on characters for Star Wars Episode II: Attack of the Clones, The Hulk, and Pirates of the Caribbean. The following interview describes what is involved in working as a character setup artist at the largest film-effects studio in the world:

Q: What are the job responsibilities of a creature developer at ILM?

A: What we're responsible for more than anything else is servicing the animators. So our job is getting the characters properly rigged with the correct kind of animation control systems for the characters, and then delivering that to the animators. Lately, the creature development group at ILM has been expanded from just putting a skeleton into the character and creating animation controls to where you also have to prepare the character for rigid body dynamics, as well as cloth and hair simulations. So, really, the skill sets have been expanded.

Q: What kinds of rigs do you create?

A: We try to keep the rigs for our characters as standardized as possible, and then customize them specifically for each character if the need arises. For the Star Wars movies, there are so many aliens with different kinds of scales that we did a lot of specialized rigs, and then there are all kinds of rigging done for their props. There are really two levels of interaction, one being the props associated with the character, such as Yoda and his cane, and then enabling the animators to easily interact with other objects in the scene. The animators don't have to really go deep into the constraining world in Maya, or the hypergraph, because we provide support in that way. Animation support tools, such as importing and exporting animation in the form of scripts, are delivered and created by the creature development group. It's great that it is a very broad and demanding field as far as the knowledge and skill sets required.

Q: Do you use strictly proprietary software?

A: We use a combination, so that animation may be done with off-the-shelf software, but our simulations are pretty much done with proprietary software. We have our own rigid body and cloth software. However, we do write our own plug-ins and tools within commercial animation packages.

Q: What skills should someone develop who wants to get a job as a setup artist at a company such as ILM?

A: At this point in time, scripting is absolutely critical. I know that scares a lot of students, and it even scared me, but once you determine that you are going to learn it, you can. If you look at the future, where this is all heading, it's becoming more and more script driven, because you really need to be able to manipulate the software. These commercial packages are now open, so we can use something like MEL to make the software do what we need it to do. That's the power we need. With MEL, there are built-in mathematical functions, so you can dig into the software and manipulate it with math, which is a growing need. Manipulating MEL may get you 80 percent of the way to your goal, but you may have to use some crazy math to conjure up the last 20 percent and get the software to do what you want it to do.

Q: Do you also set up the muscle systems for the character, and how much anatomy knowledge must you have?

A: Not only do we set up the muscles, but after a simulation is run, we also really go through and look at the anatomy. We check to see if the muscles are moving correctly, and will if necessary go in by hand and make sure the shape of the muscles is anatomically correct. Sometimes we even do a little bit of modeling in our department as well. We are smack-dab in the middle of the production process, so we get the character and user interfaces rolling and off to the animators, and then we will get the characters back again later to perform simulations, and then we hand it off to the technical directors for lighting.

Q: Do you have any other closing advice for someone who wants to become a professional creature developer?

A: Learning the software is one thing, but understanding how things are working under the hood, and being able to manipulate that, is very important. This means not only having scripting knowledge, but understanding why numbers in the channels come up the way they do when you constrain and parent objects. This requires understanding coordinate systems, and being able to problem solve. Understanding why the numbers are changing when you are working with things such as orient constraints enables you to troubleshoot problems and is the real benefit of knowing what's under the hood of the software. There will be situations when just doing a constraint won't work, and you may have to rearrange parts of the hierarchy, and then do the constraint.

We are looking for people who are on top of the current state of the industry, and who are trying to solve the same problems that we are working on. They should try to show on their reel that they not only know how to rig, but that they also are trying to innovate and solve problems. You can't have a character move without secondary muscle movement and jiggle, which is what we do all day long. If they just show a skeleton walking around, that's not going to be enough. They should show that they are really concerned with the details of character movement, and how the flesh is moving. If they can do that even without proprietary simulation tools, it shows innovation.


Designing an Organic Character

This section shows you how to begin creating a 3D character in Maya by taking you through the basic preproduction design process. Some character-idea generation approaches are presented, and you are shown how to create the designs that you will later use as guides for modeling your character's skin.

Design Considerations

The first thing you want to do when designing your character is to decide the style you want to use. At one extreme, you could design a completely stylized cartoon character; at the other extreme, you could design a fully realistic character. Because this book focuses on creating characters that have a muscle and bone structure, you should avoid designing a completely cartoon character for working through each chapter's exercises. A completely realistic character, on the other hand, can be too challenging for someone who is not already a professional. Photorealistic characters must not only look real, they must also animate realistically, which requires a lot of subtleties in the character controls. Between these two extremes is a surreal character design, such as a Shrek-style character. This kind of character has a stylized look, while still containing a believable anatomical structure. Such a character is easier to model and animate because viewer expectations will not be as high as for a photorealistic character.

One of the things that make most popular characters memorable is that they are unique in their design. Although there is no formula for creating a memorable or popular character, you can use some techniques to increase the appeal of your character designs. One thing you can do is exaggerate various parts of the character's body. Exaggerating features on the face, for instance, can make your character more expressive. You can see some exaggeration in most cartoon characters. This can be developed into a style, such as that done by Nick Park of Aardman Studios. The characters designed for Chicken Run, as well as for the popular Wallace and Gromit animations, all have exaggerated mouths and teeth, increasing the expressiveness of their speech.

Another technique is to create a unique prop or clothing article that is always associated with the character. Actors often do this to get into their roles and to focus the attention of their audience. Keep in mind that you should avoid choosing more than one prop, because multiple props will split your audience's focus. One thing that most popular characters have in common is they are all pretty simple in their design. In the award-winning animation short Gerry's Game by Pixar, for example, the main character wears a simple dark suit, white shirt, and glasses. The main complexity in the character design is in the face and hands, which focuses viewer attention on the character's performance rather than on the attire. The main prop that drives the character's performance is the glasses, which Gerry constantly removes to change character.

To increase the realism of your character, make sure you gather plenty of photographic reference. Even if you are creating a surreal character, you can still base the design on a real human. If you study photos of a real human face, for instance, you will notice that they are not as symmetrical as often expected. Very few people actually have perfectly symmetrical faces. Instead, our noses are crooked, our eyes are different sizes, and our heads are not round. Using photographic reference can help you to incorporate these asymmetries into your character designs, which will make them look much more natural. You should also study anatomy books, and try to incorporate key anatomical features in your designs.

Creating Preproduction Designs

After roughing out some character ideas, the first main preproduction designs you should create are model blueprints. These are clean, clear drawings of your character's whole body from the front, side, and back views (see Figure 1.1). Pose your character in the traditional default pose with arms stretched out to the sides, and feet shoulder-width apart. You can choose to do a more relaxed pose, with the arms and legs and fingers bent, but this can make it more difficult to model and place skeleton controls. Moving the arms and legs of your character away from the body will be important when you later bind your character, because it will produce better weighting on the skin. Also, it places the arms and legs halfway through their range of motion, which will cause less stress on the geometry when they are deformed with skeletons into extreme poses. Other drawings you can include in the model blueprints are close-up views of your character's face from the front, side, and three-quarters views.

1.1. Create preproduction drawings that you can use as guides when modeling your character. The model blueprint should show your character in its default pose from the front, side, and back views (character designs by Carla Merrell).

Continue doing preproduction drawings by creating action poses for your character. These can be sketchier than the model blueprints, and should be of your character's entire body from several dynamic angles (see Figure 1.2). Choose poses that you may use in your animation, and that produce a good silhouette. Place your character's limbs in a variety of positions that will show the character's range of motion. These drawings should give you an idea of how the character will be deformed in your animation, which can be useful knowledge when creating both the skin models and the animation rig.

1.2. Draw dynamic action poses that show your character from many different angles (character designs by Carla Merrell).

Some other preproduction designs you should do are of your character's face in a variety of facial poses. You can create these using the face model blueprints as a guide. Try to make them all the same size, and orient them all straight ahead. Draw a variety of facial expressions that show your character's range of emotion (see Figure 1.3). You can later use these poses as guides for creating your character's blend shapes. As an additional option, you can create drawings of the mouth poses required to do lip-syncing, such as the shapes for saying O, E, I, A, U, and so on.

1.3. Drawing expressive face poses will make it easier for you to create blend shapes for your character (character designs by Carla Merrell).

Finally, because you are going to be creating a somewhat realistic character, you should make some preproduction drawings of the anatomy structures that will be inside your character's skin (see Figure 1.4). Again, you can use your model blueprints as a guide, and overlay where the bones and muscles should be placed. This will be useful for when you model the skin, so you can make sure it will be anatomically accurate, and it will make it easier for you to create accurate Maya skeletons during the setup process.

1.4. Overlay internal anatomy structures on your character designs to help you place bones and muscles during setup (character designs by Carla Merrell).

    [ Team LiB ]


Wrapping It Up

After you have your character designed, it is time to start modeling it in Maya. The next chapter takes you through the process of creating your character's skin in such a way that it can be successfully animated using skeleton deformers. In this process, you will learn how to create body parts using NURBS, polygons, and subdivision surfaces. So let's get started modeling!


Chapter 2. Modeling the Skin of a Biped Character

The first step to realizing your character designs in 3D is to create the skin of your character in its default pose, as detailed in your model blueprints (see Figure 2.1). This chapter shows you a process for creating your character's skin that involves working with all the major surface types in Maya. This process requires that you start by roughing out the main body parts for your character using NURBS surfaces. During this stage of the process, you take advantage of NURBS properties such as pickwalking across the UV directions on the surface as well as projecting, manipulating, and duplicating isoparms. After a basic NURBS skin is roughed out with the correct proportions, the next stage in the process requires that you separate your NURBS body parts into multiple patches you can stitch together to increase continuity between the surfaces. Creating tangency at the edges of NURBS patches enables you to convert them to a merged polygon skin. You then use polygon modeling techniques, such as creating edge loops and extruding faces, to add details that would have been inefficient to create on a NURBS skin. The last stage in the modeling process involves preparing your skins for rendering by converting the polygon skin to a smooth subdivision surface skin.

2.1. The first step to realizing your character designs in 3D is to model the skin in the default modeling pose (character model by Jonathan Mariucci).


Creating a Head from NURBS Surfaces

One of the most difficult body parts to create with NURBS surfaces is a character's head. Among other reasons for this difficulty, the head usually has the most recognizable features and requires that multiple openings be created for the mouth, nose, ears, and eyes. Beginning the modeling process by modeling your character's head with NURBS surfaces will be challenging and will give you a good idea of the strengths and limitations of this surface type. This section introduces you to using NURBS surfaces and shows you how to rough out a specific type of NURBS head from a simple primitive sphere (see Figure 2.2). You are then shown how to manipulate the surface in a variety of ways to create the details of your character's face, with a special focus on understanding edge placement and surface direction. When you understand how to model the NURBS head successfully, you will be able to apply the same modeling principles to the rest of your character's body.

2.2. In this section, you learn how to create a NURBS head from a simple sphere (character model by Shawn Rinehart).

Approaches to Modeling a NURBS Head

The two main surface types in Maya are NURBS and polygons. For the purposes of the modeling process described in this chapter, the subdivision surface type is considered an extension of polygons and is mainly used as a way to smooth polygons. A NURBS surface is composed of intersecting curves, whereas a polygon object is composed of a mesh of polygon faces. The difference between NURBS surfaces and polygon objects is similar to the difference between vector images and pixel-based images in 2D drawing programs. NURBS surfaces are like vector images in that they are surfaces interpolated from resolution-independent curves. Polygon objects are similar to pixel-based images in that they are dependent on the number of polygon faces for their resolution. A higher-resolution image requires more pixels, and a higher-resolution polygon object requires more polygons. In a practical sense, this means a NURBS surface can look smoother than a polygon object with the same number of points. You can easily see this by creating a NURBS and polygon sphere with 8-by-8 subdivisions. The polygon sphere has noticeably hard edges, whereas the NURBS sphere appears completely smooth (see Figure 2.3). Increasing the resolution of polygon objects inevitably increases your file size and can make it difficult to adjust anything related to the components, such as deformations when the skin is bound by skeletons. Traditionally, this caused artists to favor NURBS surfaces for characters used in high-resolution mediums, such as films, television, and game cinematics. Although this has changed recently with the advent of subdivision surfaces, which enable you to work with a low-resolution polygon that is automatically smoothed for rendering.

2.3. A NURBS surface (left) is always smoother than a polygon object (right) with the same number of points and subdivisions.

Many film companies, however, still use NURBS surfaces for creating high-resolution characters, and it behooves any modeler to fully understand how to create a NURBS skin.

The first thing to understand about NURBS surfaces is that they are two-dimensional rectangular surfaces created from intersecting curves. In other words, no matter how complex a NURBS surface appears to be, it can always be unwrapped to create nothing more than a rectangle, called a NURBS patch. The two directions of the curves on each NURBS patch are the U and V directions. To see a visual representation of the U and V directions, select any NURBS surface and choose Display, NURBS Components, Surface Origins. This displays the edge curve where the V direction begins as a green line and displays the edge curve where the U direction begins as a red line. Each curve that defines a NURBS surface, called an isoparm, must extend completely across one of these directions. Keep in mind that all NURBS surfaces are continuous, with all isoparms in a particular direction being the same length. You cannot cut a real hole in the middle of a NURBS surface like you can on a polygon object by deleting polygon faces. Using the Trim tool to cut a hole in a NURBS surface, for instance, only creates an optical effect where part of the surface is hidden. For this reason, trims will not be used for openings on a surface that require deformation, such as mouth and eye openings on a head.

The isoparms on a NURBS surface allow it to be deformed into a variety of simple shapes. For instance, you can bend a rectangular NURBS patch in the U or V direction until it meets itself. The bent edge can then be closed to create a cylinder (see Figure 2.4). If you bring the other two open ends of the cylinder around to close the other direction on the surface, you get a torus. A NURBS sphere is actually a cylinder whose open poles are pinched together only to appear closed, but are really open. Keep in mind when you are modeling your character that any single NURBS surface can only be deformed into variations of one of these four main shapes: a rectangle, cylinder, sphere, or torus.

2.4. You can deform NURBS surfaces into any shape that can be formed from a rectangle, which includes a cylinder, sphere, and torus.

Because of the inherent limitations in deforming a rectangle, a single-surface NURBS head is difficult to create. The most basic type of single-surface NURBS head is often called a vertical head, because the basic shape for the head is a vertical cylinder with open poles at the top and bottom (see Figure 2.5). The top pole is pinched to create the top of the head, and the bottom pole is opened to create the neck. Although this type of head is relatively easy to create because the isoparms contour the entire profile of the face, it has some inherent problems when deformed in an animation. The mouth opening is particularly difficult to animate because of the placement of isoparms. To define the sides of the mouth, you must add many horizontal isoparms, which then causes the isoparms to bunch together on the cheeks. This can have an adverse effect when deforming the mouth into a smile, for instance, because the isoparms can start crossing over each other, causing unnatural creasing on the cheeks.

2.5. A vertical NURBS head has the poles at the top of the head and the bottom of the neck. This type of head does not produce good animation results in the mouth area.

The best type of NURBS surface orientation for creating a deforming mouth is when the open pole of a NURBS cylinder is facing forward. This places one open pole within the mouth, and the other open pole is either on the back of the head or pulled down to create the neck opening. This head type is often called a radial head because the isoparms radiate out from the open mouth across the rest of the face. This orientation enables you to define each part of the mouth opening in the same way, making it easy and predictable to deform. You can run into the same problem as on a vertical head with the eyes, however, by trying to create eye openings from the vertical isoparms on the radial head. If you add isoparms to define the eye sockets, your head will have too many isoparms on the upper lip. To avoid this, you can add the eye openings on the radial head as two separate radial NURBS patches (see Figure 2.6). The edges of each patch must be lined up with the underlying head surface to achieve tangency so that the seam between the surfaces is not very noticeable. You also can place the edge of each eye patch so that it lines up with the socket of the eye to further hide the seam.

2.6. The radial head produces a better mouth structure, but it requires that you create the eye sockets from separate radial patches to avoid adding too many isoparms on the upper lip (character model by Maegan Walling).

The last type of NURBS head is one created from multiple rectangular patches. This type of head often resembles a patch quilt, in that all the rectangular NURBS patches are lined up to achieve a continuous-looking surface. There are three advantages to creating such a multipatch head. First, you can separate edges if necessary to create openings (see Figure 2.7). Second, you can re-orient isoparms on individual patches in ways that would be impossible on a single NURBS surface. Third, you can often achieve greater surface continuity during animation, because all the edges of the patches line up with each other. Keep in mind that each patch must have the exact same number of isoparms as its neighboring patch to line up perfectly and to create tangency between the patches.

2.7. A multipatch head is like a patch quilt, and has the advantage that seams can be opened (left), or individual patches can be re-oriented while still having the edges line up (right).

Other methods, such as a radial head with separate radial eye patches, can never achieve perfect surface tangency because the eye patches line up with the middle of the head patch, and the isoparms on the separate surfaces will never line up. This can show up as surface problems when deforming the patches with skeletons.

Even though you can create a multipatch head from scratch, it is much easier to first create a radial head with eye patches, and then chop the surfaces into many pieces to line up the edges. In the next section, you begin creating your character's skin by modeling a radial head, which will be converted to a NURBS multipatch head later in this chapter. In the early stages of modeling your character's head, you will import some of your character designs into Maya to use as guides during the modeling process.

Roughing Out a Radial NURBS Head

One way of beginning a radial head is to create a NURBS sphere so that its poles are pointing forward and backward in the Z-axis. The sphere should be scaled in X and Y to have the basic oval shape of a head. Then in the side view, the first few rows around the front pole of the sphere can be pulled back in Z to form a mouth cavity. To rough out the basic shape of the mouth, it is easiest to use the right mouse button to select and transform hulls rather than individual points. The hulls around the mouth cavity should be scaled and translated downward. You can add isoparms around the mouth to define the shape of the lips, being careful not to add too many at this early stage. Rotate the rows of points around the back pole of the sphere gradually downward until they are horizontal. Then detach the surface around the pole to create an open edge for the base of the neck (see Figure 2.8).

2.8. Begin a radial head by pulling the points around the front pole to create a simple mouth opening (left), and then detach and transform the back pole down to create the neck opening (right).

At this early stage of modeling your character's head, you want to build the overall shape gradually. Avoid adding too many isoparms in any one area, and try to achieve an even spacing of isoparms on all areas of the surface. Working in the side and front orthographic views, while using clipping planes, manipulate the components of the sphere to shape a basic nose, chin, forehead, and cheekbone. As you continue to shape the head in component mode, notice the points are on the hulls, not on the surface of the NURBS sphere. This can cause the points, otherwise known as control vertices (CVs), to be difficult to manipulate. This can be especially true around areas where the surface is heavily folded, such as on the lips. To more easily move across the component structure of the surface, use the arrow keys. The arrow keys enable you to select the next CV in the U or V direction of the surface, called pickwalking, while manipulating CVs. As you refine the head, keep in mind the eyelids will be added later as separate radial eye patches. To prepare for this, pull the points in the eye area below the brow back to create a slight indention. This gives you a space to place eyeballs and keeps the main head surface from having intersection problems with the overlying eye patches.

When roughing your character's basic head shape, it is a common technique to cut it in half to work on only one side of the model. Because the basic structure of a head is symmetrical, detaching and discarding one side of the head along the isoparms that run vertically down the center of the face will simplify the modeling process (see Figure 2.9). Then you can focus on manipulating points on the remaining half. To see how your developing face looks on both sides while you are modeling, just duplicate the half-head as an instance, and scale it –1 in X to mirror it to the other side. The instanced side of the head updates as you manipulate the components on the original source head. This technique works well for developing a basic symmetrical head for your character. Later, you will want to use your character reference to create variations on each side of your final head to make it more natural by adding some asymmetrical variations on each side.

2.9. Cut your head in half to make it easier to work on only one side of a basic symmetrical face.

When moving many CVs simultaneously, you may want to use the Proportional Modification tool. This can enable you to shape your head more naturally, by moving the CVs with a gradual falloff, instead of moving the entire group of CVs a constant amount. Do this by choosing Modify, Transformation Tools, Proportional Modification Tool [image]. Be aware that there are some new options for this tool in Maya 5. The World Modification Type is the traditional way of using the tool, which is based on moving only the group of CVs that you have selected. You will usually want to use either the Linear or Power options. The Linear option creates a falloff based only on the Distance value. Increase the value to move more CVs, which changes the shape of the falloff angle. Power has an additional Degree option that you can set with positive or negative values. Adjusting both the Distance Cutoff and Degree values changes the shape of the falloff angle. Setting negative values for the Degree option reverses the effect, making the CVs that are farther away from the tool move more than the center ones. With the tool activated, drag a selection box around some CVs on your model and translate the manipulator to see the propmod effect. In addition to using the World option, there is a new Parametric Modification Type that can be used with NURBS surfaces. In this case, only select a single CV to move. Other CVs on the NURBS patch around this CV will move based on their distance from the selected CV. All other options can be set in the usual manner. You can use this tool across seams to modify multiple NURBS patches. You also can create a similar effect by assigning deformers in the Animation module, such as a lattice, to your surfaces. Lattices can be assigned to objects or components and produce a similar falloff effect when the points of the lattice are manipulated.

Refining the Radial Head Without Manipulating CVs

One limitation of NURBS surfaces is that the control vertices or CVs do not sit directly on the surface curves, but instead sit on the hulls. This can make it difficult to tell which CV controls a particular part of the surface. In complex areas of the face, such as in the nose and mouth areas, CVs sitting on hulls can overlap each other. On a closed mouth, for instance, the CVs for your character's bottom lip will often be higher than the CVs for your character's top lip. This can be confusing, making it difficult to select the right CV for editing. You can use the arrow keys to pickwalk over the surface and eliminate some of this confusion, but you should also be aware of some modeling techniques and tools that enable you to manipulate NURBS surfaces without directly manipulating CVs on the hulls.

Although the CVs do not sit directly on the NURBS surface, there are points that do sit on the surface, called edit points (EPs). Unfortunately, the EPs on a NURBS surface cannot be manipulated. However, you can manipulate EPs on a NURBS curve. Therefore, you manipulate points on the surface by using a history connection to creation curves for the NURBS surface. Do this on your half-head by copying out the surface curves that radiate around the mouth, usually the V direction, and then loft the curves to re-create the surface with a history connection. Delete or hide the original half-head, and group all the NURBS curves under one node so that you can select them all simultaneously. With the curve group selected, in component mode you can then turn on EPs and turn off CVs in the component selection filter bar. This enables you to select and manipulate the EPs on the curves, which will deform the surface of your half-head through the history connection (see Figure 2.10). When you have finished manipulating the EPs, just delete history on the surface to remove the connection and delete the creation curves.

2.10. By using the history connection between curves and a lofted surface, you can manipulate EPs to refine your model.

You can use a couple of valuable modeling tools to manipulate a NURBS surface without having to manipulate CVs directly. The first is the Sculpt Surfaces tool, which is activated by selecting your half-head, and choosing Edit NURBS, Sculpt Surfaces Tool [image]. In the resulting Artisan Tool options box, adjust the settings for manipulating the surface (see Figure 2.11). For modeling an organic character, you should in most cases choose the first or second round brushes that have a smooth falloff. In the perspective view, painting with the Sculpt Surfaces tool gives you a very intuitive way of pushing and pulling points to refine the shape of your character's head after you have finished creating the main isoparm structure. Set the brush upper radius or hold down the B key to size your brush interactively. You should only set the lower radius if you are using a pressure-sensitive stylus. Adjust the Opacity and Max Displacement sliders to set how many points on the surface will move when you paint a stroke. In addition, set the Operation option to move points in the direction you want. In most cases, you will want to use the Normal option to push and pull points on your model perpendicular to the surface, just like you would if you were shaping a piece of clay. However, there will be times when you should use the other options for moving points according to the first normal direction of a stroke, or according to the global axis, or according to the U and V directions on the surface. Experiment with these different settings to see how they deform the surface. Use the Smooth and Erase operations to soften or reduce the effects of pushing and pulling points on the surface. Finally, if you need to move all the points on a surface in particular directions, set all your options as needed and click the Flood button.

2.11. The Sculpt Surfaces tool enables you to push and pull the surface using artisan brushes.

The other tool that you can use to manipulate a NURBS surface without directly selecting CVs is the Surface Editing tool. This is one of the most useful modeling tools in Maya, and every modeler should be thoroughly familiar with how to use it. With your half-head selected, activate this tool by choosing Edit NURBS, Surface Editing, Surface Editing Tool. The tool itself is an icon that sits directly on your NURBS surface with several handles sticking out of it (see Figure 2.12). The only option for this tool is the size, which you can adjust by double-clicking the Surface Editing tool's icon on the toolbar. When using this tool, it is best to enlarge the perspective view to full screen and make sure you have Shading, Shade Options, Wireframe on Shaded turned on. This enables you to see the structure of your surface in shaded view as you manipulate the tool handles. The main center icon is a large square sitting directly on the surface that can be translated to move that part of the surface. Click and drag the small blue cube next to this square to slide the tool across the surface to another position on the surface. There is also a long handle coming out from the center square icon that has a blue sphere, a second blue square, and another small blue cube icon sitting on it. This handle is oriented along one of the three main directions of the NURBS surface. Clicking the blue sphere changes the orientation of the handle to face along the U, V, or normal direction on the surface. (The normal direction is perpendicular to the surface and is sometimes referred to as the W direction.) Moving the square icon on the handle rotates points on the surface, whereas moving the small blue cube enables you to scale points on the surface. Manipulating these handles can give you a high degree of control over refining your NURBS character's skin to exactly the way you want it, without ever having to directly manipulate CVs.

2.12. Manipulate handles on the Surface Editing tool to manipulate the surface directly in a variety of ways.

Completing Your Character's Head

After refining your half-head so that it is close to finished, make it into a whole head to complete the details and add asymmetrical variations. Because an instance cannot be made into a normal surface, select and delete the instanced side of the head. Then duplicate the remaining half of your head, being sure to set the duplicate options to Copy rather than Instance and scale it –1 in X to mirror it to the other side. However, make sure the points running vertically down the open edges of each head are straight before duplicating. If they are not, select the hulls on the top and bottom edges and scale them in X until they are in a vertical line. Also, to ensure that the new half ends up in the right place in X, make sure you line the center of your half-head up with the open edge. To connect the two halves together, you just have to Shift-select both surfaces and attach them using Edit NURBS, Attach Surfaces. To attach both sides without adding any extra isoparms, set Blend as the Attach Method, with a .5 in the Blend Bias value. If you have any problems attaching, such as the top edge of one half-head attaching to the bottom edge of the other, you will need to specify the edges to attach by selecting the two top-edge isoparms in component mode before attaching.

Keep in mind that attaching the two halves of the head does not make it into a closed surface. The top edges on the forehead are attached, but the bottom edges on the chin remain open. It is important to close the head surface at the chin so that it doesn't split apart when the surface is deformed during animation (see Figure 2.13). Do this by selecting your character's head and choosing Edit NURBS, Open Close Surfaces [image]. It is often best to use the Blend option here also. Be aware that you only want to close the direction on the surface that will make the head a continuous surface at the chin, and not close the direction that creates the open mouth and neck. In most cases, this will be the V direction, but this really depends on your individual model. Notice that closing the head surface at the chin moves the seam to the side of the face. It is best to move it back to the center by selecting the isoparm on the middle of the chin and choosing Edit NURBS, Move Seam. Having the seam directly in the middle of the chin keeps both sides of the head symmetrical in structure, which makes it easier to continue modeling and for texturing. For instance, a symmetrical surface is required to use the Sculpt Surfaces tool's Mirror option, which creates two brushes on each side of the face while you sculpt in order to make symmetrical adjustments.

2.13. Even after attaching the two halves of the head, the seam at the chin is still open. It should be closed so that it doesn't show up when the face is animated.

It is best to create the eyeballs of your character before creating the eyelids, because you can then use the eyeballs as guides for shaping the eyelid sockets. Begin the eyeballs by creating a primitive sphere with the axis facing in Z. Create a second sphere that is offset to intersect the front of the first sphere and perform a subtract Boolean operation to carve out the colored part of the eye. This creates a separate indented surface that you can texture easily, and the surface will catch light on its edge. Finally, make the black iris of the eye as a small squashed sphere that fits in front of the indented colored section. The advantage of making the iris as a separate piece of geometry is that it can be scaled easily to make it larger and smaller, just like a real iris. If you really want to make the eye realistic, make one last sphere that encloses all the other parts of the eye. This sphere should be made completely transparent, but with a high specularity so that it reflects light, especially on the curved area that encompasses the iris. To finish your eye, make the transparent sphere the parent of all the other eye parts so that they can all be animated together easily.

The two main styles of eyelids you see on 3D characters are cartoon, which are noticeably separate surfaces from the main head, and realistic, which appear to have seamless continuity with the main head. To create a cartoon eyelid, in the side view you draw a curve around your eyeball in a 90-degree arc with a small hook at the end, and then revolve the curve 360 degrees in Y (see Figure 2.14). This creates the top lid, which you can then duplicate to create the bottom lid. Scale the bottom lid slightly smaller than the top lid and rotate it in X to place it over the lower part of the eye. Animating the cartoon eyelids is done by just setting keyframes on their X rotations.

2.14. Create a cartoon eyelid by revolving a hooked curve in Y. The cartoon eyelid will be rotated to open and close.

To fit the cartoon eyes onto your character's face, you can create a lattice around each eye. For instance, create a single group node parent named LtEyeGroup over the left eyeball group, and the two left eyelids. Then select the LtEyeGroup node and create a lattice by choosing Deform, Create Lattice [image] in the Animation module. Set the lattice Division options to 2 for simple squashing and stretching, or to higher numbers for more extreme deformations. It is not necessary to turn on local mode, but group the base and lattice together so that you can make them child to your head skeleton when you create your animation rig. Leave all the other options turned off. Finish your cartoon eyeball by selecting the lattice group in the hypergraph view, and then in the perspective view translate the lattice group to the eye area of your main head. Once positioned, select and translate lattice points to fit the left eyeball and eyelids into the face as needed (see Figure 2.15). Be aware that the lattice deformation occurs on top of the transforms, so you should still be able to rotate your eyeball and eyelids in the deformed state, without any intersection problems. For this reason, you should not delete the lattice after deforming the eyeballs into place, because then they won't close correctly.

2.15. Using a lattice to fit the cartoon eyeball into the eye socket enables you to still rotate the eyelids without intersection problems.

To create more realistic eyelids, you need to create a radial eye patch over each eyeball. You can do this in a variety of ways, including modeling it from a primitive sphere in a similar manner to the way you modeled the mouth on the main head surface. However, another technique is to make the head a live surface and draw a curve on it around the eye socket area. Use a cubic EP curve that you start and end at the same point under the brow. After creating, close the curve with a Blend set to a .5 Blend Bias. Then with the surface curve selected, choose Edit Curve, Duplicate Surface Curves to separate it from the main head. Make sure your eyeballs are placed as close as possible to their final position in relation to the face, and then use them as a guide for placing additional eyelid curves. Turn off the live surface head and duplicate the surface curve several times, moving and scaling each duplicate to contour the surface of your eyeball (see Figure 2.16). Pull the last few curves back to create the edge of the eye opening. After placing all your curves correctly, Shift-select all the curves in order from the surface curve to the last one on the edge of the eye and loft the curves to create the eyelid patch.

2.16. Create a realistic eyelid by drawing a curve on your head surface, and duplicate it several times to contour the eyeball. Then loft the curves to create the eyelid patch.

Be careful not to let the isoparms on your eyelid twist too much as they go from the head surface to the eye socket. You can group the creation curves to continue refining the patch by moving points on the curve using the history connection. At some point, you want to delete history on the eyelid surface, and add or delete isoparms as necessary to clean up the surface. It is important when you are building NURBS surfaces to space the isoparms as evenly as possible across the surface. Additional isoparms should only be added to create changes in direction on the surface, to harden an edge, or to create a wrinkle. On your eye patch, for instance, the isoparms that radiate out from the eye socket should be evenly spaced, but you may add some extra isoparms in the other direction to create the eye fold. You can create a more regular surface by rebuilding the surface as Uniform parameterization, but that can sometimes adversely remove important details. It is sometimes better to just select the isoparms you want to remove and delete them.

You also can create a NURBS ear as a separate radial patch that sits on top of the main head surface. Another way to create radial surfaces is to revolve an EP curve a full 360 degrees, and then modify the surface into the shape you want. Draw a curve that creates the basic shape of the cavity and outer edge of the ear, revolve it, and then modify the resulting surface to have more of an irregular ear shape (see Figure 2.17). Proportional modeling or a lattice makes it easier to form the ear. Like the eye patch, you need to create tangency between the outer edge of the ear patch and the main head surface. Be aware that using the V key to snap CVs to other CVs on the middle of a NURBS surface will not create tangency between the surfaces. The reason for this is that the two surfaces have very different isoparm structures, and because the CVs you are snapping together are not sitting directly on the surface. Snapping CVs only works well on the edges of two NURBS surfaces that have the same UV structure, such as in a multipatch model as described later in this chapter. Lofting from an EP curve that was drawn on a live surface,to however, produces better tangency because the EPs can be drawn directly on the surface. Keep in mind that even though you may have created the body parts separately, at any time you can copy out the isoparms to reloft with a curve drawn on the main surface. This enables you to make a good connection between the surfaces that will appear continuous. Due to the differences in the drawn and copied curves, however, the resulting NURBS patch will have extra isoparms that should be cleaned up. Do this by rebuilding the surface, or by manually deleting isoparms after deleting history on the surface.

2.17. Revolve a curve to create a basic ear shape, and then modify it to form a basic ear for your character.

Exercise 2.1
Create Your NURBS Character Head

This exercise gets you started on creating the head for your NURBS character. It takes you through the process of modeling a single-surface main head with a radial mouth and two separate radial eye patches. In addition, you add some eyeballs and separate radial ear patches to complete the head.

  1. Begin your character's head by carving out a mouth and neck from a simple NURBS sphere. Choose NURBS Primitive, Sphere [image], and set the object pivot Axis option to Z. Make sure you are creating a complete sphere with an End Sweep Angle of 360 degrees, and a Cubic surface degree for a smooth NURBS surface. Finally, set the Sections and Spans options to 12, and click the Create button. You should see a sphere with its poles pointing forward and backward in Z. Scale the resulting sphere in X so that it is around 6 grid spaces wide, and then scale it in Y so that it is slightly taller than it is wide. When the sphere is sized correctly, choose Modify, Freeze Transformations.

    Right-click the sphere and choose Isoparm to switch to component mode with the isoparms visible. Click one of the isoparms surrounding the front pole, and drag to create a yellow dotted line between the first and second isoparm. Choose Edit NURBS, Insert Isoparms [image], and make sure the options are set to insert the isoparm At Selection. Also make sure the Increase by Multiplicity option is set to only 1, and click Insert. This creates an extra row of isoparms on the front of the sphere, close to the area where the lips will be formed. Then right-click the surface to switch to Control Vertex, and in the side view drag a selection box around the front pole and first two rows of CVs. Translate the selected CVs back in Z past the center of the sphere (see Figure 2.18). Do not line them up with any other rows of CVs, so that they will be easier to select again if needed. Then select the next row of CVs on the front of the sphere, and scale them down in X and Y to form the mouth opening. When the CVs are in the shape of a mouth, use the Ctrl key to unselect the side vertices in the front view, and translate the top and bottom vertices forward in Z to form a top and bottom lip. To place the mouth lower on the face, in the side view select the several rows on the front of the sphere around the mouth, Shift-select the CVs at the back of the mouth, and translate them all down slightly.

    2.18. Add an isoparm to the front of your sphere, and translate back the first few rows of CVs to carve out the mouth cavity.

    Add a couple more isoparms around the mouth opening to further define the lips and chin. In the side view, select and translate CVs to curve the isoparms around the mouth, which will ultimately create the nose and chin protrusions. Build the details of the face gradually by adding isoparms one at a time, and then move the new CVs into place. In the front view, you want to scale the points on both sides of the face so that the isoparms are oriented more vertically on the chin and upper lip. A row of isoparms should be added on either side of the center isoparm on both the lower and upper parts of the face to better define the bridge of the nose and the chin. While going through the process of adding isoparms and positioning CVs, you can press the G key to repeat the insert isoparm operation. When roughing out the basic head shape at this early stage, try to use mainly the front and side views to make symmetrical changes. At this point, however, do not be concerned if isoparms on both sides of the face are not perfectly symmetrical, because you are going to discard one half of the head in the next stage of the process.

    To form the neck of your character, in the side view select the second vertical isoparm on the back of your head, and choose Edit NURBS, Detach Surfaces. This should cut the head into two pieces. Select and delete the back piece to create a circular hole in the back of the head. Switch to hulls component mode, and select the two hulls closest to the detached hole. In the side view, translate, rotate, and scale the hulls downward so that they create a horizontal neck opening. Modify the hulls at the middle of the head so that they continuously rotate toward the neck, and then insert and transform additional isoparms between the head isoparms and the base of the neck to improve the shape. Switch to control vertex mode to move CVs in the neck and chin areas to create a smooth transition from head to neck. Also, move CVs on the top of the head to further approximate an accurate head shape (see Figure 2.19).

    2.19. After rotating the back of the head down to create the neck opening, continue adding isoparms and moving points to create a smooth transition from head to neck.

    After creating the basic head and neck structure, you can begin developing the face of your character. Because the face can be symmetrical through most of the stages of the modeling process, you can use the popular technique of cutting your head in half to work on only one side of the face. It is much easier to do this than trying to select and move CVs on both sides of the face. Remove one half of your character's head by selecting the isoparms going straight up and down the center, and choose Edit NURBS, Detach Surfaces. This should cut the head into two equal pieces. In the front view, select the piece on the left side and click the Delete key. It will be difficult to achieve accurate proportions if you can't see both sides of your head while modeling, so select the remaining half and choose Edit, Duplicate [image]. Set the Duplicate Geometry Type options to Instance, and set the first Scale field to –1. Clicking the Duplicate button creates an instance of your half-head and scales it –1 in X to mirror it to the other side. An instance has no component structure of its own, but instead takes its shape from the source object you duplicated. This causes moving components on the original surface to move the same area on the instance. To try this, select and translate some CVs on your original half-head. Notice that the same CVs become highlighted on the instance, and they are edited to reflect the changes you make to the source object (see Figure 2.20).

    2.20. Create an instance copy of your half-head that is scaled –1 in X to see both sides update while you are modeling half the head.

    Before continuing to model your head, set up your Maya interface for modeling the face more easily. First, on the top menu bar of your front view, adjust the clip plane by choosing View, Camera Attribute Editor. In the Camera attributes for the front view, set the far clip plane to around 100. Adjust the number as needed until it hides the back of your character's head, so you can only see and select CVs on the front of the face. Doing the same thing in the side view should not be necessary, however, because your model is cut in half. You also can create shelf buttons for frequently used clip plane settings by copying to the shelf the MEL commands Maya runs for them. After setting a clip plane, open the Script Editor and look in the gray History field to view the clip plane MEL command. For instance, the command for setting the front view's far clip plane to 100 should look like this:

    setAttr "frontShape.farClipPlane" 100;

    Highlight the code in the History field with your left mouse button and drag it to the shelf with the middle mouse button. This creates a shelf button that you can click whenever you want to change the front view's far clip plane setting. Create several buttons with different settings for the front view's far clip plane, such as 1000, 100, and 97. You can give the shelf buttons short text names by clicking the drop-down arrow to the left of the shelf to open the Shelf Editor. Pick the new button in the Shelf Contents list and type in a short name in the Icon Name field. In addition to creating far clip plane shelf buttons for the front view, you can create near clip plane shelf buttons that enable you to see and select only CVs on the back of your character's head.

    You also can create a shelf button to set your NURBS to a custom display resolution. Currently, pressing the 1 key sets your NURBS head to low resolution in both wireframe and shaded modes, and pressing the 3 key sets the NURBS head to high resolution. The problem with this is high resolution shows too many interpolated isoparms in wireframe mode. To set a custom resolution that shows fewer isoparms in wireframe display mode while still looking smooth in shaded display mode, you must modify the MEL commands shown in the History field when you do both operations. Your custom code will set the NURBS wireframe display resolution to be low, while also setting your shaded resolution to be high. Do this in the Script Editor by finding the command that occurs when you press 1, which should look like this:

displaySmoothness –divisionaU 0 –divisionsV 0 –pointsWire 4
  –pointsShaded 1;

    Highlight the command and middle-mouse drag the line of code to the shelf. Then to customize the code, open the Shelf Editor, click the new command in Shelf Contents, and switch to the Edit Commands tab. Then change the –pointsShaded value to 4, so the command reads like this:

displaySmoothness –divisionaU 0 –divisionsV 0 –pointsWire 4
  –pointsShaded 4;

    Click the Save All Shelves button to exit the Shelf Editor. Finally, try out your new button. Selecting your head model and clicking the button should display it in low resolution when displayed in wireframe mode, and high resolution when displayed in shaded mode. You can then set your front and side views to wireframe mode, and set your perspective view to shaded mode to see as you work how your high-resolution skin looks.

    One other thing you can do to prepare for finishing your head is load your character designs from Chapter 1, "Creating Organic 3D Characters," into Maya as image planes. First, save your designs as separate JPEG images for the front and side views of your model blueprints, and then load them into the front and side views to use as image plane guides when modeling. For instance, open the front view's Attribute Editor again, and open the Environment section. Click the Create button to create an image plane for the front view. Inside the image plane's attributes, click the folder icon next to the Image Name field to load your front character design image. Set the image plane Display option to looking through camera, which will only display it in the front view. To adjust the size and placement of the image plane, change the Center, Width, and Height options in the Placement Extras section. For instance, you can move the image plane forward in Z by typing in a positive number in the third Center field. Or, make the image plane larger by typing bigger values in the Width and Height fields. You can also adjust these numbers in the channel bar under the front camera's Inputs.

    Keep in mind that you also could create a primitive NURBS plane with a setting of 1 for the U and V patches and assign a file texture to it. Do this by creating a Lambert material in the hypershade view, and assign your model blueprint as a file texture to the Color attribute. You can then use it as modeling guide by turning on hardware texturing in shaded mode in any of the views. One advantage of this is you can easily transform the plane to fit your model, or rotate the plane to unusual angles, such as for a three-quarters view of your character's head. The disadvantage is that the guide doesn't show up in wireframe mode, but must be used in hardware texture shaded mode. Either way, using image planes or file-textured planes is important for making sure you model the basic proportions correctly for your character's skin (see Figure 2.21). After adding all your modeling guides, you are ready to start refining your head model.

    2.21. You can use image planes or file-textured planes to use your character model blueprints as guides for modeling your character's skin (character design and model by Carla Merrell).

  2. Begin refining your half-head by inserting isoparms and manipulating CVs. When manipulating hulls or CVs, use the arrow keys to pickwalk across the surface of your character's head. This is the best way to find your way around the U and V of the surface, by using the arrows to take you to the next CV in each direction. Work on refining all parts of the head, building the details gradually, and being careful not to add too many isoparms in any one area. You want a fairly even spacing of isoparms across the entire surface, so avoid creating areas where the isoparms bunch together or areas where the isoparms are too spread out. Later, after you have roughed out all the basic proportions evenly, you can add extra isoparms closer together to harden an edge, such as to better define the edge of your character's lips.

    Try to simplify the surface down to the minimum number of CVs for defining each feature. For instance, a basic nose shape can be defined by a maximum of five vertical isoparms (see Figure 2.22). The first is the center isoparm that defines the profile of the nose. Place an isoparm next to this one to define the bridge and ball of the nose, as well as to pull up an indention for the nostril. The next isoparm should create the side of the nose, and the one after that should flare out the edge of the nostril. Finally, the fifth isoparm defines where the nose connects to the rest of the face. This last nose isoparm should create the roundness of the edge of the nostril, by pushing skin back into the cheek. While creating your character's nose, make sure you orient the vertical isoparms in the cheek area so that they wrap back toward the eye area as much as possible. It is also important to make sure you orient the isoparms that radiate around the mouth so that they are horizontal on the nose and forehead. Ideally, they should contour the brow line and forehead wrinkles. At this point, do not create any eyelids and eye sockets, because these will be done using separate radial patches. Just push the surface back in the eye area to create an indention that the eyeball will sit within and the eye patches will sit on top of.

    2.22. When roughing out the proportions of your head, try to add only the number of isoparms required to define each feature. For instance, use only five vertical isoparms to define the basic nose shape.

    After adding enough isoparms to define the basic structure of the half-head, you can begin to use the other tools and techniques described earlier in this section to manipulate the surface without having to manipulate CVs directly. These include the Sculpt Surfaces tool and Surface Editing tool in the Edit NURBS menu, as well as the technique shown for manipulating EPs on curves that are copied from the U or V of your surface and lofted with a history connection.

  3. When you are happy with your basic half-head shape and features, you need to make it into a seamless whole head. First delete the instance half-head, because it cannot be used as an independent surface. Then rebuild your half-head to ensure that it can be attached correctly. Do this by selecting the surface and choosing Edit NURBS, Rebuild Surfaces [image]. Set the Rebuild Type option to Uniform, the Parameter Range to Keep, the Direction to U and V, and the Keep option to CVs. Make sure you are also creating a cubic surface in both directions, and click the Rebuild button. These options should make your half-head a uniform surface, while not changing the isoparm structure. If you make sure your head is a uniform surface, you can most likely avoid any error messages when you attach and close the seams on your character's head.

    Then duplicate your half-head again, but be sure to set the duplicate options to create a Copy rather than an Instance. You also want to scale the copy –1 in X, which you can do by setting it in the duplicate options, or done manually in the Channel Box. Keep in mind that scaling –1 in X is mirroring the half-head in X based on the center position. To have the two sides of the head line up perfectly, the open center edge of your half-head and its center must be at 0 on the X-axis. Make any needed adjustments by scaling the center row of CVs to line them up correctly or by moving the object center in insert mode, before duplicating and mirroring your half-head. After you have lined up your two half-heads as closely as possible, attach the two halves by right-clicking to switch to isoparm selection mode, and then drag a selection box around the isoparms on both halves that overlap on the center of the forehead so that they turn yellow, and choose Edit NURBS, Attach Surfaces [image]. Explicitly selecting the isoparms on both surfaces that you want to attach should force Maya to attach the correct open edges. Otherwise, Maya might try to connect the forehead edge of one half to the chin edge of the other half, depending on the UV directions of each surface. In the Attach option box, set the Attach Method option to Blend, and type .1 into the Blend Bias option field (see Figure 2.23). Click the Attach button to make the seam at the forehead disappear as the two halves are attached.

    2.23. When attaching the two halves of your head, you can avoid surface twisting problems by selecting the isoparms you want to attach.

    If you have any problem attaching, such as a twisting of surfaces, you should make sure the U and V are going in the same directions on each surface. You can check this by Shift-selecting both surfaces and turning on their surface origins to see a colored representation of the U and V directions on the surfaces. With surface origins turned on, a red edge shows where the U direction begins on each surface, and therefore also indicates the direction that the U is going. The start of the V direction is indicated by a green edge. To have both half-heads going in the same direction, the red line would need to be on the top edge on one half, and on the bottom edge on the other half, with the blue normal direction going outward on both halves. This ensures that the surfaces are going in the same direction, and should make them always attach correctly. To make this adjustment on one of your half-heads, select it and choose Edit NURBS, Reverse Surface Direction [image]. In the options box, try reversing the U or V individually. Completely changing the directions on the surfaces by using the Swap option is usually not necessary on a mirrored head. When the surfaces are going in the right direction, select the isoparms on the forehead edges and try attaching them again.

    Even though the halves are attached, they are not completely merged into one continuous head. There is still an open seam at the chin that needs to be closed so that the surface won't separate during animation. Do this with the head still selected by choosing Edit NURBS, Open/Close Surfaces [image]. Set the options to close the head only in the direction that is radiating around the mouth. Closing in the wrong direction will close your neck opening. Try the V direction first, and if it is wrong, undo and choose the U. When the chin seam closes, you will see it move from the center to the side of the chin. Move it back to the center of the chin by selecting the center chin isoparm and choosing Edit NURBS, Move Seam. This is the point where you will get an error message if you did not rebuild your half-head to a uniform surface before attaching. If you do get an error message, undo the Open/Close Surfaces operation so that the seam is back on the middle of the chin, and rebuild the surface as uniform. Otherwise, the seam should move to the center of the chin when you do the Move Seam operation, which will be better for texturing and using the Sculpt Surfaces tool with the Reflection option turned on. You can find this option in the Tool Settings box under the Stroke tab. This option will prove useful for making symmetrical adjustments to both sides of your character's face. Finally, name your finished head model HeadSkin, and delete history by choosing Edit, Delete by Type, History.

  4. The next step in modeling your head is to create eyeballs and radial eyelid patches. Hide your head so that it is not in the way and begin a NURBS eyeball by creating a primitive sphere with 10 spans and sections, and its axis pointing in Z. Duplicate the sphere, and translate the copy forward so that it intersects the front of the first sphere. Make sure you do not still have a –1 setting in the X scaling of your duplicate options, because this will affect the result of the Boolean operation. Position the spheres so that the area that the spheres intersect is the size that you want the colored part of your eyeball to be. Then choose Edit NURBS, Booleans, Subtract Tool. Click the first sphere and press the Enter key, and then click the second sphere to perform the Boolean operation. The second sphere disappears as the first sphere is carved out by a spherical indentation (see Figure 2.24). You can still select the second sphere in an outliner view to adjust the size of the carved-out area.

    2.24. Intersect two spheres to do a subtract Boolean operation (left), which will carve out the colored section of your eye (right).

    When the colored area is the right size, select the Boolean node in the outliner and delete history. This deletes the original surfaces and makes the new Boolean surfaces into just two regular NURBS surfaces. Unparent both pieces of the eye from the Boolean node in the hypergraph view and delete it. Name the surfaces LtEyeWhite and LtEyeColor, and make LtEyeWhite the parent of LtEyeColor. Before going on to the other parts of the eye, right-click LtEyeColor to open the Attribute Editor, and increase the U and V resolutions of the surface. When you do a Boolean operation, the tessellation of the resulting surfaces is set lower than the resolution on the original spheres. To set it back up to the default resolution, open the Tessellation tab, and type a 4.5 value into the U and V Divisions Factor. This makes your eyeballs render at the same resolution as your other surfaces.

    For now, open a hypershade view and place a basic white Phong material on LtEyeWhite, and a basic colored Phong material on LtEyeColor. An indented surface for the colored part of the eye causes it to catch the light nicely, giving the eyes of your character a little life. Later, you should connect a ramp to the Color attribute of the colored part of the eye, or load a file texture to create a more realistic eye color. In addition, the indented surface creates a space to insert the black iris part of the eye as an object, rather than as a texture map. Do this by creating another sphere, translating and scaling it so that it fits inside the indented area (see Figure 2.25). Squash it in Z so that it is not a perfect sphere and doesn't intersect with the colored part of the eye. Place it so that it completes the roundness of the eye when seen in the side view. The advantage of using an object for the iris, rather than just a texture map, is that it will be very easy to animate the scaling to make the iris get larger and smaller. Assign a Lambert material to the iris, with all the color values brought down to black. Name this part of the eye LtEyeIris, and make it child to LtEyeColor.

    2.25. Transform a squashed sphere so that it fits within the indented area to create the black iris for your character's eye.

    To finish the eyeball, create another sphere that you scale so that it surrounds all the other pieces of the eye. Add a couple of isoparms on either side of the radial isoparm that is closest to the edge of the colored part of the eye. Because a real eyeball is not perfectly round, you should scale these isoparms so that they form a ridge contouring the colored part (see Figure 2.26). This part of the eyeball should be mostly transparent, so create a Phong material that has the Transparency, Specular Color, and Cosine Power attributes pulled almost all the way up. This creates a glassy material with a small, strong highlight, which brings out the edge you created around the colored area. Name this part of the eye LtEyeWhole, and make it parent to LtEyeWhite. Finally, create a point light in your scene and render the eyeball to check how it looks. Then unhide your head and move the left eye hierarchy into the left indented area on your head. Place it where you think the eye should go, and scale it as needed. Duplicate it when you get it into place, name the new eyeball appropriately, and translate it in X to position the other eye. Freeze transformations on both when they are in place. You can now use the eyeballs as guides for creating your eyelid patches.

    2.26. Surround the eyeball parts with a transparent sphere that is deformed to have a ridge on the front (left). This produces a highlight around the colored part of the eye when rendered (right).

  5. Create a radial NURB eye patch by drawing a curve on the surface of your main head that can be lofted with other curves that contour the eye. Duplicate the main head first, and name the copy LiveHead. With Live Head still selected, make it live by choosing Modify, Make Live. Using a copy will enable you to see the surface better in shaded view. Then draw an EP curve around the eye socket area by choosing Create EP Curve Tool [image]. Make sure you are using a 3 Cubic degree setting with Uniform knot spacing. Start drawing the curve under the brow, and contour the isoparms on the face that form a rectangle around the eye. Avoid adding too many points, but stay close to the resolution of the main head. Stop drawing the curve just before you return to the starting point, and press the Enter key to create the curve (see Figure 2.27). Then close the curve by choosing Edit Curves, Open/Close [image]. Set the close Shape option to Blend with a bias value of 0. When the curve is created deselect it, and turn off the live surface by choosing Modify, Make Not Live.

    2.27. Draw an EP curve around the eye socket area on your live radial head to begin creating an eye patch.

    If you look in a hypergraph view, you will notice that there is no transform node for the curve you just created. It is actually part of the head surface, and must be duplicated to create a separate curve from the head. Just select the surface curve and choose Edit Curves, Duplicate Surface Curves. This creates a curve that has its own transform node in the hypergraph view. Name the new curve EyelidCurve1, and duplicate it to create a second curve named EyelidCurve2. Translate and scale EyelidCurve2 so that it is slightly smaller than EyelidCurve1, and offset so that it rises off the surface toward the front of the eyeball. Continue duplicating and transforming to create the rest of the curves for the eyelid. Scale each duplicated curve so that it is smaller than the previous one, and translate them so they form the eyelid shape around the colored part of the eyeball. The curves should gradually rise away from the face, and then go back in around the eyeball to create a lip for the eyelid. To better see the surface you are creating, loft all the curves and group the curves to use the history connection to refine the lofted surface. When Shift-selecting the curves to perform the loft, make sure the first curve you select is the curve you created on the live head surface, and the last curve you select is the one closest to the eyeball. Then choose Surfaces Loft [image] and set the options to Uniform parameterization. Do not close the surface, and make sure you are creating a complete cubic NURBS surface.

    Select the curve group to move EPs on the curves, which will in turn modify the eyelid surface. Try to make sure the isoparms radiate evenly from the eye socket, and make sure you remove any twisting or stretching of isoparms around the eyeball. Then delete history on the surface and hide the creation curves group. Add or delete isoparms as needed to create a clean surface structure, complete with eye fold (see Figure 2.28). If necessary, rebuild the eye patch as a uniform surface in the direction that radiates around the eye, setting the Uniform rebuild divisions to the same number as will line up with the corresponding isoparms on the face. This makes it easier the line up the surfaces when you create a multipatch head later in this chapter. When finished, delete history and duplicate your finished eye patch, scaling it –1 in X to mirror it to the other side of the face. Name the eye patches of your character's head LtEyePatch and RtEyePatch.

    2.28. Clean up your finished eye patch so that the isoparms are straight, and match the head isoparm structure as much as possible.

  6. You also can create a simple ear as a radial patch that sits on top of the head. This time, you create the patch by revolving a profile curve that you draw in the top view. Draw the curve so that it defines the basic hole and edge of the ear. Make sure you start the part of the curve that creates the ear cavity at the 0-axis, and draw the rest of the curve down the negative Z-axis. Revolving the profile curve creates a very regular surface that looks more like a hubcap than an ear. Use the Proportional Modification tool or a lattice as described earlier in the chapter to modify CVs with a falloff, and shape the surface to more resemble an ear. Keep in mind that there are more complicated ways of making ears, such as making nonradial ears that are composed of multiple patches. However, ears are usually minor details on the head that are not scrutinized much by viewers. Often, they are obscured or entirely covered by hair. So normally it is not necessary create highly detailed ears that are completely anatomically accurate. After revolving your curve, delete history on the surface and use all the tools and techniques described earlier in the chapter for moving points to refine the ear shape. Add isoparms as needed while you are working. After creating the ear patch, position it on the head and copy out the surface curves. Then make the main head a live surface and move EPs on the ear curve that should connect the ear to the head. The EPs should snap to the head surface, which will improve tangency. When done, turn off the live head surface and reloft the ear curves. Finally, duplicate and scale the finished ear patch to mirror it to the other side of the head, and name the surfaces LtEarPatch and RtEarPatch. Even though the ears are a minor detail on your character's head, they are important to completing the look of your finished radial head (see Figure 2.29).

    2.29. Shown here is an example of a finished radial ear patch (character model by Travis Burcham).


Modeling a NURBS Torso and Limbs

In this section, you will learn techniques for creating your character's body parts. A special emphasis will be placed on orienting the isoparm structure on each NURBS surface so it will bend correctly during animation. Techniques will also be shown for creating tangency between NURBS surfaces with very different surface orientations. This will make it possible to make surfaces that cannot be attached still appear as continuous organic surfaces.

Roughing Out a NURBS Torso

As you are modeling the various body parts for your character, keep in mind that where you place the edges or poles of each body part determines the isoparm orientation and determines how well your character will deform when animated with skeletons. No matter how good your character model looks when static, it will only bend correctly if you place isoparms in the correct places at all the joints. When creating your character's body parts, avoid stretching isoparms in unnatural ways across areas that will bend. Because NURBS surfaces are rectangular shapes, for instance, it is impossible to make a NURBS torso with branching limbs from a single NURBS patch. You therefore must position several separate NURBS surfaces together to create a torso with limbs. Now it's time to examine the two main ways you can create a simple NURBS torso from spherical or cylindrical patches, and thereby ensure the surfaces bend correctly during animation. Keep in mind that the torso must bend mainly at the waist, and the arms must bend at the shoulders and elbows.

You can create a single-patch torso from a spherical shape, with both poles either placed vertically or horizontally (see Figure 2.30). The vertical torso has an open pole at the top to form a neck and a pinched pole at the bottom. The isoparms on this torso go straight across the stomach area and will deform the waist correctly during animation. It would be a bad idea, however, to expand the upper part of the torso to create arms. This would stretch the isoparms in an unnatural manner across the arm joints and would not bend well at the shoulders or elbows. On a horizontal torso, the two open poles are placed at each wrist, and the isoparm structure lends itself to bending at the elbows and shoulders. However, you would have a problem bending the waist if you were to try to stretch the middle isoparms vertically. In both of these cases, it is better to create new surfaces with the correct isoparm and edge placement for animating the joints. On the vertical torso, you would loft cylindrical arms from each side of the surface, and on the horizontal torso, you would loft a cylindrical neck and waist from the top and bottom. You must use tangency techniques to make the separate lofted surfaces appear continuous with the main torso cylinder. Because you cannot actually attach an open NURBS edge to the middle of a NURBS cylinder, it is impossible to attach the torso to the limbs using this method.

2.30. You can place the poles for a single-surface torso vertically (left character model by Adam Smith) or horizon tally (right character model by Eliezer Zayas). This requires lofting branches from closed NURBS surfaces to avoid stretching or distorting the isoparm structure on the joints.

Although you can create most of your NURBS body parts in the same way you created the head, by refining a NURBS primitive sphere or cylinder, you can use other methods. One technique is to rough out the shape of the body part with several NURBS primitives, such as a NURBS sphere, and use the roughed out shape as a live surface guide for drawing curves. You then loft the curves to create the final NURBS body part. When roughing out the shape, transform the spheres in any way you like, without worrying about isoparm structure or whether they intersect with each other. Think of the NURBS spheres like pieces of clay used to build up the correct proportions of each body part. To create a muscular vertical NURBS torso, for example, you can create one large sphere for the basic shape, and then add smaller spheres for the chest muscles, ribs, clavicle bones, and stomach muscles (see Figure 2.31).

2.31. You can rough out the shape of your torso by placing spheres to represent muscles and protruding bones.

Because you can't make multiple NURBS surfaces a live surface, and because you cannot attach NURBS spheres in any way but at the open poles, you must make them into a single polygon object to use them as a live surface guide. Do this by converting them to polygons using the quad and standard settings, combine them, and then delete history. As a guide object for drawing curves, it doesn't matter whether there are internal polygon faces on the torso model. Make the surface live by selecting it and choosing Modify, Make Live. The live polygon should change to a green wireframe object, which then enables you to draw EP curves that snap directly onto the live torso surface. To create a vertical NURBS torso, draw the curves vertically from top to bottom, making sure to place points wherever there is a change in surface direction, such as a bump or crease, on the polygon object (see Figure 2.32). To see the polygon torso guide better, you can duplicate it before making it live so that you also have a nonlive shaded polygon.

2.32. Convert the spheres to a single polygon object and use it as a live guide for drawing EP curves that you can then loft to create your vertical NURBS torso.

After drawing creation curves for one half of your torso, Shift-select and loft them to see the result (see Figure 2.33). Because of the history connection, you can continue to adjust the points on the creation curves to make the isoparms align across the surface better. When you are adjusting the EPs on the curves, make sure you move them by selecting the center of the move component icon, which forces the EPs to continue sticking to the live polygon torso. Moving points by selecting the arrows on the move component icon causes the EPs to move off the live object. As mentioned earlier in this section, try to avoid creating horizontal isoparms that are stretched too much vertically on the torso. To ensure a good surface structure, it is best to loft curves that have the same number of points. Otherwise, you will get unpredictable results with more isoparms than are needed. The best way to avoid this is to duplicate the same curve to create all the torso curves, and move points on each curve to snap them to the surface. Lofting duplicated curves creates a predictable surface where numbered CVs on each curve line up perfectly with the same-numbered CVs on other curves. This creates a better surface, but is more time-consuming to create. You can continue to refine your torso surface by moving components on the curves, or by deleting history and manipulating the surface in the same way you refined your head. After finishing one side of the torso, duplicate, mirror, and attach it in the same way as done in the previous section for your main head surface.

2.33. Loft the curves snapped to the live polygon guide to create half your vertical torso.

This is just on example of how to use a live object for creating your character's body parts. The advantage of this method is that you can quickly rough out the correct proportions for each body part using simple spheres, without worrying about isoparm structure and extraneous surface details. You also can use this method to create the main sections of your arms and legs. For instance, place spheres for an arm, convert them to a single live polygon object, draw EP curves that go from the shoulder to the wrist, and loft the curves to create the arm. In the next section, you learn several ways to make the cylindrical arm surface appear connected to the vertical NURBS torso. Keep in mind, however, that there is no way to actually attach and make one object out of the arm and torso while still remaining NURBS surfaces. Because a NURBS surface must always remain a rec tangle, it can be attached only to similar surfaces that will expand a particular edge of that rectangle. Therefore, branches off a main trunk, which would create a nonrectangular shape if attached, will always be separate surfaces.

Lofting Limbs from a Torso Surface

There are other ways to create curves on a NURBS surface for the purpose of lofting a new branch off the surface. To create an arm branching off your vertical torso, for instance, one way is to project a circle onto the torso and loft from the curve projected on the surface across several arm curves. With your torso and arm already created, you first copy out the curves on the arm going from the shoulder to the wrist. Make sure there is a gap between the first shoulder curve and the torso surface. Also, make sure that the closed seam for the torso is placed directly on the center of your character's backbone and not on the sides where you are going to be projecting the curve. The reason for doing this is that projecting a curve on to a seam splits the curve on surface into multiple curves, which makes it impossible to loft with the arm curves. Then duplicate the curve that is closest to the torso and move it slightly to make it easier to select. The duplicated curve will be projected onto the surface, rather than projecting the arm curve directly, which will then be lofted to create the arm skin. This step is necessary because you want to be able to transform the projected curve to adjust the curve on surface through a history connection. Also, it is best to project a duplicated curve instead of creating a new curve, because it is important that all the curves that will be lofted have the same beginning, end, and direction.

To project the curve, select the duplicated curve, Shift-select the torso, and choose Edit NURBS, Project Curve on Surface [image]. Make sure you set the options to use a .01 Local Tolerance, and a Complete curve range. In addition, you can choose to project your curve according to the Active View or Surface Normals. Clicking the side view with the middle mouse button and choosing the Active View option creates a curve on each side of the torso. This is the most predictable way to project a curve onto a surface and works well if your surface is oriented toward one of the views. Problems can occur, however, if your curve is too wide for the torso. If you must scale the projected curve to make it fit onto part of the torso that doesn't face the projected view, the curve may be split into pieces. Even if this does not occur, this option produces a curve on each side of the torso. Just select and delete the extra curves as needed. If you find that your curve is splitting by using the Active View option, try using the Surface Normals option instead. This option creates a curve on only one side of the torso, but the curve on surface may be shaped very differently than the projected curve, depending on the shape of your torso. To make the curve fit better on the surface, move CVs on the projected curve (see Figure 2.34). By doing this after you loft the curves to create the new arm surface, you can see the effects on the skin as you move points on the projected curve. Make sure you do not Shift-select the projected curve as one of your creation curves when you are lofting.

2.34. Manipulate points on the curve you projected to update the curve on the torso surface.

Moving points on the projected curve enables you to create tangency where the arm branches off the torso. This is best done on the shoulder by creating a large curve on surface, so that the seam for the arm is more on the chest than directly on the shoulder joint (see Figure 2.35). Whenever creating a NURBS character, be aware that seams between surfaces should be placed slightly off the main joints of your character. Placing seams directly on joints makes it difficult for you to keep tangency between the surfaces when they are deformed during animation. When the curve on surface is in the best place for creating tangency between the arm and torso, you should delete the projected curve. Then make any necessary adjustments on the components of the other curves and delete history on the arm surface. Hide all the creation curves in the hypergraph view. Then, on the arm surface, add a couple of isoparms in the shoulder area between the edge isoparm sitting on the torso and the first arm isoparm. This enables you to shape the arm surface for maximum continuity with the torso. Continuity is achieved by manipulating the second and third rows of CVs so they line up with the slope of the torso where the arm edge sits on it.

2.35. Avoid placing the seam between the arm and torso directly on the shoulder joint.

Notice that lofting from a curve on surface produces extra isoparms in the direction going from shoulder to wrist on the arm surface. This occurs due to the tolerance setting when projecting the curve on surface. A low tolerance creates more points on the surface curve than the other arm curves. This makes the surface curve better fit the shape of the torso surface. However, when you loft between curves that have differing numbers of points, it produces a surface that has extra, unneeded isoparms. This will especially be a problem if multiple isoparms are placed very close to each other, because it can cause creasing on the surface when it deforms. As mentioned before, you can select and delete the extra isoparms manually, or rebuild the surface with the Uniform option to space the isoparms more evenly. Your goal is to create a clean surface that keeps all the necessary details you originally modeled for the arm, while also remaining tangent with the torso surface. This can sometimes require multiple rebuilds, or rebuilding duplicated curves to reloft the surface.

2.36. When lofting from a projected curve, it is necessary to rebuild the surface to remove unnecessary isoparms that will make the surface difficult to animate.

You can create a curve on a surface in one other way: by intersecting two surfaces. For instance, you can create a curve on one side of the lower part of a vertical torso by creating a NURBS sphere, and then transform it so that it intersects with the torso in the hip area. Then select the torso, Shift-select the sphere, and choose Edit NURBS, Intersect Surfaces [image]. Set the options to create a curve on the First Surface, turn on Curve on Surface, and use a .01 Local Tolerance setting. Click the Intersect button to create a curve on the torso surface where the two surfaces intersect. You can then transform the sphere or manipulate its components to get the curve exactly where you want it. The important thing to keep in mind while doing this is that the seams and poles on both the sphere and torso must not be intersected; otherwise, the resulting curve will be split into pieces. When the surface curve is positioned correctly, delete the sphere.

Using Fillets to Connect Limbs to the Torso

Another way to create a surface between an open NURBS edge and a curve on surface is to use a fillet. This can be used to create a smooth connection between branches and a main surface, such as for limbs branching off a torso. A fillet is an interactive surface that has a history connection to the two edges or isoparms it is connecting. Adjusting either surface that the fillet is connected to updates the fillet to a new shape, which preserves the connection. Although this is useful when modeling, it can cause unpredictable deformations when animating, so it is recommended that you later convert all fillets to regular surfaces by deleting their history. After doing so, you should clean up each fillet surface and attach it to the appropriate limb, if possible, to reduce the number of seams in the model.

You can create three kinds of fillets in Maya: circular, freeform, and blend fillets. A circular fillet is best done for a simple character, where the surfaces involved have a uniform isoparm structure. The circular method on very complex surfaces can have unpredictable results. If you have a simple vertical torso, for instance, and a cylindrical arm, you can create a circular fillet by intersecting the two. The two surfaces must intersect, so extend the shoulder part of the arm into the torso by translating the end points in component mode (see Figure 2.37). Once the surfaces are intersecting, Shift-select both, and choose Edit NURBS, Surface Fillet, Circular Fillet [image]. In the options box, it is not necessary to create curves on surface unless you need to do a trim, which is not recommended. Keep in mind that it is important that the normals on both surfaces are pointing outward to get the result you want. On a torso and limb, this should already be done, so you do not need to turn on these options either. Leave the Position and Tangent tolerance setting to the default low values, and click Fillet. An interactive circular fillet will be created that creates a smooth connection between the arm and torso.

2.37. A circular fillet can be used to connect a limb to a simple torso by intersecting the two (left). After creating the fillet connection, duplicate the surface curves and loft the arm as a single regular surface (right).

After making the circular fillet, you can select it and adjust its primary and secondary radius channels in the Inputs section of the channel bar. Adjust the values between .5 and 1.5 to create a smaller or larger fillet. When finished, delete history on the fillet and add several isoparms on the surface between the arm and torso surfaces. Select an isoparm on the arm surface that is past the edge of the fillet, detach the arm into two pieces, and delete the piece that intersects the torso. Then duplicate out the surface curves in the same direction on the fillet and arm surface, and then delete both surfaces. Make sure the fillet curves are not too stretched as they transition to the arm curves. Finally, Shift-select all the curves from the surface curve to the wrist and loft them. This creates a single-surface arm that has tangency with the torso surface.

Another fillet you can use that is better for complex surfaces is a free form fillet. This is particularly good for creating a fillet from the edge of an arm surface to a curve on your torso surface. Choose Edit NURBS, Surface Fillet, Freeform Fillet [image] to open up the options box. You want to first select the isoparm on the open edge of your arm surface. Because this command has a tangency option, you do not want to use a duplicated arm curve, because if you do you may not get the correct tangency on the resulting fillet. After selecting the edge isoparm on the arm surface, Shift-select a projected curve on your torso surface. Set the options to a 0 Bias value and .5 Depth value, and click the Fillet button. A fillet will be created that has a transitional isoparm midway between the two surfaces (see Figure 2.38). You can adjust the position of the transitional isoparm in the Inputs of the fillet by adjusting the Depth and Bias settings. Adjust as needed to create the best continuity, and then delete the history on the fillet. Add additional isoparms as needed, copy out the curves from the fillet and the arm, and reloft all the curves into a single arm surface.

2.38. A freeform fillet is a good choice when you want to create a more realistic character. The fillet will create a transitional isoparm that you can adjust using the Bias and Depth channels.

The last way to create a fillet is by choosing Edit NURBS, Surface Fillet, Fillet Blend Tool [image], which produces a very similar result to the freeform fillet command. As with other tools in Maya, you set the options and activate the tool first, and then click the edges you want to connect. Set the options on this tool so that the Auto Normal Direction is on, the Multiple Knots option is off, and Auto Closed Rail Anchor is off. The Multiple Knots option should not be used on a surface that will deform, because it can break tangency. Auto Close Rail Anchor is also not needed on a deforming character, because it will prevent the fillet from following the two surfaces it is connected to. Actually, these settings are only important while the fillet has a history connection. After the history connection is deleted, and the fillet is relofted with the connecting surface, these settings won't matter any more. Make sure the Output Geometry option is NURBS, and click the Fillet Blend Tool button. You must then click the curve on the torso surface and press the Enter key. Then click the open edge of the arm surface and press Enter again. A new fillet will be created between the two surfaces. Use the same process as previously detailed with the other fillets to convert the fillet and arm to a single surface. Rebuild as needed to clean up the isoparms on the final arm surface, and duplicate to mirror the result to the other side.

Approaches to Modeling NURBS Legs, Feet, and Hands

When creating the torso and arms, the most important thing to consider when creating NURBS body parts is edge placement and isoparm orientation. Because a single NURBS surface is always going to be a variation of a rectangle or cylinder, you must first decide where the open edges or poles are going to be, and then make sure the isoparms are oriented correctly for deformations at the joints. On the foot of your character, for instance, if you create a simple NURBS shoe, the isoparms should be oriented to bend well at the ball of the foot. This is normally done by placing the pole for the shoe at the end of the toe, rather than on the middle of the foot bottom. Placing the pole at the bottom of the foot can facilitate a nice-looking static model, but the isoparms are stretched in a way that they won't bend very cleanly at the ball of the foot (see Figure 2.39). Placing the pole at the end of the toe, however, requires that the bottom of the shoe be a separate piece of geometry. To make sure the two pieces bend the same during animation, the isoparms on both pieces should line up at the joints.

2.39. It is important to orient your NURBS models so that the isoparms are optimized for animation, such as placing the pole of a simple NURBS shoe at the end of the toe (left), rather than on the bottom of the foot (right). Notice the isoparms cleanly cross the joint at the ball of the foot on the first model and are stretched on the second model.

You can model your character's legs in three basic ways (see Figure 2.40). The first is the same method shown in the previous sections for attaching arms to the torso and involves creating curves on the lower part of your character's torso to loft the two legs. Another method involves making the hips and both legs a single horseshoe-shaped NURBS surface. In this method, the legs and pelvis are lofted as one long cylinder that has its open poles at the end of each leg. The closed seam on the cylinder should run across the inner side of the legs. This method works best if your character is wearing a belt to cover the top of the horseshoe shape. The third method involves creating two separate open surfaces for each side of the hips and leg. The leg part appears to be a closed cylinder because the open seam is pulled together on itself, while the top of the cylinder opens up to create the pelvis area. The advantage of this method is that you can line up the isoparms in two directions in the pelvis area. This enables you to create tangency with both the legs and the bottom of the torso, which should be an open cylinder. To create tangency, the torso cylinder must have the same number of isoparms as both leg surfaces added together.

2.40. Legs can be done in a variety of ways, such as lofting off curves on the torso surface (character model by Paul Browder), creating a continuous horseshoe shape across both legs (character model by Michael DelGiudice), and by lofting an open curve that separates at the top (character model by Samson Tsehaye).

There are also a couple of ways to orient NURBS surfaces to create basic NURBS hands for your character (see Figure 2.41). One involves creating the open poles of a palm cylinder at the wrist and knuckles. The wrist pole can be attached to or created from the open pole of an arm cylinder. The CVs on the open edge are pulled together at several places on the knuckles and palm to create the appearance of four separate openings, even though there is only one opening at the pole. The open edges of each of the four finger cylinders are then lined up with the four hand openings. The thumb must be a separate surface, and is best lofted off of a curve created on the hand surface. This method of creating a NURBS hand produces slight gaps between the fingers that would be noticeable only at specific close-up camera angles. Another way to create a simple NURBS hand involves placing the end pole of the hand at the tip of the thumb, while the other open pole is lined up or attached to the wrist. The closed seam for the hand should run across the outer edge of the thumb, so it doesn't get in the way of projecting curves for the fingers. Then project four circles onto the front of the hand surface over the knuckle area and loft with your finger curves. When creating the fingers, keep in mind that the fingernails are best made from separate NURBS surfaces.

2.41. A couple of ways to create NURBS hands involve placing the end pole of the hand at the knuckles (left) or at the end of the thumb (right). Fingers are either lined up with the open pole or lofted from curves on the hand surface.

When creating your character's body parts, remember to avoid overlapping geometry. If you are making clothes, for instance, try to create as little overlap between the skin and garments as possible. This means that an arm should only go into a sleeve a short distance, and there should be no geometry under the majority of your character's clothes. Overlapping geometry, such as skin under clothes, can cause the geometry to intersect when the surfaces are deformed during animation. Intersection problems will always occur if the internal and external geometry do not have the same exact isoparm structure, because the isoparm placement and orientation always determines how a surface bends when deformed. If two overlapping surfaces do not have the same isoparm structure, they will not bend the same, no matter how well you try to deform them with skeletons. If you must have overlapping geometry, try to make the isoparm structures of both surfaces as similar as possible, preferably by duplicating one of the surfaces to create the other. Also, it may help to create a little space between the two surfaces, so that the problem is minimized.

Exercise 2.2
Create Your NURBS Character's Body

In this exercise, you create your character's body parts by using a live guide object. You create a rough version from primitive NURBS spheres, and then convert them to a single polygon guide that you can use as a live surface. Then you can draw EP curves on the surface to ultimately loft to create your finished NURBS torso. In addition, you create curves on the torso to loft arms and legs from, and use a similar technique to loft fingers from a hand.

  1. Create a vertical primitive sphere and modify its components to rough out the proportions of your character's torso. Add isoparms as needed, and use all the previously mentioned tools to quickly create a basic surface. Then create additional spheres and transform them so that they form bones and muscle details. For instance, place several sticking out of the chest to simulate ribs. To create stomach muscles, you can place several squashed spheres in two columns on the front of the lower torso. Position the spheres without regard to isoparm structure or surface direction, and make sure all the surfaces intersect one another.

  2. Then convert all the spheres to polygons and combine them into one guide object. To do this, drag a selection box around all the spheres, and then choose Modify, Convert, NURBS to Polygons [image]. Set the Type option to Quads, and the Tessellation Method Option to Standard Fit, with the default settings. Click the Tessellate button to convert the spheres to polygons. With the polygon spheres still selected, choose Polygon, Combine. Don't be concerned if there is internal geometry in your polygon torso, because this object is just going to be used as a guide for creating your NURBS torso. You will do this by making it a live surface; because you cannot make multiple NURBS surfaces live, however, converting to a single polygon object was a necessary step.

  3. Duplicate the polygon guide object, and make the copy live by choosing Modify, Make Live. Then draw an EP curve from top to bottom down the center of the live polygon torso. Make sure you place points wherever the torso surface requires details, such as where muscles or bones are prominent. Remember that a surface cannot change direction without an isoparm in that area. Continue either drawing curves from top to bottom around half the torso, or duplicate your first curve and move points on the duplicates so that they snap to the live surface (see Figure 2.42). Your first curve should be in the middle of the chest, and the last curve should be in the middle of the back. After drawing and modifying the curves, Shift-select and loft the curves to create a half-torso. You can make adjustments by grouping the curves, and then modify the surface using the history connection to the creation curves. Avoid any extreme stretching or twisting of isoparms across the surface, but try to make the isoparms contour the muscle structure of the torso. When finished adjusting the creation curves, delete history and continue refining the model directly. Finish your half-torso using the same process you used for finishing your half-head in the previous section. Rebuild the surface to Uniform, duplicate and mirror the other half, attach the two halves together, close the seam, and move it to the center of the back. Finally, use the standard modeling tools such as the Sculpt Surfaces tool and Surface Editing tool, to finish your vertical NURBS torso. After you have finished modeling the torso, name it TorsoSkin.

    2.42. Duplicating the original curve creates a better lofted surface, but requires you to move each point on the copied curves to snap them to the live polygon torso guide.

  4. You can create your arm in the same way you created your torso, by drawing curves on a live polygon guide object. A NURBS arm is basically a cylinder with the open poles at the shoulder and wrist. Because the arm cannot be attached to the closed surface of the torso, you need to create a curve on the torso to make the two surfaces seem continuous. First, make sure your arm is positioned correctly, with a small space between the edge of the arm and the torso. Copy out the curves on your arm surface in the direction that runs from shoulder to wrist. This should create a series of circular curves. Duplicate the curve that is closest to the torso, and then move it slightly so that it is easy to select.

    You must then use the duplicated curve to create a curve on your torso surface. One method you can use to do this is to project the curve onto the surface by choosing Edit NURBS, Project Curve on Surface [image], setting the project options to Surface Normal with a local tolerance of .01, and setting the Curve Range option to Complete. To position the resulting curve on surface correctly, you modify the components of the projected curve, and then loft the arm from the resulting curve on the torso surface. Instead of using this method, however, which often creates too many isoparms on the resulting loft due to the tolerance setting on the projected curve, you can make the torso surface live and snap the duplicated curve to the torso surface. This process creates a cleaner arm surface because all the curves have the same point structure. To do this, duplicate the NURBS torso and make the duplicate torso live. Then move EPs on each point of the duplicated arm curve so that they snap to the torso surface. Position the points so that they cover a large part of the torso, which will keep the seam away from the shoulder joint. Then Shift-select the arm curves from the torso to the wrist, and loft the arm surface. Because you lofted from a curve that was duplicated from the other curves, the surface should not have any extra isoparms created and may not require any rebuilding. Use the history connection to adjust the arm tangency by continuing to manipulate the EPs of the curve on the torso surface.

    After adjusting the curve on the torso surface, delete history on your arm surface. This enables you to add isoparms as needed at the shoulder to improve tangency with the torso (see Figure 2.43). If you did not have enough isoparms on the arm to contour the torso without intersection problems, add isoparms. You can count the isoparms on the torso that form a rectangle around the curve on surface and either add the same number of isoparms manually or rebuild the arm to have the same number. Doing this produces the most tangency and prepares you to create a multipatch model (which is the next step, and which you do in the next section). In the Rebuild option box, you can specify the exact number of U and V subdivisions. After you have finished one arm, duplicate and mirror it to create the other arm.

    2.43. Delete history on the arm surface after lofting, and add isoparms around the shoulder to create a better angle for achieving tangency between the arm and torso.

    You can create legs in much the same way as arms, lofting off a surface curve you create on the hips area of your torso. This converts well to a multipatch model in the next section. Just be sure to avoid the pole at the bottom of the torso when creating the curves for the legs. You can extend each leg out to the foot if your character is shoeless, making sure to place the pole at the toes, and not on the bottom of the foot. When creating surfaces that will later deform, try to always orient the isoparms on your skin so that they cleanly contour the main joints of the body. You also can end your leg close to the ankle, but avoid placing the seam directly on the ankle joint.

    Another interesting way to create a leg is to draw an open profile curve for the bottom of the leg that appears closed because you snap the first point onto the last point. The open part of the curve should be on the inner side of the leg. Starting at the ankle going upward, duplicate and translate this open curve several times to create the leg curves. As you get to where the leg connects to the torso, start to open the curves so that they are in an open U shape that faces the other leg. Lofting the curves produces a leg that can be lined up to achieve tangency with an open torso, and a duplicated and mirrored leg.

    When creating clothing for your character's body parts, be aware that the isoparms of any overlapping geometry must line up perfectly if they are going to bend the same when deformed. If you cannot make the two surfaces so that their isoparms are oriented and positioned exactly the same, you will have intersection problems when they are forced to bend by skeleton joints. To avoid such problems, it is always best to minimize overlapping geometry as much as possible (see Figure 2.44). As a general rule, remove all skin surfaces that you will not see during your animation. In this sense, the clothing becomes your character's skin and is treated in the same way as all other types of skin when animated.

    2.44. To minimize intersection problems, avoid overlapping geometry when making clothing by removing any skin that won't be seen during the animation (character model by Giles O'Dell).

  5. To create a simple NURBS hand for your character, extend the wrist pole to the end of the thumb. Lofting fingers off a pinched pole at the end of the arm does not work well because it is difficult to avoid the pole when projecting on finger curves. By placing the arm pole at the end of the thumb, you can project the curves successfully; however, this requires curving the surface in the palm area. Be careful to spread out the CVs at the base of the thumb to keep them from bunching up. Also, make sure the wrist isoparms remain oriented straight across the joint. Move the closed arm seam so that it's going down the front of the arm, which will keep it from being in the way when you place curves on surface for the four fingers. Create the finger curves on the hand surface by either projecting or drawing on a live surface. The fingers themselves can be created in the same way you created the arms. They are essentially just cylinders that are closed at one end and open at the other. Make sure you place enough isoparms around each joint so that they bend correctly when deformed. Then copy out each finger's surface curves and loft with the curve on the hand surface to achieve tangency. Keep in mind that you can use the same process to create a foot, by extending the leg pole out to the end of the big toe and creating separate lofted toes off the main surface.


NURBS Multipatch Modeling

So far in this chapter, you have been modeling several kinds of basic NURBS shapes to create the skin of your character with as few NURBS surfaces as possible. This approach minimizes the seams between surfaces, but often lacks tangency in areas where an open NURBS edge branches off the center of a closed NURBS surface. This occurs on your character's head where the eye patches connect to the main head, where the limbs branch off the torso, and where the fingers and toes branch off the hands and feet. Unless your character models were designed to incorporate seams whenever a limb branches off a main surface—for instance, if clothing items have similar seams—this method of modeling will always have tangency problems. In each of these problem areas, the underlying geometry prevents you from ultimately creating a seamless skin. In this section, you use a different NURBS modeling approach to create a skin with more surface continuity in these problem areas, called a NURBS multipatch skin. This involves cutting up your NURBS character into many smaller rectangular patches so that you can remove overlapping geometry and create open edges on the head and torso to better line up with similar open edges on the eyelids and limbs. Using multipatch modeling techniques, you can create a character skin with smooth transitions between body parts (see Figure 2.45). Multipatch skin enables you to take your character model to the next stage of the modeling process, which is a seamless polygon skin. Keep in mind, however, that there is not one right way to multipatch model a character. The methods shown in this section are just a few examples of how to approach such a task.

2.45. Using multipatch modeling techniques, you can create a character skin with good surface continuity between the eyelids and head surface, and between the limbs and the torso (character model by Nick Miulli).

Converting a Radial Head to a Patch Head

The best place to begin converting your NURBS character skin into a multipatch skin is the head. Currently, your character's head is composed of a main radial head, two radial eye patches, and two radial ear patches. Most popular methods for multipatching the head keep this same basic structure, so that the mouth, eyes, and ears remain radial structures. The radial mouth is already part of the main head, so it should remain as is. To make the eyes and ears fit into the main head, you must cut out rectangular holes in the eye and ear areas. This is only possible if you cut the entire head into many pieces, so that the seams contour around each eye and ear. You can then delete the surfaces under the eyes and ears and make the edges of each eye and ear patch line up with the open edges. To create full tangency between all surfaces, you must detach each eye and ear patch at the corners into four separate but continuous pieces.

The goal when multipatch modeling is to take advantage of using separate patches to change the orientations of isoparms on each surface, while still achieving continuity across all the surfaces. On a head, you ideally want the isoparms on the patches to contour the muscles and wrinkles of the face. The appearance of a continuous surface requires that you keep tangency between all adjacent patches. You can achieve this only if the patches have the right number of subdivisions so that the isoparms line up perfectly across each seam. Hopefully, your basic radial NURBS head and eye patches are not too complex, but only have the minimum isoparms necessary to define the facial features. You should continue to do this when converting your head to a multipatch model. You can add details later to the NURBS patches if necessary, or better still, after the surfaces are converted to a single polygon object. For instance, it is much easier to carve out good nostrils on a polygon than it is on a NURBS model.

Keep in mind that if your face is symmetrical, you can cut your head in half again and only work on multipatching one side. If you made important asymmetrical features on your character's face, however, you will have to multipatch both sides of the head. Before going to the next step of cutting your head into many pieces, duplicate your current head and eye patches. Then convert all the duplicated pieces into polygon objects and combine them. You can use this single polygon head as a live guide object when working with your multipatch NURBS head. For now, assign the polygon guide head to a new layer named HeadGuideLayer, and hide the layer until you need to use it.

You begin the process by checking the structure of your main head surface to determine whether the isoparms are oriented in such a way that they form a rectangle around the eye patch. You can add isoparms if necessary, and you should move CVs to contour the edge of the eye patch as much as possible. The rectangular hole you want to create should be rounded outward slightly, so that it fits well with the radial eye patch. Because the corners of each rectangle must match up with isoparms on each eye patch, you need to determine which isoparms on the four corners of the eye patch you are going to use. These isoparms will be where you detach the eye patch into four pieces. If the isoparms on your eye patches are not in the right place, insert new ones and delete old ones as needed.

When you are satisfied with the isoparm placement on your main head, the next step is to select the isoparms that form the rectangle around the eye patch and detach the surfaces. This creates many separate patches and enables you to select and delete the rectangular area under the eye patch (see Figure 2.46). In addition, you must select the isoparms at the corners of each eye patch and detach them to create four separate patches. After doing this, select all the patches and display the Surface Origins, which will show the U and V orientations of the patches. You want the eye patches to have the same orientation as the other head patches, with all the normals facing outward. Swap or reverse the directions as needed by choosing Edit NURBS, Reverse Surface Direction [image]. You then need to make sure all the isoparms and edges line up from patch to patch. Do this by rebuilding patches as Uniform surfaces with the correct number of subdivisions by choosing Edit NURBS, Rebuild Surfaces [image]. Starting with the eye patches, select each patch and rebuild it as needed to have the same number of subdivisions in U and V as the adjacent patches with which it is lined up. Rebuild the patches as needed to make all the isoparms line up. To get perfect tangency between all the head patches, however, you may need to rebuild each patch as Uniform in both directions, because surface parameterization can affect the tangency.

2.46. Detach four isoparms on your head that contour the eye patch, and delete the underlying surface afterward.

If many of the isoparms on your radial head are not going in the right directions for cutting up the head correctly, you need to create new patches for these areas. First, select the isoparms around the mouth area of your main head surface, choose Edit Surfaces, Detach, and discard the cheek and forehead patches. You should be left with a radial mouth, part of the nose, and the eye patches. You want to keep some of the original surface to use as a source for establishing tangency when you create new patches. Cut the mouth and eye surfaces into several sections to facilitate the new patches (see Figure 2.47). Then unhide your polygon head to use as a guide, and make it a live surface. You want to start making patches on the cheek where you have three edges of the patch already created by the nose, lower eye, and upper mouth patches. Duplicate the isoparm on the nose edge to create the fourth edge of the patch, translating it to the other side. Then in component mode, move EPs on the curve to line it up on the live polygon head. Avoid snapping CVs to the live polygon head, because CVs are not on the curve and will not produce an accurate result. At both ends of the curve, snap the end EPs to the corner CVs on the eye and mouth patches. It is important to make sure all the endpoints of the curves and isoparms that make up the edges of the new patch are snapped together; otherwise, the square command may fail. After creating the boundaries of your new patch, you can use the Square tool to create the new NURBS patch.

2.47. If the isoparms on your main head are not conducive to creating a good eye hole, you can discard that area of the head in order to re-make the patches manually using your polygon guide head.

To use the Square tool to create a new patch for your character's head, switch to component mode, and Shift-select the edge isoparms on the three patches that border the new patch. Then Shift-select the curve you created on the last side of the new patch and choose Surfaces, Square [image]. This feature has a Tangent option for the Continuity Type that should be turned on. This option creates tangency with the nose, mouth, and eye patches. The number of Curve Fit Checkpoints will add isoparms for a setting above 2. Higher settings may give you a more accurate result, however, and you can always rebuild the surface after creating the patch. Set a .1 value for the Local End Point Tolerance option, and make sure you are creating a NURBS surface. It is usually not necessary to use the Rebuild curves option if you have been working with cubic NURBS surfaces and curves. After correctly setting these options, click the Square Surface button to create the new patch (see Figure 2.48). Keep in mind that this will create a NURBS patch that is accurate on its border edges, but not necessarily accurate in the middle of the patch. To make sure the middle of the patch has the same shape as your original head surface, you must copy out the curves to manipulate their EPs on the live surface and then reloft the surface from the adjusted curves.

2.48. Create curves on the live guide head, and use the Square tool to create new patches that are tangent with existing patches.

When creating your multipatch head, work outwards from the center of your character's face. As you create each patch using the square command, rebuild each patch to have the same number of subdivisions as the other patches on its UV borders. Simply check the number of subdivisions in the Attribute editor, and specify the correct amount of subdivisions in the Uniform rebuild options box. Make sure that you are rebuilding both the U and the V directions on each surface, and set the Parameter Range for each patch from 0 to 1. Also, as your building your patch head, you might find that tangency is maintained in some areas, while others lose tangency. To achieve tangency between two NURBS patches, you must not only line up the edges and isoparms, but also the CVs that border each edge. Tangency is created between two surfaces by creating a straight line between the two overlapping edge points and the next row of points on each surface. This row of points is not associated with any particular isoparm, but are used specifically for creating tangency with other surface edges. Sometimes it helps to manually move the points so they line up as much as possible before using other tangency techniques.

Another simple way to create more tangency is to attach and detach patches. To do this, select the overlapping edge isoparms on two adjacent patches and choose Edit NURBS, Attach [image]. The Blend option with a low bias value creates the most tangency between two patches, but moves points on the surfaces. This can separate the attached patches from other patches. The Connect option will not change the shape of the patches as much, but will also not create as smooth a connection. Sometimes it is best to use the Remove Multiple Knots option. Extra isoparms may still be added where the two surfaces were attached. Rebuild the surface to have the correct number of subdivisions when this happens. After attaching two patches in one direction, select the isoparm where the patches were attached, and detach the surface again by choosing Edit Surfaces, Detach. You can then do the same attach-detach procedure on two adjacent patches in the other direction.

As you are creating your patch head, notice that tangency is easier to create between any four patches that line up together than in areas where five patches come together. There will always be areas like this on a multipatch skin, called a star junction, where tangency problems usually occur (see Figure 2.49). To make this area as continuous as possible, try to avoid stretching or pinching the corners of any one patch too much. Another way to try and fix tangency problems is to stitch the surfaces together. As you are building your patch head, you can use the Stitch Edges tool to create tangency between any two patches. Then stitch surface points to fix any problems at star junctions where the points do not come together correctly. Finally, you can run a global stitch on all the head patches to fix any remaining surface-continuity problems.

2.49. It is always difficult to achieve perfect tangency in areas on a head where five NURBS edges come together, called a star junction.

To stitch an edge, choose Edit NURBS, Stitch, Stitch Edges Tool [image]. Set the Blending options to stitch both the Position and Tangent. If the surface edges are offset, set the Weighting Factor options for which border edge you want to move to the other. This option is based on the order of selection, with a value of 1 fixing the points on a surface, and a value of 0 moving the points on a surface. To move both edges equally toward each other, set both options to a .5 value. If you have carefully snapped edge points together, however, the surfaces should not move much at all. Make sure the Cascade Stitch Nodes option is turned on, keep the Sampling option low, and do not keep the original surfaces. Then click the adjacent border edges of the two surfaces you want to stitch. A blue edge manipulator will appear, enabling you to adjust whether the stitch will occur across the entire edge of both surfaces or to a particular isoparm to do a partial stitch (see Figure 2.50). Hold the V key down to snap it to an isoparm if you need to stitch a partial edge. Because you have cut your head into equally sized patches, however, it should not be necessary to adjust this manipulator. Just press the Enter key to complete the edge stitch. You can use the Stitch Edges Tool to stitch all adjacent edges on your multipatch head.

2.50. Use the Stitch Edges Tool to create tangency between any two open edges. Use the blue manipulator to stitch a partial edge if necessary.

Use the stitch surface points command to pull together all the points involved in a star junction. If there is a point that is in the position where you want the star junction to be located, select it first. Then Shift-select all the other points, and choose Edit NURBS, Stitch, Stitch Surface Points [image]. In the resulting options box, turn the Assign Equal Weights option off, and make sure the Cascade Stitch Node is turned on. Do not keep the original surface. Clicking the Stitch Points button should pull all the points on top of the first selected point, and close the star junction.

The last command for stitching surfaces is global stitch. This command can be used periodically while you build the multipatch head, or can be done after all the patches are completed. To do a global stitch, you must select all the patches involved in creating tangency on the patches, and then choose Edit NURBS, Stitch, Global Stitch [image]. For a multipatch skin, always choose the Closest Knot and Equal Params options, which will line up the edges and isoparms on all the patches (see Figure 2.51). You also should set the Stitch Smoothness option to Tangents, and turn the Stitch Partial Edges option to off. The Max Separation and the Modification Resistance options work together to determine how much the surfaces will be altered during the stitch operation by setting how much the points will move.

2.51. When global stitching your skins, always choose the Closest Knot and Equal Params options, which will ensure that the edges and isoparms line up.

When you are doing a global stitch, it is important that the edges of all the surfaces involved are equal distance from each other. Preferably, you have already snapped all the edges together before doing the stitch. If there are some larger spaces than others between the edges, you have to increase the Max Separation value to pull them together, which causes the points closer to each other to bunch up. You can reduce this problem by turning on the Lock Surface option in the Attribute Editor for the patches that are bunching up; this option keeps the locked surfaces from being altered by the stitch operation. However, it is better to avoid this by making sure all the patch edges are equal distances from each other before doing the global stitch. After clicking the Global Stitch button, in the Channel Box you can modify the Max Separation and Modification Resistance values to improve the stitch result. Increase the Max Separation value to close any holes between patches, and increase the Modification Resistance value to reduce any wrinkling or bunching at patch edges.

You can continue modeling with stitch nodes on your skin patches. The surfaces should remain together, and keep continuity, but be aware that points close to the border edges that are involved in the stitch operation can no longer be moved independently from one another. The stitch operation is continuously recomputing the tangency between patches, which will noticeably slow down your system. Because of this, just like fillets, it is best to use stitching as a modeling technique and not leave it on your surfaces during animation. When your surfaces are tangent, select them all and delete history to remove the stitch nodes.

Using Patch Modeling to Connect Limbs

Converting the rest of your character to a multipatch NURBS skin is done in the same way as the head. To make the open edge of an arm that has been lofted off a closed vertical torso fit together with the chest as tangent multipatches, you must cut a rectangular hole in the shoulder area by detaching isoparms. This creates eight patches on the torso, with four bordering the hole where the arm should be connected (see Figure 2.52). You also must cut the length of the limb into four patches to fit with the four open edges on the cut torso. Again, it is best to create the opening well into the torso surface, so the seams will not sit directly on the shoulder joint. Then use all the techniques described in the previous section for creating tangency between all the patches. When finished multipatching the arm, do the same in the leg area. You can even use the same technique for multipatching the hands and feet. If your character is wearing clothes, you can separate patches at the natural seams in the fabric. Just create the patches in the same way that the clothes would be made.

2.52. Multipatch the rest of your body parts in the same way you did the head. On a torso, for instance, detach a hole in the torso to create tangency with the arms.

As mentioned earlier, there is no single way of multipatching a NURBS character. Using the principles described in the previous section, such as separating your character's body parts into rectangular patches that have the seams placed slightly off the joints, you should be able to create a multipatch structure that works best for your character. One useful way of preplanning how you will cut up the surfaces is to draw the seams on top of copies of your character designs.

Exercise 2.3
Create a NURBS Multipatch Skin

In this exercise, you begin converting your current NURBS skin to a multipatch NURBS skin. This process involves cutting your surfaces into many pieces to line up the edges on adjacent patches. You begin the process at the head and work your way down through the torso and limbs. After you learn the basic techniques and principles, you should be able to multipatch model all the parts of your character's skin.

  1. First, delete history on all your NURBS surfaces that so there are no history connections to any creation curves. Then you need to detach isoparms on the main head surface to create rectangular eye holes. Before doing this, however, select the head and eye patches and convert them to polygons using the same Standard Fit and Quad options settings. Combine the head polygons and delete history on the result. Name the polygon head HeadGuide, and place it on a layer named HeadGuideLayer to hide it for now. You will use this polygon head later to make sure all your multipatch surfaces have the same proportions as your radial head. Also, make sure the isoparms that border your character's eye patches are oriented to create a rounded rectangle. You can do this only to a limited degree at this point, so don't worry if it is not perfect. To begin separating your radial head into multiple patches, right-click the surface to select the same isoparms and choose Edit NURBS, Detach Surfaces to begin separating the head into pieces. Continue detaching isoparms until you can select the rectangles under each eye patch, and delete them. Also, detach the corner isoparms on the radial eye patches that line up with the open edges of the separate head pieces. After detaching the surfaces, you should have only one edge on each head patch lining up with only one edge on the four eye patches.

    Count the U and V subdivisions on each head patch that is directly adjacent to an eye patch, or open each head patch in the Attribute editor to check the number of spans, and rebuild the eye patches to have the same number of spans in the appropriate direction. If two adjacent patches have different numbers of spans, then rebuild to the minimum amount that is required to not lose important details on either surface. Keep in mind that you can only achieve tangency between patches if they have the exact same number of spans, and the parameterization is the same. Choose Edit NURBS, Rebuild Surfaces [image], and set the options to Uniform, 0 to 1, and make sure you are rebuilding both directions with the correct number of spans (see Figure 2.53). To ensure all the isoparms line up across the surfaces, rebuild all the patches to uniform with the correct number of spans.

    2.53. After detaching the head and eye patches, rebuild them to make the parameterization and spans match in each direction.

    With all the pieces of the head separated, you can now more easily modify the head patches so that they more closely contour the circular eye patches. The reason for this is that the separated patches have multiple rows of points next to their edges that are used for specifying the direction of each edge (see Figure 2.54). Modifying this second row of points enables you to achieve surface continuity across edges. To get a rough continuity between the surfaces, you can hold down the V key, and snap the edge points on the eye patches to the edge points of the head patches. If any patches appear to be bunching up at the edge, move CVs on the second row of points to smooth them out. Also, snapping together the extra points at the corners should bring together the seams. Adjust overlapping points on the patches to make the isoparm transitions across the seams as straight as possible. Avoid sharp changes of direction from one edge to another.

    2.54. Manipulate the second row of points next to an edge to adjust the continuity between surfaces.

    One technique you can use to increase the tangency between patches is just to attach adjacent surfaces and then immediately detach them (see Figure 2.55). This is a way of forcing tangency in problem areas of the face. Although doing this creates tangency in one direction, it may reduce tangency in the other direction to some degree if you use the Blend attach option. Although the tangency created is usually less in the direction you are attaching, in some cases it is best to use the Connect and Keep Multiple Knots options, which will keep the surfaces from separating from other adjacent patches. You can even try using the same procedure with the Align option, rather than the Attach option. The Align option has both Attach and Tangency options that you can turn on. Another tangency technique involves duplicating out the curves for each patch and grouping them. You can then unhide your polygon guide head to make it live and move EPs on the grouped curves to line them up as much as possible. Loft the curves to re-create each patch, and then modify the patches as needed through the history connection to the curves. When you are done, delete history on all the patches and discard the curves.

    2.55. Attach and detach adjacent patches to increase tangency in that direction on the surface.

    Finally, you can use the stitching procedures shown in the previous section to finish creating tangency between all the patches. Use the Stitch Edges Tool to fix tangency between two patches, and use the Stitch Points command to stitch together star junctions. For an overall stitch of the entire head, run the Global Stitch command. When the head is as tangent as you can make it, remove the stitch nodes by deleting history on all your surfaces.

  2. You can use the multipatching process you used on the head on all the other parts of your character's body. Converting your vertical torso with lofted arms to a multipatch torso increases the surface continuity in the shoulder area. The problem with lofted limbs from a closed NURBS surface is their structures are very different, which prevents them from ever deforming in the exact same manner. Multipatching the torso and arms involves first creating a rectangular hole in the torso by detaching isoparms. Because it is always best not to place your seams directly on joints, avoid detaching isoparms that are directly on the shoulder joint. Then detach four isoparms running down the arm to line up the edges with the torso edges. Use the same techniques and tools you used on the head to achieve tangency between all the patches.

    Keep in mind while multipatching your character that you must have the same number of spans on all patches across an area of your character that is continuous, such as across the skin of the face. But anytime the surface changes to a different type, such as at a seam on clothing, you can change the number of spans as needed (see Figure 2.56). Because there is a natural seam between the two areas, it is not necessary to use tangency techniques to make them appear continuous. Keep in mind that these areas of differing levels of detail will not ever be merged into a single object, even at the polygon level. These areas remain separate skins, and you are shown how to bind these surfaces as separate objects later in the book.

    2.56. Areas of the character that are not meant to be continuous, such as when skin turns to clothing, do not need to have matching spans and edges (character model by Jeff Unay).

    Continue multipatching your torso by detaching isoparms around the hips to create a rectangular opening, and line up the legs by detaching them into four sections (see Figure 2.57). You also can create rectangular holes on the hand to create continuity with the fingers, and the same can be used to multipatch a foot and toes. Remember to delete all stitch nodes by deleting history when all your multipatch skins are as tangent as possible. Stitching will not be required on the bound skins, and will unnecessarily slow down your computer system. Group all the patches for your character under nodes according to whether they are continuous. For instance, group all the head patches under a group node named HeadPatches. This will make it easy to select the appropriate skins that will be merged as a single polygon object in the next section.

    2.57. Continue using the same techniques to multipatch model your character, such as separating the legs into four patches that line up with an opening you create in the lower torso.


Creating a Polygon Skin

The next stage in the modeling process is to take your multipatch character skin and convert it to a polygon skin with very few seams. If you carefully lined up your NURBS patches so that they are all tangent, this should be a relatively easy process to complete. The advantage of converting to a polygon model is that you are able to merge many of the patches to a single polygon object that has the same basic structure as your NURBS character. You can then use polygon-modeling techniques to refine and add details to your character's skin that would be problematic to add on a NURBS skin.

Converting NURBS Patches to a Polygon Skin

Before converting the NURBS patches to polygons, make sure the normals on all the patches are facing outward. Normals facing in opposite directions cause problems with merging the polygons. Do this by selecting all your surfaces and set them to low display resolution by pressing 1, and then display the normals under Display, NURBS Components. Although you can change the size of the normals on a NURBS surface in the Attribute Editor under NURBS Surface Display, this is a bit tedious on a multipatch character. If the normals are too large to see clearly, turn them off and display the Surface Origins instead. The normals direction is displayed by the surface origins as a single blue line that is perpendicular to the NURBS surface. If any patches show the normals as facing inward, choose Edit NURBS, Reverse Surface Direction [image], and use the appropriate option to reverse the surface. Continue doing this until all the head patches have their blue normal lines facing outward.

2.58. Display the Surface Origins to check the normals on all your NURBS patches to make sure they are all facing outward.

With all the NURBS surfaces still in low display resolution and selected, choose Modify, Convert, NURBS to Polygons [image]. You want to set the options to create polygon objects that have the same subdivisions as the NURBS. Do this by setting the convert options to Quads Type, General Tessellation Method, and set the Initial Tessellation Controls to Per Span # of Iso Params with a value of 1 for both the U and V directions. Click the Tessellate button to convert your multipatch NURBS head to a multiple polygon head. Select the NURBS multipatch head by turning off Polygons in the Show menu of your perspective view, hide it, and then show the polygons again. Notice that the polygon multipatch head has the same number of edges as your NURBS multipatch head had isoparms (see Figure 2.59).

2.59. Using the correct settings in the NURBS to Polygons options should create a multiple polygon head with the exact same structure as the NURBS multipatch head.

Double-check the normals on your converted head polygons by choosing Display, Polygon Components, Short Normals. Make sure all the normals still appear to be pointing outward on all the polygon patches, and reverse any that are pointing inward by choosing Edit Polygons, Normals, Reverse [image], setting the Mode option to Reverse as well (see Figure 2.60). Then combine and merge the separate polygon objects into single polygon body parts. Keep in mind that it is not necessary to merge all the polygon patches into one single polygon skin. It is usually best to keep some of the parts of your character separate. If parts of your character are meant to have completely different shaders, such as different clothing items, for instance, it often makes sense to make them separate objects. It is also sometimes necessary to separate body parts that will be animated differently. The head, for instance, is often animated with blend shapes. It makes sense, therefore, to separate the head from the body at the bottom or top of the neck, so that you can create blend shape target out of only the head and not the whole body. In addition, the hands may be bound with a different method than the rest of the torso, so it makes sense to separate the hand skin from the arm skin at the forearm. As mentioned previously, place the seams between skins carefully, so they don't sit directly on main joints. Then select all the polygons on your multipatch polygon head that you want to make into a single body part. This should include at least all the face patches, and combine them by choosing Polygons, Combine. Finally, delete history on the combined polygon head to remove the individual polygon objects.

2.60. After converting your NURBS head patches to polygons, double-check the normals and reverse any that are not pointing outward.

Combining the polygons will not completely merge them into a seamless polygon body part. Overlapping vertices and border edges will still exist within the polygon mesh. You can see these by turning on Border Edges in the Display, Polygon Components menu. The unmerged borders show up as thick green lines on the wireframe mesh. To fuse the overlapping borders together, with the polygon still selected choose Edit Polygons, Merge Vertices [image]. Set the Distance option to .01 to only merge the overlapping vertices. The thick green lines representing the overlapping border edges should become thin green lines that represent single polygon edges. If some of the edges didn't merge, check your normals again to make sure some of the faces are not reversed. You cannot merge vertices of polygons that have the normals facing in opposite directions. If any of the normals are facing inward, select them in component mode and reverse them. Then try merging the vertices again. If you still can't merge the vertices, try using the Merge Edge tool. Just activate the tool by choosing Edit Polygons, Merge Edge Tool, and click the two edges you want to merge. When both edges are highlighted in orange, press the Enter key to merge them.

Splitting, Extruding, and Creating Polygons

Unlike a curve-based interpolated NURBS surface, polygon objects are composed of a mesh of individual polygonal faces. This enables you to split, extrude, and append polygon faces to refine your character's skin in ways you couldn't do using NURBS surfaces alone. Keep in mind, however, that adding details to your polygon skin should still be done carefully and gradually. When you converted your NURBS skin to polygons, you chose quads as your conversion type because it is the most efficient type for smoothing and texturing polygon objects. In the next section, you learn how to use one of the main polygon smoothing methods in Maya, which is to convert your polygon skin to a subdivision surface skin. A polygon object that is all quads converts cleanly to a subdivision surface, whereas a polygon object that has triangles produces a lot of extra geometry when converted to a subdivision surface (see Figure 2.61). This can dramatically increase your file size and slow down your system. Starting your skin as a NURBS surface established it as all quads, because NURBS patches are quads by nature. As you refine your polygon skin, you want to use techniques that keep this basic structure, by avoiding creating three- or five-sided polygons on your skin.

2.61. It is best to keep your polygon composed of all quad faces, which convert cleanly to a subdivision surface (left), as apposed to triangles, which generate extra geometry when converted (right).

The most important tool for refining your polygon skin is the Split Polygon tool. Activate this tool by choosing Edit Polygons, Split Polygon Tool [image]. In the resulting options box, make sure you set the Geometry Subdivisions option to 1, and turn on the Edge Snapping option with Snapping Magnets set to 1, and a tolerance above 1. This makes it easier for you to click directly the edges of the polygons you want to split. To split a polygon, just click an edge or point, click another edge or point on the opposite side of the polygon, and then click the Enter key. This operation splits the polygon into two polygons. You can use the same procedure to split a series of polygons by just continuing to click edges. Use the middle mouse button or the Insert key to adjust point placement, and press the Enter key to split all the edges.

To keep your character's skin composed of all quad polygons as you refine your skin, you can use a technique called creating edge loops. This technique has been promoted for some time by the modeler Bay Raitt, who recently worked on the Lord of the Rings characters at Weta. The technique involves splitting polygons in specific ways to create a loop on the surface that contours the topology of the skin, while not creating any triangles. The basic technique is to split a series of polygons in half as you keep changing directions until you eventually connect to the start point again. The loop can go anywhere on the surface, but usually contours and defines specific features, such as wrinkles or muscles. When the loop changes directions, it creates a five-sided polygon. To fix this problem, just split it from the center of the loop edge to the opposite fifth corner to create two quads instead (see Figure 2.62). Do this at every place the loop changes directions. This enables you to build up surface details while keeping the entire skin composed of quad polygons.

2.62. When you add details to your polygon skin, create edge loops with the Split Polygon tool to keep the geometry all quads. Whenever the loop changes direction (left), remove the five-sided polygon by splitting it to the far edge (right).

As you refine your model, you may find areas on the polygon skin that converted from the NURBS skin as triangles. This would occur in any area that had a NURBS pole. NURBS poles are open edges that were pinched together, rather than lined up with another open edge. Such an area will not convert well to a subdivision surface. If the pole is inside an eye or mouth cavity, you could disregard fixing it, but it would be best to select and delete the triangulated faces directly around the pole. In an area on the skin that is noticeable, you should fix the problem. Do this by first deleting the triangulated faces around the pole, which will create a hole. Then select all the edges around the hole, and choose Edit Polygons, Fill Hole. This creates a many-sided polygon that you can split to remove all triangles (see Figure 2.63). Usually you can bisect the polygon in at least one direction by splitting from a point on one side to one on the opposite side. Then try to connect all the end points on each side of the bisected to other end points, so none remain. If the pole has 10 edges, for example, you should be able to split it to connect 2 opposing points. Then split each half in the same direction to connect 2 points on each of the sides. Sometimes it can be quite challenging to keep your skin quads in areas where several muscle structures come together, such as on an elbow. Using these techniques, however, you should be able to remove all the triangles, which will make the skin convert more efficiently to a smooth subdivision surface.

2.63. Remove poles on your skin (left) by deleting the faces at the edge of the pole, and create a new polygon face that is split to connect and loop edges (right).

Keep in mind that it is a good practice to keep your polygon skin as light as possible by adding only details that will be deformed during animation. If you want to animate muscle flexing, for instance, you must add enough polygon edges to create all the muscle shapes that will be created on the skin when the character moves. However, it is not necessary to create details that do not deform, such as a belly button, nipples, or scars. These other surface details can be created in the next stage of the process on the subdivision surface level. For now, concentrate on defining and contouring the deformable muscles and joints in as efficient manner as possible. Also, keep in mind that creating a skin structure that contours the deforming muscle structure produces better results when animated (see Figure 2.64). You can do this by modeling the individual muscle shapes as NURBS patches, and then connect them as a polygon skin. Because polygons do not have the same limitations as NURBS surfaces, you can shape your skins to be more dynamic for animation.

2.64. When refining your polygon skin, try to create the skin edge structure so that it contours the muscle structure as much as possible.

Because most of your skin was previously created as NURBS patches, you will mostly only need to use the Split Polygon tool to refine it. Sometimes, however, you may need to add completely new polygon structures to your developing character model. For doing this, you should know how to extrude, create, and append polygons. Extruding a polygon face can facilitate creating new appendages that extend out from part of your character's skin, or it can enable you to create a cavity such as nostrils. Just select a face and choose Edit Polygons, Extrude Face. Then use the manipulator to scale and translate the face as desired. To create a cavity with an edge that has thickness, scale the extruded face so that it is sitting flat within the boundaries of the original face. Then extrude again and translate the new extruded face back into the surface. If you need to extrude multiple faces together, make sure you turn on the Keep Faces Together option under the Polygons, Tool Options menu. Keep in mind that although it is easy to create details through extruding faces, be wary of creating poles, which should be fixed in the manner described previously. Finally, you also can select and extrude a series of edges to extend a polygon branch off the character, such as for creating a limb. To attach the extruded polygons to another series of edges, make sure the two pieces are combined, and then use the Merge Edge tool. In the Merge Edge tool options, you can set whether the merge should occur at the first edge picked, second edge picked, or move both edges to merge in the middle.

Another polygon modeling tool that is useful for creating new polygon body parts is the Create and Append Polygon tool. Both of these tools are very similar, and you can actually switch from one to the other by changing the Operation setting inside the tool. Activate the tool by choosing Polygons, Create Polygon Tool [image]. In most cases, for creating quad polygons, you should leave the tool settings at their defaults of 1 subdivision and normalized textures. Turn on Ensure Planarity to keep from creating a nonplanar or bent polygon. An individual polygonal face should be planer or flat. Use the Create tool to draw the four corner points for a new polygon, and click the Enter key to create it. Switch to the Append tool to add a polygon face to an existing polygon. Just click the edge that you want to add to, click two more times to create the other corners, and click the Enter key to create the appended polygon face. Notice that the corner points for the new polygon must be drawn in a particular order to end up with a rectangle. You also can use the Append tool to add a polygon between two un connected polygon edges. The two pieces must be part of the same polygon node, so combine them first if they are not. Then activate the Append tool and click the first edge, click the second edge you want to connect to, and then press the Enter key.

Smoothing Your Skin with Subdivision Surfaces

In the past, the biggest problem with using a polygon skin was that it had to be excessively subdivided during the modeling process to look smooth for high-resolution rendering. This created many faces and points that were difficult to texture and deform with skeletons. Sub division surfaces fix some of these problems by enabling you to create your texturing and deformations on a low-resolution polygon proxy skin that is connected to a high-resolution subdivision surface skin. The subdivision surface skin is not just a smoothed version of the polygon skin, but a completely different surface type that has properties that can be added to the basic polygon skin properties.

Converting your polygon head to a subdivision head is a relatively simple task. First, duplicate your polygon character and hide the original skin. Then, select all the polygons in the duplicated skin and choose Modify, Convert, Polygons to Subdiv [image]. Check the number of polygon faces in your head by turning on the Poly Count in the Display, Heads Up Display menu. This gives you an idea of how high you should set the conversion values. You can set the Maximum Edges Per Vertex to around 10 to start. If any of the settings are set too low, the conversion will fail and you will get an error message. Also, if you have problems on the skin, such as nonmerged vertices or edges resulting in nonmanifold geometry, you will get an error message. If you do, open the Script Editor and read the message. Maya usually tells you in the gray History field what you need to do to make the conversion work properly. Sometimes this involves doing a cleanup operation on the surface, with the Fix Non-Manifold option turned on. Click the Apply button to convert the surface. If you created your skin carefully, with all quad polygons, the subdivision surface skin should look exactly the same as the polygon skin, only smoother (see Figure 2.65). If any triangles or poles still exist on the polygon skin, however, these areas will become subdivided on the subdivision surface skin. At this point, you can delete the subdivision surface skin, unhide the original polygon skin, and fix the problem areas. Then go through the conversion process again to check the result.

2.65. If your skin is composed of all quad polygons, you should see no new geometry added when you convert to a subdivision surface.

Subdivision surfaces have two basic modeling modes, called standard and polygon proxy. When you first convert to a subdivision surface, you are in standard mode, which displays only the subdivision surface. You can switch to polygon proxy mode by choosing it under the Subdiv Surfaces menu, or by right-clicking over your skin and choosing Polygon. You will see a wireframe polygon proxy that looks identical to your original polygon skin. When in polygon proxy mode, you can use any of the tools and commands that you use when modeling regular polygons to modify the proxy. All edits to the polygon proxy affect the subdivision surface through a history connection. You can switch back to standard mode by choosing it in the Subdiv Surfaces menu or by right-clicking the skin. Going from polygon proxy to standard mode deletes the history connection and displays the subdivision surface again. In standard mode, you can select edges, points, and faces to modify the subdivision surface with the commands in the Subdiv Surfaces menu.

Like NURBS surfaces, subdivision surfaces have several display resolutions that you can turn on by clicking the 1, 2, and 3 keys.

The lowest resolution should have the same structure as your original polygon object, with no new subdivisions occurring. The highest resolution may subdivide the surface to some degree, even if you were successful in creating all quads on your original polygon skin. If you look at your subdivision surface head in shaded view, it should look even smoother than the NURBS version, with complete tangency between all parts. In fact, it may look too smooth in some areas, such as around the nose or lips. Adding edge loops on your original polygon head before converting is one way to make these areas stand out more. In addition, some of the original placement of points on your head may need to be moved to create more extreme features to counteract the smoothing that occurs when converting to a subdivision surface skin. You can make these adjustments on the subdivision surface directly, but it is always better to start with the best possible polygon model. Also, animation techniques discussed later require your basic polygon skin to have the exact same structure as your polygon proxy skin. Therefore, try to make most of your revisions on the original polygon skin, and then convert it again when finished.

There is one way you can make revisions to your original polygon object and have it update on your subdivision surface. This technique involves connecting the original polygon skin to the polygon proxy node of the subdivision surface skin, so that any modeling revisions you do on one will also be done on the other. You should use this technique only before doing work on the subdivision surface levels; otherwise, it may have unpredictable results. First, make sure your subdivision surface skin is in polygon proxy mode. Then select both head skins, open a hypergraph view, and turn on Options, Display, Shape Nodes in the hypergraph view menu bar. You should see a shape node for both skins, plus an extra HistPoly shape node for the subdivision surface skin. A subdivision surface has separate shape nodes for the standard and polygon proxy modes. The HistPoly node is the polygon proxy shape node. Choose Window, General Editors, Connection Editor to connect the shape node of the original polygon skin to the polygon proxy shape node of the subdivision surface skin. Select the polygon skin's shape node and click the Reload Left button in the Connection Editor. Scroll down toward the bottom and click the Out Mesh attribute. Then select the HistPoly node for the subdivision surface skin and click the Reload Right button in the Connection Editor. Scroll down toward the bottom and click the In Mesh attribute. The two attributes become italicized as they are connected (see Figure 2.66). Close the Connection Editor, and then try to modify some of the components on the polygon skin. You should see the same modifications occur on the subdivision surface skin. You can even split or extrude polygons, and the changes will be updated accordingly on the polygon proxy.

2.66. Using the Connection Editor to connect the shape node of your polygon skin to the polygon proxy node of a subdivision surface skin enables you to modify both together.

Whether you are modifying a connected polygon skin or modifying your polygon proxy skin directly, history is built up when your skin is in polygon proxy mode. Switching to standard mode deletes the history by deleting the HistPoly node. If you have connected your subdivision surface skin to your original polygon skin for the purposes of making modifications, complete your modifications before switching back to standard mode, because this switch removes the connection. Even if you are working directly on the polygon proxy skin, it is recommended to switch to standard mode periodically to clear out the history that builds up. In addition to modifying your polygon proxy to make features stand out, you can modify the subdivision surface in standard mode to better define surface features. To define the edge of a nostril, for example, right-click the skin in standard mode to select the edges that contour the side of the nose. Then choose Subdiv Surfaces, Partial Crease Edge/Vertex. You should see the surface become subdivided around the selected area as it hardens the edge slightly. For organic characters, a full crease hardens the edge too much; so in most cases, creating a partial crease is preferable. Reserve a full crease for hard-edged clothing items and armor.

Notice that creating a partial crease subdivides the selected area of the subdivision surface. Another way to add details to a specific area of the surface is by refining the selected components manually. To do this, right-click the surface again and choose Edge, Vertex, or Face to select components in the area you want to further define. To carve out a better nostril, for example, select faces under the nose, and choose Subdiv Surfaces, Refine Selected Components. Then select the points or faces in the refined area to translate them upward to carve out a better nostril.

Subdivisions on the skin are stored in levels of detail when working in standard mode. After refining the nose area, right-click the skin and choose Edge to see the subdivided edges available on the current level. Then right-click again and choose Display Level, 0. This shows you the components available at the lowest level, which should look very similar to your polygon proxy. Then change the display level to 1 to see the components associated with next level of detail on the subdivision surface skin (see Figure 2.67). You also can right-click and choose Coarser or Finer to move through the levels as needed. Continue to view any more levels that were automatically created as you refined your skin. The maximum number of levels you can have is 13, but you should be careful not to refine the surface so much that you have more than about 5 levels. The more details you have, the larger your file size (which is not efficient). If it seems like you are getting too many levels, you can collapse them down by choosing Subdiv Surfaces, Collapse Hierarchy [image]. Use a value of 1 in the Number of Levels option to collapse one level at a time.

2.67. Adding details on your subdivision surface skin in standard mode creates new levels of complex geometry.

Keep in mind that it is best to add only the details that will not be animated to the subdivision surface skin levels. These include details such as a belly button, nostrils, and skin irregularities, such as small wrinkles and bumps. The reason for this is that it is more efficient to deform and animate your original polygon skin. Later you are shown how to connect the polygon proxy node of your subdivision surface skin to the original polygon skin with a wrap deform or a blend shape. This enables you to animate the lower-resolution polygon skin and use it to deform and render the smooth subdivision surface skin for the final output. Doing this requires you to separate the essential details that will deform, such as muscles, from the incidental surface details that will not need to deform.

As you are refining your subdivision surface skin, you may notice that you cannot undo after subdividing an area. If you crease the surface, for instance, you can undo the crease; however, the subdivisions that were created by the crease remain on the surface. To remove extra subdivisions that are not being used to add details to the skin, choose Subdiv Surfaces, Clean Topology. Although you can work on half of a character when modeling with subdivision surface, do not duplicate and scale–1 in X to mirror the result as you did with NURBS surfaces. Instead, use the Mirror option in the Subdivision Surface menu, and then merge the result with the Attach option in the same menu.

Exercise 2.4
Convert Your NURBS Skin to a Polygon Skin

This exercise takes you through converting your NURBS skin to a merged polygon skin. You can then use edge loops to add surface details to your character. Finally, you duplicate the polygon skin to create a smooth subdivision surface skin that has the same basic structure.

  1. Before converting, make sure the normals are going in the right direction on all the NURBS patches. Drag a selection box around all the patches and choose Display, NURBS Components, Surface Origins. Make sure all the blue lines are pointing outward on the surfaces. If a blue line is pointing inward, select the surface and choose Edit NURBS, Reverse Surface Direction [image]. Choose the option that will make the patch have the same orientation and normals direction as the patches surrounding it. You can do this by just applying Swap, but it may require several combinations. When the normals are correct, select all the patches again and choose Modify, Convert, NURBS to Polygons [image]. Set the options to Quads type, General Tessellation method with Per Span # of Iso Params set to a value of 1 for both the U and V. Leave all the other options turned off, and click the Tessellate button. In the perspective view's menu bar, turn off NURBS Surfaces under the Show menu. You should then be able to see the new polygon patches that have the same number of edges as the NURBS patches have isoparms. Recheck the normals on the new polygons objects before combining them. Do this by choosing Display, Polygon Components, Short Normals. If the normals are still pointing in the wrong direction on any of the polygon objects, select the object(s) and choose Edit Polygons, Normals, Reverse [image]. In the options box, make sure you are only reversing, and not extracting, and click the Reverse Normals button. If you are getting any shading anomalies on the polygons, you can fix this by choosing Edit Polygons, Normals, Set to Face.

  2. Then combine the polygon objects that should be one continuous body part, such as all the pieces of your character's head. Remember that it is not usually desirable to merge all the parts of the character into one large skin. You should instead create separate skins for the head, torso, hands, and legs (see Figure 2.68). To do this with your converted head polygons, for example, select them and choose Polygons, Combine. Then choose Display, Polygon Components, Border Edges to display the edges that are not merged. Merge the edges by choosing Edit Polygons, Merge Vertices [image], setting the Distance value to .01, and then click the Merge Vertex button. If any internal border edges remain, choose Edit Polygons, Merge Edge Tool to fix them. Click the overlapping border edges twice so that they turn orange, and press the Enter key to merge. If there are any edges that still won't merge, check the normals again, and reverse on a per-face basis if necessary.

    2.68. Combine your polygon skin into several body parts, but don't merge them all into one single skin.

  3. Add details to your skins by using the Split Poly tool to create wrinkles, muscles, and surface irregularities. Keep your polygon skins all quads by using edge-looping techniques as described earlier in this section. Create only as much detail as you need for animation on your polygon skins. Leave extraneous surface details for doing on the subdivision surface skin, where you can create it on nondeforming levels. When finished, duplicate your polygon skins and convert the duplicates to subdivision surfaces. If you get a conversion error, check the Script Editor to find out how to fix it. Usually it is just a matter of increasing your conversion option values, or doing a Polygon, Cleanup to fix nonmanifold geometry problems. As detailed previously, you can connect the original polygon skins to the polygon proxy node of the subdivision surface skins to make final adjustments to your polygon models. This will enable you to counteract any loss of detail on the subdivision surface skin due to the smoothing operation. After making adjustments on the polygon proxy node, remove the connection by switching to standard mode, and continue to refine surface details on the levels of the subdivision surface node. Make sure that you keep the polygon proxy the same as the original polygon model, so that they can easily be connected with a wrap deform when you get to the animation stage.


Preparing to Render Your Character's Skin

Because the focus of this book is modeling and character setup, creating materials and textures for your character's skin is covered only as it relates to the modeling process. This section shows you how to prepare for texturing your NURBS or polygon skins in Maya.

NURBS Skin-Texturing Considerations

A NURBS skin is a true UV surface; so if you assign a normal 2D file texture to the surface, it wraps on the surface automatically. This can be an advantage over assigning a projected file texture, which will not work well on a complex surface that curves away from the projected angle. When texturing NURBS surfaces with a UV texture, however, keep in mind that the parameterization makes a difference in how the texture wraps on the surface. Uniform parameterization can be useful during the modeling process, and your surfaces can be left that way if you are going to convert them to a merged polygon skin, because then the texturing will be done at the polygon level. If you are planning to bind and animate your NURBS skin, however, you need to convert the parameterization of your surfaces before texturing. Using a Uniform parameterization on a complex surface that has variations in the spacing of the isoparms will cause unwanted stretching and compressing of the texture. The reason for this is that Uniform assigns the same amount of the texture image to each space between isoparms, no matter how small or large it is. So areas where the isoparms are close together cause the texture to compress, and areas where isoparms are far apart cause the texture to stretch. You can reduce this considerably by relofting all your NURBS patches to the Chord Length parameterization (see Figure 2.69).

2.69. When texturing NURBS surfaces, Uniform parameterization can cause distortion of the texture, whereas relofting the surfaces as Chord Length will produce a more even texture.

You can see the effect of parameterization in the Attribute Editor under the shape node. A Uniform parameterization has whole number values in the Min Max Range of the U and V fields. Usually the max range corresponds to the span's UV values. This causes the stretching and compressing, because each span is being allotted a value of 1, no matter how large it is on the surface. Then take the same surface and copy out the surface curves to reloft it with a new parameterization. In the Lofting options box, choose Chord Length parameterization, leaving all the other options the same. Make sure you repeat the process to convert both directions on the surface to Chord Length. If you then check the Attribute Editor, you should see decimal values in both the Max Range fields. The Chord Length parameterization assigns each span just the amount of texture it needs based on its size, and should make the texture wrap on the skin more evenly. Finally, if the texture is still not wrapping properly, open an Attribute Editor for each patch and turn on the Fix Texture Warp option in the Texture Map section. Set the grid division values based on the number of spans on your surfaces. For a multipatch character with many surfaces to set, you can also do this in the Attribute Spread Sheet under the Render tab.

Another thing to be aware of when preparing to render a NURBS multipatch skin is that the resolution needs to be set higher to make the skin look continuous when rendered. Even if the patches appear to have perfect tangency in the hardware views, in your renders you may notice that small gaps appear at the seams between patches (see Figure 2.70). To fix this problem, drag a selection box around all the NURBS patches and choose Window, General Editors, Attribute Spread Sheet. In the Tessellation tab, you can click the name at the top of each column to type in a new tessellation setting for all the surfaces selected. Turn Explicit Tessellation Attributes to on, set the U and V Divisions Factor to 4.5, set the Curvature Tolerance to High Quality, and set the Smooth Edge to on with a Ratio of .99. Leave all the rest of the columns on their defaults, and try rendering your NURBS multipatch skin again. The skin should appear continuous, with no gaps at the seams between surfaces. If any gaps still appear, recheck the surfaces to make sure there isn't a tangency problem. You can continue to increase the U and V Divisions Factor values in the attribute spreadsheet, but this will increase your rendering time and should not be necessary on a skin that has been stitched well.

2.70. If small gaps appear at the seams of your multipatch skin when rendered, even though they appeared tangent in the hardware views, increase the tessellation settings for the surfaces in the Attribute Spread Sheet.

The best way to approach assigning a UV file texture to a NURBS skin is to assign numbered grids to each patch. You will then be able to see how all the NURBS patches are oriented, and adjust them if necessary. Then you can use the Maya 3D Paint tool to paint details on the grid surfaces. When this is done, you can then bring all the images into a paint program, such as Photoshop, and composite details on top of the painted images. To do this on your character's face, for instance, first create a basic 500x500-pixel grid in a paint program, complete with orientation and UV direction text markers, and save it as a TIF image. In Maya, open a hypershade view and create a new Phong material, naming it SkinGrid. Assign your grid to the Color attribute of a file texture by loading your image into the Image Name field. Then drag a selection box around your character's head patches to select them all and right-click the shader to choose Assign to Selected. Press the 6 key with your cursor in the perspective view to display the grids on your surfaces (see Figure 2.71). If any of the grids do not match up, or appear to be backward, this may be a sign that the surface should be reversed. Then drag a selection box around all the surfaces with a grid to paint on them. To activate the 3D Paint tool, in the Render module choose Texturing, 3D Paint Tool [image]. Inside the resulting options box, generate separate file textures for all the grids by clicking the Assign Textures button. Then choose a brush and size and proceed to paint across all the surfaces. Save your painting to the file textures by clicking the Save Textures button. The difficulty with painting textures this way is that this process generates a separate image file for every patch. This process will be time-consuming and difficult to piece together and edit in a paint program such as Photoshop, but it is going to create true UV textures on your character's skin.

2.71. You can assign a grid file texture to your skins to use as a surface guide when painting textures.

Painting on your NURBS patches will enable you to create a color map for your character's skin. A color map should have all the main color and textural variations that a real surface contains. Try not to make the color map too even and perfect. On a face, for instance, add imperfections and changes in tone. Increase the pore size in areas such as the cheeks and nose, darken areas in the eye sockets where the skin is thin, and add wrinkles on the forehead and cheeks. If your character shaves, add razor stubble on the chin. You must open each patch's file texture in Photoshop to composite skin, eyebrow, and lip textures onto the final color maps. You can create variations on the skin base by adding noise and cloud effects.

Although assigning a normal UV file texture is preferable on a NURBS surface, it is time-consuming to create on a multipatch character. If you don't have the time to go through this process, you will want to project an image onto many NURBS surfaces instead. Make a face file texture of your character by taking a wireframe or shaded screenshot in the front view. In your paint program, paint and composite on top of the screenshot to create a texture to project from the front view onto all of your face patches. Then create another Phong material that you load your front face file texture into the Color attribute. In the resulting options box, where you can choose the projection type, choose Planar. Although you can assign one large texture map placed on as a cylindrical projection to your character's head, you also can separate your head textures into planes projected from several angles onto separate skin surface groups. Group all the patches you want to place the texture on, such as all the face patches, and right-click the front face shader to assign it to the group. Go to the material's Attribute Editor again, and in the Projection tab, click the Interactive Placement button to activate a texture projection manipulator. You should see a manipulator in your 3D views, and also see a place3Dtexture node in the hypergraph view. Click the Fit to Group Box button to place the manipulator around the assigned patches, and then manipulate its channels to position it so that it best fits the face. Because you created it from a screen capture, the finished projected texture should fit your character's face (see Figure 2.72).

2.72. A basic planar projected color map should look like the face, and will be easier to create in a paint program than painted textures on a multipatch head.

Projected textures are not locked to the UV surface, but are projected from specific angles like a slide image onto a screen. If you fold the screen, the image doesn't fold with it. A true UV texture behaves like it is painted on the surface, so it deforms with the surface. Creating a texture reference object for a projected texture will simulate this effect and lock the projected image to the surface. Create a texture reference object by selecting the group of face patches you assigned the projected texture, and in the Rendering module, choose Texturing, Create Texture Reference Object. You will see another set of pink skins in the 3D views, as well as a new reference group in the hypergraph view. You can move this group wherever is convenient, or just hide it. Then if you deform the textured skin patches, the file texture will deform with the skin appropriately.

Regardless of whether you paint or project your maps, you can create other maps for your skins from the finished color map. The other maps commonly created for a character include bump, specular, and diffuse maps. These maps are normally grayscale modified versions of the color map and are assigned to the appropriate attributes in the material. The bump map produces a 2D bumpiness by creating highlights and shadows from the map values. The specular map controls the placement of specular highlights on specific areas to simulate shininess on the skin, whereas the diffuse map softens features in particular areas. You also will sometimes create transparency maps, which are grayscale maps that control the visibility of parts of the skin. When rendering a radial head with eye patches, for instance, it is common to use a ramp to create a soft transparent edge on the eye patches. This better hides the seams between surfaces. If you do this, however, make sure you set the eye patch rendering properties to not cast shadows; otherwise, the transparent edge will cast a shadow on the head and make the seam noticeable again.

Polygon Skin-Texturing Considerations

Unlike NURBS surfaces, polygon objects must have their UV directions assigned to them. The UVs are created on the faces according to the method you choose in the Edit Polygons, Texture menu. To see the UVs of a particular polygon body part, you must open a floating UV texture view by choosing Window, UV Texture Editor. Try the different projection methods on your character's body parts to see which produces the best results. The important thing to avoid is having overlapping UVs, or having too many small pieces. The cylindrical projection is going to work well for many body parts, including the head, but stretching may occur in areas such as the neck. The Automatic mapping method will produce a result that has no overlapping UVs, but may create too many small pieces that have to be manually moved and sewed together (see Figure 2.73). You may get overlapping UVs using many of the other mapping methods, which will require relaxing the UVs in these areas to spread them out, and even some point by point tweaking. One thing to make the process easier is to cut your surfaces up before you map them to reduce the number of overlapping UVs. For instance, separate the face of your character from the rest of its head to map just the face with a planar or automatic projection. Then put them back together again after they are mapped. Some people even go through a process of flattening the geometry out to map it, and then deform it back into its original shape using a blend shape. Regardless of how you create your character's polygon UV map, when it is done, take a UV Snapshot of it in the Polygons menu to use as a guide when creating the color map in your paint program. Then assign the map as a file texture on your skin material and assign it back to the polygon skin.

2.73. Creating polygon UVs with the Automatic mapping method keeps the UVs from overlapping, but produces many small pieces that must be moved, sewed, and relaxed to create a good map.


Wrapping It Up

Now that you have gone through the modeling process shown in this chapter, you should have a good idea of the strengths and limitations of modeling with each kind of surface in Maya. Knowing how and when to best use each kind of surface in Maya will make you a better modeler, one who is more efficient when creating characters. The goal of modeling is to create a skin that not only looks good, but that also deform well during the animation process. The next step toward animating your character is to create the skeleton deformers and animation controls. You learn how to do this in the next chapter by creating your character rig.


Chapter 3. Character Skeleton Setup

This chapter shows you how to create complex controls for animating each of the main parts of your character model. Creating such controls involves many of the tasks that a character setup artist does on a daily basis, including such things as drawing skeletons, creating Inverse Kinematics (IK) handles, constraining objects, using control icons, and parenting objects into a complex hierarchy. After completing this chapter, you should have a good understanding of all the basic techniques that a character setup artist frequently uses to create good character controls.

The skeleton controls shown in this chapter create a good general-purpose character rig (see Figure 3.1). The basic hierarchy was based on a rig shown by a Blue Sky animator who taught at the School of Visual Arts back in 1996. (I have unfortunately forgotten that animator's name.) I've been developing and adding to the rig functionality since that time. Although nothing on this rig was taken directly from any other rig, ideas for controls have come from a variety of sources. I have gotten inspiration from colleagues, students, industry presentations, and Alias|Wavefront master classes by people such as Jason Schleifer at SIGGRAPH (who used controls similar to the ones shown for the advanced backbone on the Lord of the Rings characters). The complete rig presented in this chapter incorporates a sampling of all the basic kinds of controls that you would be required to create for a production-ready character.

3.1. In this chapter, you create a general-purpose rig with controls for each part of your character's body.

Keep in mind that there is no perfect all-purpose skeleton rig that will work well in all situations. In a real production, character setup artists create rigs for particular purposes. It is not uncommon for the main character in an animation to have a variety of rigs, with controls designed for particular actions in a scene. For instance, there might be separate rigs for walking, tumbling, lifting, and lip-syncing. However, an understanding of how to build all the controls in a general-purpose rig better prepares you to create more production-specific rigs.


Creating Basic Animation Controls

This section shows you how to create basic skeleton controls for your character. You learn to draw skeletons with precisely placed pivot points, so that the joints rotate accurately. Polygon reference bones are used as guides for drawing Maya skeletons, and are later parented to the skeletons to use as animation reference. Drawing, manipulating, and editing skeletons is covered in detail. Then, a rigging method that involves adding curve-based control icons is shown to make it easier to manipulate the skeletons. Finally, all skeletons and control icons are parented into a hierarchy used as a functional character control rig.

Understanding Skeletal Anatomy

Creating believable character motion requires that you create controls based on how real bodies work. Therefore, you need to place carefully the joints in your models so that the skin bends like it has a real skeleton inside of it. Your skeleton creates a 3D structure for your body, and enables you to move around. Without a skeleton, your body would be just a flat lump of muscle and skin. You wouldn't even be able to stand up! Skeletal joints are therefore very important for defining how your character moves.

Be aware, however, that some important differences exist between how a real organic body works and how a computer-generated 3D character is set up. In a real body, muscles contract and stretch to move the bones in a skeleton. Normally this process works in the reverse way for a 3D character, where the bones are the main movers, and the muscles deform in response. Because both work together very closely, the difference is hardly noticeable, but doing it this way makes setting up the character a lot easier.

Another important difference is that you can simplify some areas of the body in a 3D character. The backbone, for instance, doesn't usually require the number of bones in a real backbone. Because Maya smoothly blends the effects of the bones on the deformed skin, using fewer joints is usually desirable, because the use of fewer joints simplifies your setup tasks.

It is a good idea for anyone who wants to design, model, or set up 3D characters to have a good understanding of the skeletal anatomy of the human body (see Figure 3.2). Most characters are based on the same basic structure. Even other mammals, such as horses and dogs, have a similar structure. One of the best references a character artist can have is a variety of anatomy books to use when creating 3D characters.

3.2. Character setup artists must have a good understanding of skeletal anatomy.

One thing to notice carefully is how a particular joint moves. Although joints have a lot of subtleties in a real body, the joints in a 3D character can be simplified into two kinds: ball joints and hinge joints (see Figure 3.3). Ball joints can rotate in all three directions, whereas hinge joints can rotate in only one direction. Examples of ball joints can be found in the backbone, shoulder, and legs where they attach to the hips. Examples of hinge joints can be found in the elbows and knees.

3.3. The two main kinds of joints in the human body are ball joints and hinge joints.

Placing Polygon Reference Bones

One thing that many animators use today is a low-resolution reference skeleton—a 3D skeleton made from polygons or NURBS bones—as a guide for drawing Maya skeletons. The advantage to using a 3D skeleton as reference is that you can see exactly where the joints are, which makes it easier to place your pivot points correctly.

Toward the end of this chapter, you make the reference bones child to your Maya joints so that it is easier to see whether your skeleton controls work properly. You can then hide your deforming skin when you are ready to animate, to speed up your system, and show only the reference bones while animating. Traditionally, animators often used a nondeforming proxy of their skin to animate in real time. To do this, you duplicate your skin models, convert them to low-resolution polygons, and detach the skin at the skeletal joints. Then you make the skin pieces child to the appropriate Maya joints. More often today, however, animators use a low-resolution reference skeleton for the same purpose.

Exercise 3.1
Placing Polygon Reference Bones

Now that you have your model finished, it's time to start creating controls for animating your character. In this exercise, you create a polygon reference skeleton that fits correctly inside your character's skin.

  1. Open the scene that contains your character model from the previous chapters. Make sure the scene contains only your final character models, and doesn't contain any creation curves, instances, or history connections. Your models don't need to be in any particular hierarchy, but you do want to organize them so that you can display or hide them easily. To do this, group your models under a node that you name MyModels. Then create a new layer by clicking the Create a New Layer icon in the Layer Editor and name the layer Models by double-clicking it to enter the new name in the layer options box. Select the MyModels group node, and place it on the layer by right-clicking the layer, and choose Add Selected Objects (see Figure 3.4). Finally, import into your scene the ReferenceBones.mb file from the download site.

    3.4. Create a new layer for your models.

  2. After you import the file that contains the polygon reference bones, set the Models layer to Template by clicking the layer box until a T appears. Template enables you to use your models as a guide for placing the reference bones. You want to manipulate the transforms on the reference bones to make them fit inside your model (see Figure 3.5). To make the polygon bones fit well, you will probably have to manipulate their components to some degree. You can use all the tools you used in Chapter 2, "Modeling the Skin of a Biped Character," to refine your models, including lattice deformers. You may also want to create special features if your character model is more surreal. If your character is a devil, for instance, you can pull out horns on the skull bone. Or if it has wings and a tail, duplicate some of the bones from the backbone or arms and make wing and tail bones.

    3.5. Template your model, and use it as a guide for placing your polygon reference bones.

Drawing Skeletons

Skeletons are a special kind of deformer found in the Animation module (press F2) and are specifically designed for animating characters. Like other deformers, skeletons affect the component structure of your models. By assigning and animating the skeletons, vertices on the skin move, and your character models change shape over time. Skeletons usually have length, which you create by drawing a skeleton from point A to point B. Most skeletons have at least two joints: a root joint and an end joint. A bone connects each joint. Although you can create single-joint skeletons, multiple-joint skeletons are most common in characters.

The most basic way to manipulate skeletons is to rotate their joints, which is called Forward Kinematics (FK) (see Figure 3.6). It is not desirable to translate any joints other than the root joint. Translating a joint in the skeleton chain causes the previous joint's center to no longer be oriented down the length of the bone, which can cause rotation problems on your controls. By rotating the joints, you can avoid this problem. Rotating the joints also enables you to animate the skeletons to bend in any direction. As the name implies, you animate with FK by starting at the root joint, and progressively rotate each joint down the skeleton chain.

3.6. The most basic way to animate a skeleton, called Forward Kinematics, is to rotate the joints.

The other way to manipulate skeletons is to use Inverse Kinematics (IK), which constrains the skeleton to bend in a single direction by assigning it an IK solver. You manipulate the skeleton by translating an IK handle, which is created when you assign the solver. Translating the handle causes all the joints to rotate that are constrained by the solver. Usually the IK handle is on the last joint in the skeleton chain, so that translating it affects the joints higher up in the chain—hence the name Inverse Kinematics.

Understanding skeletons is important if you want to create effective character controls. If you display the center on a skeleton joint by choosing Display, Component Display, Local Rotation, notice that the local center of a joint is not set to the global orientation. When using the default joint creation settings, the X-axis always points down the bone to the next joint (see Figure 3.7), enabling you to rotate easily around a joint's local center to twist a bone. You will want to do this in several parts of your character (to make a forearm twist, for example). Also notice that the Z-axis points toward you in the view in which you created the skeleton, because the Z-axis is the preferred rotation axis if IK is attached to the skeleton.

3.7. The default orientation of joints has the local X-axis pointing toward the next joint in the skeleton chain.

You can set the skeleton joint creation options to create IK automatically when you draw a skeleton, or you can add the IK manually after you have drawn the skeleton. In either case, draw your skeletons in a particular way when you know they will be constrained with an IK solver. IK bends in only one direction, which is based on the preferred angle of the joints. The preferred angle is the direction the joints are pointing when they are initially drawn. Draw your leg skeletons in the side view with a slight bend toward the front of the knees, for instance, to ensure that they have the correct preferred angle when their IK is activated (see Figure 3.8). Usually this requires you to draw the skeletons in a particular orthographic view, which is perpendicular to the axis that the joint should rotate in. The main axis of rotation on a normal IK skeleton is always the Z-axis.

3.8. Draw the IK leg skeletons with a slight bend toward the front of the knee to set the preferred angle.

There are some obvious advantages and disadvantages to using IK or FK on your skeletons. One advantage of IK is that it is faster to set and edit translation keys on a single IK handle, than to set and edit rotation keys on multiple joints. It also is easier to target the end of a limb in 3D space when you are animating (to make the feet target the floor, for instance). On the other hand, IK is constrained to bend in only one direction, whereas FK can bend in any direction. This makes IK more suitable for hinge joints, such as the elbows and knees. FK, on the other hand, is more suitable for joints that move more like ball joints, such as the backbone vertebrae.

Another limitation of IK is that all the joints in a solver move when the IK handle is animated, making it impossible to isolate the rotation of a single joint in the chain. You must be able to rotate a child joint without rotating the parent if you want to create a swinging-type motion on the arms or legs (see Figure 3.9). This motion type usually occurs only as an unconscious movement while walking, throwing, or kicking. Because many limb motions are conscious, however, it is still better to use IK on the arms and legs most of the time. For the times when you need to create a swinging motion, however, you must have controls for switching between IK and FK in the middle of your animation.

3.9. A swinging motion on the limb joints is not possible when IK is constraining a skeleton.

All the tools for drawing skeletons and creating IK are under the Skeleton menu in the Animation module. Before you create a skeleton, check the settings in the Joint Tool options box by choosing Skeleton, Joint Tool [image]. Here you can constrain a skeleton to rotate in a specific way, by turning off the Degrees of Freedom for a particular axis. You also can change the way Maya orients the local centers on joints by setting the Auto Joint Orient to something other than XYZ. For most skeletons, however, it is best to use the default settings. The only setting you will frequently change is the Create IK Handle option (see Figure 3.10).

3.10. Open the Joint Tool options box to turn on or off the automatic creation of an IK handle on a skeleton.

You can add IK to your skeleton automatically when you draw it, or you can add it later after you draw the skeleton by choosing IK Handle Tool in the Skeletons menu. The available options are the same in either case. The main difference is that IK, if added automatically, always constrains the entire skeleton with the solver; if added manually, however, IK enables you to specify what joints will be constrained. You also can add more than one IK handle to different parts of the same skeleton if you add the IK manually. Like the joint options, you usually use the default IK handle option settings. Keep in mind that you also can adjust most of the joint and IK handle options in the Attribute Editor after you create a joint or IK handle.

One IK handle option you will occasionally change is whether the current solver is a Single Chain (SC) or a Rotate Plane (RP) solver. The difference between these two solvers is how they control the overall twist orientation of the skeleton. The SC solver forces the skeleton to twist when the IK handle is rotated. The RP solver, on the other hand, has a separate twist channel for twisting the skeleton, and the IK handle affects the skeleton only through translation (see Figure 3.11). You get more flexibility by separating the Twist attribute from the Rotation attributes of the IK handle, and the separation enables you to control the twist channel with a separate object by using a pole vector constraint. Because of this, you will be using an RP solver most of the time. The arms and leg skeletons of your character, for instance, will use RP solvers so that you can control where the elbows and knees point by using pole vector constraints.

3.11. When you create an IK handle with an RP solver, a separate twist channel controls the overall orientation of the skeleton.

When drawing skeletons, it is best to click and drag with the left mouse button held down. This action enables you to place joints precisely while drawing them. Correct placement is important, because modifying skeletons after they have been drawn creates values in the joint's rotation channels, which can be undesirable. If you place a joint in the wrong place while drawing the skeleton, you can press the Z key to undo, and proceed to redraw the joint. When all the joints are drawn, press the Enter key to set the skeleton.

One thing to consider when drawing skeletons is whether you want to attach multiple branches to a single joint. Do this by first clicking a joint within an already existing skeleton when drawing a new skeleton. When you finish drawing the new branch, notice that rotating the joint you clicked rotates both branches together (see Figure 3.12). This joint rotation occurs because the two joints have merged into one joint. Although you can create an entire character skeleton as one piece this way, this method provides limited flexibility for animation because it prevents you from being able to animate branches separately from each other.

3.12. Attaching two skeletons creates a single parent joint for two separate branches. You cannot rotate the two branches separately from one another.

Instead of attaching skeleton branches, draw the joints separately, and parent the branches to a single joint or control object. Doing this enables you to animate the branches together by animating the parent object, or separately by animating the child joints, giving you more flexibility when animating. To draw a skeleton branch so that it starts on a joint but is not attached to the joint, avoid directly clicking the already existing joint. Instead, after clicking, drag the new joint on top of the previously created joint, and continue drawing the branch. You can then parent the joints under a control object or group node.

When parenting joints, notice that a bone is always drawn between the parent joint and the root joint of the branch. Keep in mind this can sometimes clutter your interface with crisscrossing joints on a complex skeleton. To keep this from happening, you have to put two group nodes between the joints. Do this by parenting the two joints, and then select the child root joint and press Ctrl+G twice. After doing this, notice that the connecting bone disappears. Also be aware that this hasn't changed the functionality of the skeletons.

Editing Skeletons

The Skeleton menu contains all the tools and commands for editing skeletons. Use the Insert Joint tool to add joints to a skeleton chain. Just click any parent joint, and drag to place the new joint. Delete joints in a skeleton chain by selecting any joint but the root joint, and choose Remove Joint. Some other useful commands are Disconnect Joint, Connect Joint, and Mirror Joint. Using the Mirror Joint tool speeds up your workflow by enabling you to more easily duplicate skeletons to the opposing side of your character's body (see Figure 3.13). This command is based on your character's position in global space, so make sure your character is centered on the global axis in a symmetrical manner. A new option in Maya 5 is the ability to replace naming conventions on the mirrored joints. For instance, you can specify that all joints that begin with Lt to begin with Rt.

3.13. Mirroring a skeleton in a particular plane is one of the most useful commands for editing skeletons.

Ideally, you want to draw your skeletons with the correct preferred angle. Sometimes, however, that won't be possible, and you will have to reset the preferred angle on a skeleton. Do this by removing any IK that may be on the skeleton, rotate the joints to their new preferred angle, and with the joints still selected, choose Skeleton, Set Preferred Angle. You can also set this by right-clicking the skeleton. You then have to reassign the IK to the skeleton. If you ever have any question what the preferred angle of a joint is, select the joint and choose Assume Preferred Angle. Finally, in the Skeleton menu you can disable or enable all IK solvers in your scene, or specific IK handles as needed.

Exercise 3.2
Drawing and Editing Your Skeletons

  1. Using the polygon reference bones as a guide, you now draw the basic Maya skeletons for your character. Before you start to draw the joints, however, place all the polygon reference bones on a layer, and set the layer to Template. Because the skin models are not needed at this time, hide them by turning off their layer's visibility. In addition, if you need to adjust the display size of the joints, because your model is too large or too small, do so in the Display menu under Joint Size.

  2. Begin by drawing an IK leg skeleton in the side view. Do this by choosing Skeleton, Joint Tool [image], and turn on the Create IK Handle option. Make sure the Current Solver is set to IKRP Solver, and close the options box. Starting at the hips and ending at the ankle, click four times to create the joints. In the knee area, create a small joint that will mimic the flat of the knee. This will make the knee bend nicely when the character is bound to the skin. Make sure the skeleton is bent slightly toward the front of the knee so that you get the correct preferred angle, and then click Enter.

  3. Open a floating hypergraph view by choosing Window, Hypergraph on the top menu bar. You will use the Hypergraph view to name and organize your skeletons. Size the Hypergraph window so that you can still see your character in the perspective view. Then place your curser in the Hypergraph window, and click the A key to Frame All. Notice that you have a four-joint skeleton displayed as a hierarchy of graphical nodes, with a hidden effector node, and a separate IK handle node. The IK handle is forced to stick to the effector, which is usually placed on the last joint of an IK skeleton. This changes as soon as you parent the IK handle under an object. Try selecting the IK handle in the hypergraph view, and translate it in the perspective view. You should see your leg skeleton bend. Press Z to undo the movement, and then name each of the leg joints LtLegRoot, LtLegKnee, LtLegLow, and LtLegEnd. Name the IK handle LtLegIK (see Figure 3.14). It is not necessary to name the effector.

    3.14. Name all your skeleton leg joints and leg IK handle.

    Rotate and translate the LtLegRoot joint in the front and side views so that it sits right on top of your polygon leg bones. Make sure you do not translate any joints except the root joint. Also make sure the LtLegKnee and LtLegLow joints rotate correctly around the left knee's pivot point. When you get the left leg placed correctly, select the LtLegRoot joint, and choose Skeleton, Mirror Joint [image]. Set the Mirror Across option to the YZ plane, and the Mirror Function to Behavior. This creates a right-leg skeleton and associated IK handle that is a mirror copy of the left-leg skeleton. Use the new joint renaming option to name the right-leg joints the right-leg joints and IK handle RtLegRoot, RtLegKnee, RtLegLow, RtLegEnd, and RtLegIK.

  4. Draw a three-joint skeleton for the left foot in the side view. This time, however, turn off the Create IK Handle option in the Joint Tool options box. Start the skeleton at the ankle pivot, going down to the ball of the foot, and then out to the end of the toe. When you are drawing the foot root, make sure you don't click the end of the leg skeleton, because doing so would attach the two skeletons. You will be parenting the foot skeletons to control objects, so they don't need to be attached. After drawing, adjust the skeleton as needed, and name the joints LtFootRoot, LtFootBall, and LtFootEnd. When you are done with the left foot, mirror it to create the right foot with the appropriate name changes.

    One consideration to note is that if your character has bare feet, you may want to create individual toe skeletons. Do this easily by drawing them as FK skeletons in the side view. Later, when parenting your skeletons into a rig, just make the individual toe skeletons child to the LtFootBall joint.

  5. Even though the hips move as a single unit, you create two separate hip skeletons for skin-weighting purposes. Again, these skeletons should not be attached, but will later be parented to give you more flexibility when animating them. Begin by drawing a skeleton from the center of the hips out to the edge of the pelvis, and down to the top of the left-leg skeleton. Be careful not to place the pivot for your character's hip skeletons too low. Each hip skeleton should have the pivot point for the root joint in the middle of the pelvis slightly below the belt line. Name the joints for the left-hip skeleton LtHipRoot, LtHipSide, and LtHipEnd. When your left-hip skeleton is complete, mirror and rename it appropriately to create the right-hip skeleton. This completes your lower-body skeletons (see Figure 3.15).

    3.15. Using your polygon bones as reference, finish drawing the lower-body skeletons for the hips, legs, and feet.

  6. The part of the body that connects the lower- and upper-body skeletons is the backbone, which begins at the center of the hip and ends at the base of the neck. The backbone should be a separate skeleton from the hips, because you want to be able to animate the spine without moving the hips, and vice versa. To ensure this is the case, make sure you do not directly click the hip root joints when you begin drawing the backbone. Instead, in the front view, click away from the character and drag the backbone root over the hip roots. Then hold down the Shift key as you draw three joints straight upward, without any preferred angle (see Figure 3.16). The joints should go from the hip's pivot to around the belly button, then to the solar plexus, and finally to the top of the sternum. Be sure to also check the placement of the skeleton in the side view to make sure it is inside your character's torso. If necessary, translate the root joint in the Z-axis to position the skeleton correctly.

    3.16. Draw a simplified FK backbone skeleton straight upward, without any preferred angle.

    This is obviously a simpler version of the backbone than what exists in a real body, as it has fewer joints and doesn't follow the contour of the spine. The reason you are simplifying this skeleton is because it is going to be used as a control for a more complex backbone skeleton you create later in this chapter. You draw the skeleton straight, because it is going to be using only FK, and this gives you a smooth arc when the backbone bends in any direction. Keep in mind, however, that a simplified backbone such as this is acceptable as-is for a simple character. Finish the backbone skeleton by naming the joints BackRoot, Back2, Back3, and BackEnd.

  7. To begin the upper-body skeletons, create two IK skeletons for the clavicles. Make sure you turn on Create IK Handle in the Joint Tool options box, and then draw the left-clavicle skeleton in the front view, using the polygon bones as a guide. It should originate at the middle of the chest and end at the top of the shoulder. After you have created the left skeleton, select the root joint, and transform it as needed to position it correctly over the polygon clavicle. Name the joints LtClavicleRoot, LtClavicleEnd, and LtClavicleIK. When completed, mirror the skeleton to create the right clavicle and rename the joints as needed.

  8. Create a left IK scapula joint in the same way as you created the clavicle joint. Draw it in the front view so that it goes from the inner edge of the scapula to the top of the shoulder, where the clavicle and scapula meet. The finished scapula skeleton should follow the raised area at the top of the polygon scapula bone. Transform it in all the views to make it fit properly, and name the joints LtScapulaRoot, LtScapulaEnd, and LtScapulaIK. Mirror the result to the other side, and rename the joints appropriately.

  9. The neck skeleton will be simplified to a two-joint FK skeleton. The reason for this is that the neck really doesn't bend much in a real body, but instead serves mostly as a pivot for shifting the head around. On a simple character, this kind of neck works fine. Later in this chapter, you refine the neck to be more complex. In the side view, draw the neck joint from the end of the backbone skeleton to the base of the skull. Because this should be an FK skeleton, make sure to turn off the Joint tool's Create IK Handle option before drawing. Also be careful to not attach the neck skeleton to the back skeleton. Name the resulting neck joints NeckRoot and NeckEnd.

  10. To create the head and jaw skeletons, you also use FK, so leave the Joint tool's IK option turned off. In the side view, begin the head skeleton at the base of the skull, and end it at the top of the skull. Be sure not to attach it to the end of the neck joint. The pivot point for the head root joint should be slightly below the ear, from where your character tilts its head. Name the two head joints HeadRoot and HeadEnd. You also should draw the jaw in the side view, from close to the same pivot point as the head root. Make the jaw a three-joint chain that goes down and out to the end of the chin (see Figure 3.17). Contouring the shape of the jaw creates better weighting when the skin is bound. Name the jaw joints JawRoot, JawLow, and JawEnd.

    3.17. Add an FK jaw skeleton after drawing skeletons for the clavicles, scapulas, and skull.

  11. The last joints you are going to draw for your basic skeleton controls are for the arm and hand. Draw the arm with a slight bend toward the elbow. This means that you will draw the arm skeleton in the top view if your character's elbow faces backward and the hand faces downward. Or draw it in the front view if your character's elbow faces downward and the hand faces forward. Make sure IK is turned off in the Joint Tool options box, and begin by clicking close to the left shoulder socket. Draw the arm skeleton from the shoulder to the elbow, from the elbow to midway down the forearm, and finally to the wrist. Name the joints LtArmRoot, LtArmLow, LtArmTurn, and LtArmEnd.

    The reason you turn off IK when drawing the arm skeleton is that the IK for the arm should not be placed on the entire skeleton. As mentioned previously, IK always constrains all the joints within the solver to rotate in one direction. For the elbow joint, which works as a hinge joint, this is fine. But in addition to the elbow joint, you have drawn a LtArmTurn joint that will be used to twist the lower arm of your character. To make sure the arm IK doesn't interfere with the rotating of this joint in X, leave this joint out of the solver. Do this by selecting the IK Handle tool, and click the arm root joint, and then click the LtArmTurn joint (see Figure 3.18). Name the resulting IK handle LtArmIK.

    3.18. Place the arm IK from the shoulder to the middle of the forearm so that the arm turn joint is outside the RP solver. Then move the pivot of the arm effector to the wrist.

    When the IK is added, notice that you can still bend the arm using the IK handle, while still being able to select the LtArmTurn joint to rotate it freely in X. To make the IK act more like it controls the whole arm, you can move the effector to sit over the wrist joint. Do this in the hypergraph view by selecting the arm joint's hidden effector node, and then click the Insert key to move the effector's pivot. Notice that the IK handle sticks to the effector when it is moved. Hold down the V key to snap the effector on top of the LtArmEnd joint. When finished, click the Insert key again to go out of pivot point mode. Now when you translate the IK handle, it behaves as if it controls the arm from the wrist, rather than from the forearm.

    Finally, draw a two-joint FK arm skeleton for the left hand. You can draw this in the front view, from where the wrist rotates to where the finger bones begin. Do not attach the hand skeleton to the end of the arm. Name the hand joints LtHandRoot and LtHandEnd. When finished, mirror the left-arm and left-hand skeletons to the right side, and rename them appropriately.

  12. After you have drawn the last skeleton, go back and parent all the polygon reference bones under the appropriate skeleton joints. For instance, make the left femur child of the LtLegRoot joint. The left patella should be child of LtLegKnee, and both the left tibia and fibula should be child of LtLegLow (see Figure 3.19). Make the many back vertebrae children of the closest backbone joint, and make the rib cage child to the Back3 joint. Avoid parenting any of the polygon bones under IK handles or control icons, except the pelvis bone, which should be made temporarily child of the Hips box.

    3.19. After you have finished drawing all your skeletons, parent the polygon bones to the appropriate Maya joints, as seen here with the leg skeleton.

Creating Control Icons

You may have noticed while you were naming your joints and IK handles that they are not that easy to select in the interface. Some joints are sitting on top of each other, and IK handles look just like locators. Traditionally, character setup artists have dealt with this problem by creating control icons. A control icon can be any easily selectable 3D shape, such as spheres, boxes, arrows, dials, and so forth, that will be parented to your skeletons and IK handles (see Figure 3.20). You create these shapes from curves so that they will not be visible when the surfaces are rendered. When the control icons are created, you place their centers directly over the pivot points of the joints they are meant to control. Once the icons are created and placed, they must then be parented over the appropriate joints and IK handles. Some control icons may control only a single skeleton or IK handle, whereas others may control many skeletons. By using control icons, you make your controls more efficient and useful.

3.20. Control icons are made from curves that can be in a variety of 3D shapes.

Exercise 3.3
Creating and Placing Control Icons

  1. Character setup artists often use a variety of shapes when creating control icons out of curves. It doesn't really matter which shapes you use, as long as the shapes are easy to select in all the views. Before you begin creating some control icons, select all your skeletons and IK handles, and place them on a layer named Skeletons. Make sure your Models, Polygon Reference Bones, and Skeletons layers are all set to Template.

    One shape that is easy to create with a curve is a box. Begin by creating a polygon cube by choosing Create, Polygon Primitives, Cube on the top menu bar. Scale the cube so that it is not too small in relation to your character. Make the perspective view full screen, and use the Alt key to orbit around so you can clearly see all the corners of the cube. Then choose Create, EP Curve tool [image] on the top menu bar. Inside the EP Curve Tool options box, set the Curve Degree to Linear, and close the options box. Hold down the V key as you click the corners of the cube (see Figure 3.21). It is important to make your control box from a single curve, so you need to make the curve overlap itself to cover all the edges of the cube. Keep clicking until you think the box is complete. When finished, select the polygon cube in the hypergraph view, and delete it. You should now have a 3D box made from a curve!

    3.21. Snap the points of a linear EP curve to the edges of a polygon cube to create a box icon.

    One thing you might want to do for creating more boxes in the future is create a shelf button for the creation of a box. Open the Script Editor, and in the gray History field, find the line of Maya Embedded Language (MEL) code that was used when you created your box icon. It will look something like this:

curve -d 1 -p -3.511352 3.511352 3.511352 -p 3.511352 3.511352 3.
  511352 –p 3.511352 -3.511352 3.511352 -p -3.511352 -3.511352 3.
  511352 -p -3.511352 3.511352 3.511352 -p -3.511352 3.511352 -3.
  511352 -p -3.511352 -3.511352 -3.511352 -p -3.511352 -3.511352 3.
  511352 -p -3.511352 3.511352 3.511352 -p 3.511352 3.511352 3.
  511352 -p 3.511352 3.511352 -3.511352 -p -3.511352 3.511352 -3.
  511352 -p -3.511352 -3.511352 -3.511352 -p 3.511352 -3.511352 -3.
  511352 -p 3.511352 3.511352 -3.511352 -p 3.511352 3.511352 3.
  511352 -p 3.511352 -3.511352 3.511352 -p 3.511352 -3.511352 -3.
  511352 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10
  -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 ;

    Highlight this line of code in the Script Editor, and using the middle mouse button drag it to your shelf (see Figure 3.22). This action produces a shelf button that creates a new curve box every time you click it. Open the Shelf Editor, and name the new button Box.

    3.22. One way to make a shelf button is to highlight MEL code in the History field of the Script Editor, and then use the middle mouse button to drag it to the shelf.

  2. Now you should create and position all the control boxes for controlling your character's limbs. Place your new control box directly on top of the LtHandRoot joint, and scale it so it is easily selectable. Then either duplicate the left-wrist box or click your Box shelf button to create more control boxes for the right wrist and both ankles. Place the leg boxes so their centers are directly on top of each foot root joint. When the boxes are placed appropriately, reset their transform channels by choosing Modify, Freeze Transformations, and name them LtArm, RtArm, LtLeg, and RtLeg.

  3. Create two new control boxes, and name them Hips and Head. If you want to change the shape of any control boxes to make them look different from the others, just go into component mode, and transform the vertices. Scale the Hips box so that it is slightly larger than, and contours, your character's hips. In insert mode, place the pivot point for the Hips box where your character's hip root joints are located. Place the Head box so it fits around your character's head, and move the pivot point so it sits on top of your head root joint.

  4. Another kind of control icon you can use is a text curve. These icons are easy to create, and are also easy for the animator to recognize. Create a text curve by choosing Create, Text [image] on the top menu bar, and make sure the type is set to Curves. Avoid using multiple letters, or letters that require multiple curves, such as e, a, p, or d. If you do use these letters, delete the inner curve that creates the hole. You can use letters that have no holes, such as u, z, v, t, y, l, and s, without modifications.

  5. Create a letter U, and move it so that it sits right on top of the Hips box. In the hypergraph view, notice that the U curve has a couple of parent group nodes. Select the curve node, disconnect it from its parent, and delete the group nodes (see Figure 3.23). Name the U curve UpperBody. Finally, in component mode, select all the vertices of the curve, and transform them to the left and in front of your character. In addition, to make the curve easier to see in the side view, rotate the vertices in Y about 35 degrees. The reason you make these adjustments by moving points in component mode, instead of adjusting the transforms of the UpperBody curve, is that you want the center of the curve to remain in the middle of your character's torso. This will ensure that your character's torso can be rotated around the correct pivot point. When the UpperBody icon is in the correct place, freeze its transforms.

    3.23. Separate and delete the two group node parents of the U text curve that will be used as the upper-body icon.

    Create an S text curve, and name it Shoulders. Move the Shoulders curve so that it sits in the middle of your character's shoulders. Then, in component mode, select all its vertices, and transform them to the right and in front of your character. Also rotate them in Y counterclockwise about 35 degrees. Freeze the Shoulders icon when you are finished.

  6. Another kind of icon frequently used by character setup artists is an arrow. You can make multidirectional arrows for your elbow and knee controls. Do this in the top view by turning on Snap to Grid, and draw an EP curve on the grid in the shape of an arrow. When drawn, name the arrow LtElbow, and transform it behind the left elbow. Make sure that the left-elbow icon is sitting several grid units away from the arm, and not right on top of the elbow. When positioned, duplicate the icon, and create three more arrows named RtElbow, LtKnee, and RtKnee. Move the icons into place, making sure the knee icons are sitting several grid units in front of each knee (see Figure 3.24). When positioned correctly, freeze all the icons.

    3.24. In front of your character's legs, place arrow icons that control where the knees point through the use of pole vector constraints.

    For the elbow and knee controls to work, you must assign them to the arm and leg skeletons with a pole vector constraint. This constraint controls the overall orientation of each skeleton by forcing the elbows and knees to point at the appropriate arrow icon. This is possible because the arm and leg IK skeletons use an RP solver, which has a twist channel that controls the rotate plane of the skeleton. This twist channel will be constrained using the pole vector constraint. Do this by selecting the left-elbow arrow, and then Shift-select the left-arm IK handle, and choose Constrain, Pole Vector on the top menu bar. A line should display connecting the IK to the left-elbow arrow in the 3D views. Move the arrow up and down to see it rotate the arm skeleton. Then create pole vector constraints on the IK for the right arm and knees.

Creating a Basic Character Rig

Up until now, you have been creating all the elements you will use to control your character while animating. They are currently not very useful, however, because they are not connected in any way to each other. To use all your controls effectively, you must make them into a character rig. A rig is created when you parent all your skeletons, IK handles, group nodes, and control icons into one big hierarchy. This hierarchy organizes all your controls into a logical setup that is easy to use, and easy to import into multiple scene files.

Keep in mind while you are going through the rigging process that if objects need to move independently of one another, they must be on separate branches in a hierarchy. They cannot be child of each other. The feet, for instance, should be able to stay on the ground when the upper body moves. The upper body should also be able to stay still when a foot is raised. To accomplish this, you must place these two parts of the body on completely separate branches in the hierarchy. Although variations in rig structures will always exist, keep in mind that most basic rigs are built under these same principles.

Exercise 3.4
Parenting Skeletons and Control Icons into a Character Rig

  1. It may be easiest to do all your parenting in the hypergraph view. If you haven't done so already, change your hypergraph to freeform layout by choosing Options, Layout, Freeform Layout on the Hypergraph window's top menu bar. Keep in mind that an easy way to parent nodes in the hypergraph is to drag the child on top of the parent with the middle mouse button. Use the middle mouse button to drag an already parented node over an empty space in the view to unparent it. Other things to be aware of when working in the hypergraph is that you want to keep everything organized neatly. If shape nodes are showing up in your window, turn them off by choosing Options, Display, Shape Nodes. You can also collapse hierarchies, expand hierarchies, and create bookmarks by right-clicking in the hypergraph.

    Begin creating the lower-body hierarchy by parenting the leg and hip root joints under the Hips box. Then make the leg IK handles, the root joints for the feet, and the knee icons child to the appropriate leg boxes. For instance, the LtLeg box should be the parent of LtLegIK, LtLegRoot, and LtKnee. Parent the right-leg controls in the same way. You should be able to translate the Hips box, and the legs will bend, while the feet remain stationary. You should also be able to translate a leg box, and the foot will move with the leg, while the hips remain stationary.

    Then, create a locator by choosing Create, Locator. Name the locator Feet, and translate it so it sits directly between the two leg boxes. When in place, freeze the locator, and make it the parent of both leg boxes (see Figure 3.25). This locator is occasionally used to move the feet together, such as to make your character jump.

    3.25. The Feet locator is the parent of both leg boxes, which have the individual foot skeletons, IK handles, and knee icons child to them.

  2. Begin creating the upper-body hierarchy by making the UpperBody icon the parent of both the Hips box and the backbone root. Moving the UpperBody icon should move the hips and backbone together. It is important to make the hips and backbone on separate branches, so they can be moved independently of each other. In this basic rig setup, the Hips box should not be translated, because it separates the hips from the backbone. Instead, you should only rotate the Hips box to move the hips, and use the UpperBody icon to move the torso.

  3. Create another locator and name it Rig. Translate this locator so that it sits directly on the pivot point of the UpperBody icon. You can either try to hold the V key to snap it into place, or you can use a point constraint to move it, and then delete the constraint. Do this by selecting the UpperBody icon, and then Shift-select the Rig locator, and choose Constraint, Point on the top menu bar. The locator should move into place. Then, in the hypergraph view, just delete the constraint node connected to the locator. When the Rig locator is in place, freeze it, and make it the parent of the Feet locator and the UpperBody icon (see Figure 3.26). The Rig locator will be the top of your character hierarchy, and can be used to move your entire character around in your scene.

    3.26. Create a locator named Rig as the top node of your hierarchy. Make the Rig locator the parent of the feet and upper body branches.

  4. All the parts of your character's upper torso should move when the backbone bends. This includes the shoulders, neck, head, and arms. For this to work correctly, all these body parts will be made the indirect children of the BackEnd joint. The only part of the body that is sometimes made to not follow the backbone is the hands. If you don't want your hands to follow the backbone's movement, make the arm boxes child to the UpperBody icon. Otherwise, they should be child to the end of the backbone, which is how you should do it for now. Later in this chapter, you learn how to switch this.

    Begin creating the upper-body hierarchy by making the NeckRoot joint child of the BackEnd joint. Before continuing, create two group nodes that will be between the backbone and all the child nodes. Do this by selecting the NeckRoot joint, and press Ctrl+G twice. Name the two group nodes from top to bottom BackPad1 and BackPad2. Because there will be several joints child to the end of the backbone, creating a couple of group nodes will keep unnecessary bones from being displayed. Then make the following nodes child to BackPad2: clavicle roots, scapula roots, neck root, Head box, Shoulders icon, arm boxes, and elbow icons (see Figure 3.27).

    3.27. Make all the nodes that should move with the backbone child to the BackPad2 group node.

  5. You need to parent several more nodes before you will be finished constructing your basic character rig. First, instead of parenting, you need to use a constraint to connect the Head box to the neck skeleton. This constraint causes the head to follow the neck movement, while keeping a vertical orientation. Select the NeckEnd joint, hold the Shift key down to also select the Head box, and constrain it by choosing Constrain, Point. Finally, make the Head box the parent of HeadRoot and JawRoot. When this is done, rotating the NeckRoot joint should move the Head box, and rotating the Head box in turn should also rotate the head and jaw skeletons.

    Make both clavicle IK handles children of the Shoulders icon. And make each scapula IK handle child of the clavicle IK that is on the same side of the body. For instance, LtClavicleIK should be the parent of LtScapulaIK. Once parented, translating the Shoulders icon up in Y should make both shoulders shrug, and make both scapula bones rotate outward slightly.

    The clavicle IK handles are the main controls for each shoulder. The two things that should follow the clavicle IKs when they move are the scapula and the arm roots. To achieve this, make each arm root child of the appropriate clavicle IK. Then continue down the arm, making each arm IK child of the appropriate arm box, and each hand root child of the appropriate arm end joint (see Figure 3.28). The reason you make the arm end joint the parent of the hand rather than the arm box is to keep the hand oriented with the arm as the wrist box moves. This is usually what a real arm does most of the time, so it makes sense to make this the default hand orientation. Otherwise, if you were to make the hand child of the arm box, you would have to be constantly rotating it into place, which is not very efficient. In the next section, you create controls for moving the hand around as needed.

    3.28. Parenting the hand root joint under the end of the arm skeleton completes the basic arm hierarchy.

  6. This completes the basic skeleton setup. Check your basic hierarchy in the hypergraph view to make sure everything is parented (see Figure 3.29). Try moving your controls around to make sure everything is parented correctly. For instance, moving the UpperBody icon up and down should make your character crouch. All your polygon reference bones should move with your skeleton joints. Be aware that there are currently no limits set on your controls, and translating a control too far may pull your rig apart. Make sure you undo after testing your controls to get your character back into its default position before going on to the next section.

    3.29. Check to make sure all the nodes in your basic rig hierarchy are parented correctly.


Increasing Rig Functionality

You can animate the basic rig you created in the preceding section as it is, but it would lack efficiency. You would have to manually animate every control, and some skeletons and IK handles would still not have easily selectable control icons associated with them. The backbone joints, for instance, must be selected and animated individually. In this section, you refine the basic rig that you created in the preceding section, and add new controls that make it easier for you to animate your character. This process primarily involves connecting channels using constraints, mathematical expressions, and setting driven keys.

Using Constraints to Create Eye Controls

One of the few body parts of your character that won't be bound to skeletons is the eye geometry. Eyeballs usually don't deform much and need to be able to move around freely in their sockets. Even on a cartoon character that squashes and stretches, the eyeballs should be deformed with a lattice rather than skeletons. This is because skeletons lock the transforms of the geometry bound to them. So if you bind your eyeballs, you won't be able to move them around to make your character look in different directions. Instead, you should parent the eyeballs into your rig hierarchy, and use constraints to make controls for moving your character's eyes around.

Exercise 3.5
Creating Eye Controls

  1. Create a new layer named UnDeformed for all models in your character that won't be deformed. Place your eyeball models on this layer, as well as any other models such as armor, jewelry, hats, and glasses. In addition, all such objects should be made parent to the joint they should follow—in the same way you parented the polygon reference bones to the appropriate joints. Make sure all the parts of each eyeball can be moved together by parenting them under the white part of the eyeball. Then, to make sure the eyeballs follow the head motion, make the white part of each eye child to the HeadRoot joint.

  2. To make a control icon for the eyeballs, choose Create, NURBS Primitives, Circle [image] on the top menu bar. In the resulting options box, make sure the circle is facing forward by setting the Normal Axis to Z. Click the Create button, and translate the circle so that it sits directly in front of the character's eyes. Then, create two locators by choosing Create, Locator, and move them so each sits close to the edge of the circle, while also being directly in front of each eyeball. Freeze the circle and locators, and name them EyesLook, LtEyeLook, and RtEyeLook. Make the EyesLook circle the parent of both locators and the child of the Head box.

    After you have made the eye controls, you need to constrain the eyeballs to them with an Aim constraint. Do this with the left eye by selecting the LtEyeLook locator, Shift-select the model for the white part of the left eye, and choose Constrain, Aim [image]. In the Constraint options box, set the Aim Vector based on the center orientation of your eye model. Unless you made your eyeball model with the X-axis pointing forward, the default setting will not work correctly. If you made the eyeball parent so that its center is oriented according to the global axis, where Z is pointing forward, it is the Z-axis that should be constrained. Change the Aim Vector fields so they read 0, 0, 1. This will constrain the Z-axis of the eye model to always point at the locator in front of it. Leave the rest of the fields in their default settings, and click the Add/Remove button. Then constrain the other eyeball to the locator in front of it.

    When both eyeballs are constrained, test your controls by translating the circle around. Your character's eyes should track the circle icon (see Figure 3.30). In addition, you can scale and rotate the circle to get more cartoonish effects, such as crossing the eyes or making the eyes wobble. You can even animate the locators themselves to create a wandering-eye effect. In addition, some character setup artists make cone icons in front of their character's eyes to more easily see where the character is looking. Do this by just creating two cones from EP curves, and make each cone child to the white of each eye.

    3.30. Create eye controls by aim-constraining each eyeball to a locator. Manipulating the parent circle icon makes the eyes move around.

Refining the Lower Arms and Hands

Although the basic controls are there, your rig still needs a little work to finish the arms and hands. In a real arm, the rotation of the radius and ulna bones makes the forearm twist. You add two IK joints in your lower arm hierarchy to get closer to how this works. In addition, you set an order to the wrist rotations by creating parented group nodes, and create some finger joints to finish your character's hand.

Exercise 3.6
Adding Forearm, Hand, and Finger Controls

  1. To create a radius and an ulna bone for your character's left arm, use your polygon reference bones as a guide, and draw two skeletons with IK turned on. The radius should go from slightly below where the inside of the arm bends and down to the thumb side of the wrist. The ulna should begin slightly below the elbow and end on the outside of the wrist. After drawing the skeleton, translate and rotate the root joints as needed to place them correctly. Make sure both skeletons are on either side of the main arm skeleton, because the LtArmTurn joint will be the axis they need to turn around (see Figure 3.31). Name the joints for the skeleton that is on the elbow side of the arm LtUlnaRoot and LtUlnaEnd. Name the joints for the skeleton on the other side of the arm LtRadiusRoot and LtRadiusEnd. Name the IK handles LtUlnaIK and LtRadiusIK.

    3.31. Create a radius and ulna skeleton on each side of the main arm skeleton.

  2. In the hypergraph view, parent the radius and ulna root joints under the LtArmLow joint. This makes the two new skeletons follow the main arm skeleton whenever the left-arm box is moved. Not only do the radius and ulna joints need to move with the arm, they also need to move with the LtArmTurn joint when it rotates in X. To make this work the way it works in your own body, the radius should turn all the way up its axis, whereas the ulna should turn only at the wrist.

    In a real body, the radius bone rotates all the way up its axis when the forearm twists. This is the reason the bicep's muscle, which is attached to the radius bone, elongates and contracts when the forearm is rotated. You can easily do this on your character by making the left radius IK handle child to the LtArmTurn joint. Make the polygon radius bone child to the radius root joint to better see the effect.

    If the ulna turned all the way up its axis, however, the joint where the ulna attaches to the elbow would break. To avoid this, you cannot just make its IK handle child to the arm turn joint. Instead, you must filter out the rotation information to use only the translation information, by using a point constraint. Create a locator to do this, and move it right on top of the ulna IK by snapping or constraining, as shown earlier. Name the new locator LtUlnaConstrain.

    To finish the forearm, constrain the ulna IK to the LtUlnaConstrain locator by selecting the locator, Shift-select the ulna IK handle, and choose Constrain, Point. Once constrained, make the LtUlnaConstrain locator child to the LtArmTurn joint, and make the LtUlnaIK child to the LtArmLow joint (see Figure 3.32). To see the effect on the ulna, parent the polygon ulna bone under the ulna root joint, and try rotating the LtArmTurn joint in X. Notice the radius turns completely, whereas the ulna only turns at the wrist.

    3.32. To keep the ulna from breaking at the elbow joint, constrain the UlnaIK to a locator that is made child of the arm turn joint.

  3. Create all the FK finger skeletons for the left hand. Draw the skeletons in the view that enables you to fit them properly into the finger geometry. All the fingers can be four-joint skeletons except the pinky. The pinky should have an extra fifth joint that starts close to the wrist, and represents the pinky metacarpal. The metacarpals for the other three fingers do not require skeletons because they don't move much, and the hand bone can represent them for animation. However, an extra bone for the pinky metacarpal enables you to create a cupping pose on the palm of the hand (see Figure 3.33). The thumb skeleton should also start close to the wrist, but only has four joints. When drawn, rotate and translate the thumb root joint into place. Name the thumb joints LtThumbRoot, LtThumb2, LtThumb3, LtThumbEnd, and then name all the other finger joints appropriately.

    3.33. Creating an extra finger joint for the pinky metacarpal enables you to cup the hand.

    All the finger roots will be child to the end of the hand joint. Begin this by parenting the thumb root under the LtHandEnd joint. Notice that a bone is drawn going from the end of the hand skeleton to the start of the thumb skeleton. To keep this from happening, with the thumb root selected, group twice. Name the parent group node LtFingerPad1, and the child group node LtFingerPad2. Again, this is just to keep a lot of unnecessary bones from being drawn. Parent all the rest of the finger roots under LtFingerPad2.

  4. After parenting all the finger skeletons, make sure that all the polygon reference bones for the left hand are made child to the appropriate joints. The small bones of the hand, as well as the metacarpals for the index, middle, and ring fingers, can all be made child to the hand root joint. When you are done, try rotating the LtArmTurn joint in X. You should see all the fingers rotating with the wrist.

    Although rotating the LtArmTurn joint in X is the main rotation for the wrist, two other rotations can still be done at the wrist. You obviously do not do these movements by rotating the LtArmTurn joint, but by rotating the hand root joint in Z and Y. Even though you can do both these rotations on the same joint, however, it is a better idea to create two group nodes between the end of the arm and the hand root to do the wrist rotations. Do this by selecting the LtHandRoot joint and group twice. Name the top group node LtWristWave and the bottom group node LtWristShake (see Figure 3.34).

    3.34. Create two group nodes between the end of the arm and the hand's root joint.

    When rotating an object in more than one axis, you must consider something called the rotation order. Create a cube, and open the Attribute Editor to see what is set under Rotate Order in the transform node. The default rotation order on an object is always XYZ, which sets the Z-axis as the most important rotation axis, followed by Y and then X. You should set the rotation order so it reflects how you will be animating a particular object and to reduce a rotation problem called Gimbal lock. Gimbal lock occurs when you rotate an object in all three axes until it stops being able to rotate in the least-important axis, as set by its rotation order. You can also get variations on this problem when your object doesn't rotate cleanly in an axis but wobbles in a weird way when you set keyframes.

    To reduce the problem of Gimbal lock, character setup artists often set the order of rotation on objects according to how that object usually moves. To see how this works, double-click the Rotation tool to set it to Gimbal mode (see Figure 3.35). This is a special rotation mode that shows you how each axis moves in relation to each other. With your cube set to an XYZ rotation order, try rotating each axis. Notice that rotating the Z-axis rotates all the other axes. Then notice that rotating the Y-axis only rotates Y and X, while the Z stays still. Rotating the X-axis doesn't rotate the X or Z. If you rotate the Y-axis 90 degrees, notice that the local X-axis of the cube is no longer available. This problem is commonly referred to as Gimbal lock. To get a better idea of how rotation order works, try switching the Rotate Order setting, and rotate the cube in Gimbal mode some more. Be aware of the rotation order on your controls when setting up your rig so that you can reduce Gimbal lock occurrences on your controls.

    3.35. Set the rotation tool to Gimbal mode to see how rotation order affects an object.

    Another way of setting an order of rotation is through parenting. Separating all the rotations of a control onto different nodes sets the rotation order by making the parent nodes more important than the child nodes. This keeps the rotations from conflicting with each other. For instance, use the two group nodes you created between the end of the arm and the hand joint to separate the wrist rotations. Rotating the LtArmTurn joint already does the most important rotation on the wrist, which twists the hand and forearm. Rotating the LtWristWave node in Z does the next important rotation, making the hand flap up and down. Whereas rotating the LtWristShake node in Y does the least important rotation, which is a small side-to-side rotation (see Figure 3.36). Make sure that the pivot points are correctly placed in the wrist for each rotation. Use insert mode if they need to be adjusted.

    3.36. By doing the hand rotations on separate group nodes, you can reduce the problem of Gimbal lock.

    When finished with the left arm, do the same for the right-forearm and right-hand setup. If you try to mirror the entire arm hierarchy to the other side, make sure you first disconnect all polygon reference bones. Using the Joint Mirror command on geometry does not work well. In addition, mirroring a hierarchy often causes the IK to get disconnected on the new hierarchy, so you may have to reset all the IK. Sometimes it is better just to mirror individual skeletons and IK handles as you create them, and then parent them all again on the other side.

Connecting Channels

Throughout this chapter, you learn several ways to control the channels of objects with the channels of other objects. You have already done this through the use of constraints, such as point and aim constraints. However, these kinds of constraints do not enable you to constrain individual channels of different types, such as constraining a single translation channel to a single rotation channel. To do this, you must use either the Connection Editor, the Expression Editor, or set driven keys.

The most basic way to connect channels is to use the Connection Editor. Open the Connection Editor by choosing Window, General Editors, Connection Editor. You use the Connection Editor by loading the constraining object in the left Outputs side, and loading the object to be constrained in the right Inputs side (see Figure 3.37). The two objects have all their channels listed, and to connect two channels, all you have to do is click them in each window. Keep in mind that the constraint does not go both ways. Only the channel on the object loaded into the right side of the Connection Editor is constrained. Once constrained, the channels have a one-to-one connection based on their values displayed in the channel bar. This kind of connection is pretty simple. To make a more complex connection, where you can vary how the objects are connected, you have to insert utility nodes into the connection.

3.37. Load two objects in the Connection Editor to connect their channels.

Another way to create connections between channels is by writing mathematical expressions in the Expression Editor, located under Window, Animation Editors. You type your math expressions in the white text field in the lower half of the Expression Editor (see Figure 3.38). Expressions can constrain channels in the exact same way as the Connection Editor, but are written using math signs. Some of the basic signs used are: + (plus), – (minus), * (multiply), and / (divide).

3.38. To connect channels in the Expression Editor, write math expressions in the white text field that specify how to connect the objects.

Object names must be correctly written in each expression, and their channels must be specified. It is a good idea, therefore, to name your objects with short, logical, descriptive, names. Everything in an expression is case sensitive; so make sure you are consistent in how you use capitalization in the names of your objects. All channel names are also case sensitive. In fact, you should be aware that the default names in the channel bar are not how the actual channel names should be written. If you choose Channels, Channel Names on the channel bar, three choices display. The default setting of Nice is not accurate. It capitalizes the first letter in the name, and puts a space between parts of the channel name. Using this syntax in your expressions will give you an error message. Instead, switch the Channel Names setting to either Long or Short (see Figure 3.39). The syntax for both of these settings is accurate, and will work in your expressions. If you want to speed up your workflow by typing less, use the short versions of the channel names. After you create the expression, however, Maya converts the names to the long versions.

3.39. In the Channel box, change the channel names to either the long or short versions when writing expressions.

The syntax for writing a basic expression that creates a one-to-one constraint between channels is written like this:

ConstrainedObject.channel = ConstrainingObject.channel

Keep in mind that only the object on the left side of the equals sign is constrained. The other object's channels are not affected at all. This kind of expression is extremely simple, but adding some simple math symbols can refine it.

Exercise 3.7
Creating Basic Channel Connections

  1. To get some experience connecting channels, in this exercise you constrain channels using both the Connection Editor and Expression Editor. First, in a new empty scene, create a polygon cube and NURBS sphere under the Create menu. Name the objects Cube and Sphere, and translate the cube in X so that it is not sitting on top of the sphere. Then open the Connection Editor by choosing Window, General Editors, Connection Editor. Select the cube and load it into the left Outputs side of the Connection Editor by clicking the Reload Left button. When loaded, find the channel named Rotate and click the arrow beside it to show the individual rotation channels. Click the Rotate Z channel.

    Next, select the sphere and load it into the right Inputs side of the Connection Editor by clicking the Reload Right button. To connect the channels between the two objects, click the arrow beside the channel named Translate, and then click Translate Y. Notice in the Channel box that the Y channel for the sphere becomes colored. This means the channel is being constrained (see Figure 3.40). If you select the cube, however, notice that none of the channels are constrained. Rotate the cube in Z to see the sphere move up and down in Y. Also notice that when you rotate the cube in a negative direction, the sphere moves negative in Y. It also moves the exact same amount of grid units that the cube rotates in degrees. This is a one-to-one connection between channels.

    3.40. Connecting two channels in the Connection Editor creates a constraint on the channel of the object in the Inputs field.

    The kind of connection you just made between the cube and the sphere has limited uses as it is. In most cases, you would have to adjust this connection either in amount or direction. Notice, for instance, how far the sphere goes when the cube rotates. This is because you are controlling translation, which is based on grid units, with rotation, which is based on degrees. A quarter turn of the cube, which is 45 degrees, makes the sphere translate 45 grid units. Such a distance is going to be way too much for most character controls. Even on a large character, most controls do not move more than a few grid units.

  2. To change the amount that a channel constrains another channel in the Connection Editor, you must use a utility node. Open a hypergraph view, and with both the cube and sphere selected, click the window icon for Input and Output Connections. Then choose Rendering, Create Render Node in the Hypergraph window menu bar. In the Render Node options box, click the Utility tab, and choose the Multiply Divide node under General Utilities (see Figure 3.41). Load the cube into the left Inputs side of the Connection Editor, and select the Multiply Divide node in the hypergraph to load it into the right Outputs side of the Connection Editor. Connect the Rotate Z channel of the cube to the Input1 X channel on the Multiply Divide node. Then load the Multiply Divide node into the left side of the Connection Editor, and load the sphere into the right side. Connect the output of the Multiply Divide node's Output X channel to the inputs of the sphere's Translate Y channel.

    3.41. In the hypergraph view, create a utility node to adjust a constraint created in the Connection Editor.

If you refresh the hypergraph view, you will see connection arrows going from the cube node to the utility node to the sphere node. Right-click the Multiply Divide node, and choose Attribute Editor. The way the Multiply Divide node works is that the value in Input2 is performed on Input1. So if you set the operation to Divide, for instance, and you set the value of Input2 to 10, the rotation of the cube is divided by 10 (see Figure 3.42). If you then rotate the cube 45 degrees, the sphere translates in the Y-axis only 4.5 grid units, rather than 45 grid units. Try experimenting with other utility nodes, such as the Reverse node, which enables you to reverse the direction of the control.

3.42. Use the Multiply Divide node to increase or decrease the result of the connected channels.

You can create the same kind of connection between the cube and sphere using a mathematical expression. First, delete the Multiply Divide node in the hypergraph view, which deletes the constraint on the sphere's Translate Y channel. Then open the Expression Editor and type the following in the Expression field:

Sphere.translateY = Cube.rotateZ

After you have written this, click the Create button in the lower-left of the Expression Editor. Select the cube and rotate it in Z to see the sphere move. Notice that the connection is exactly the same as the basic connection that you previously did in the Connection Editor. If the expression disappears from the Expression field, you can locate it again by switching the Select Filter setting from By Object/Attribute Name to By Expression Name, and choose it in the List field (see Figure 3.43). In general, it is better to work in the By Expression Name filter because changing selections on objects will not affect the current expression you are writing. Your new expression should have the default name Expression1. You can then edit the expression to change the name, and adjust how the cube affects the sphere.

3.43. In the Expression Editor, change the selection filters to edit an expression.

You can do several simple things to fine-tune your expression. For instance, the preceding expression implies the following:

Sphere.translateY = 0 + Cube.rotateZ

This expression reads "the sphere's translation in Y is equal to zero plus the cube's rotation in Z." The zero in the expression represents the start number or the current value in the sphere's Y channel. Change this number so that the expression looks like this:

Sphere.translateY = 5 + Cube.rotateZ

When you click the Edit button in the Expression Editor, notice that the sphere moves 5 units up in Y. Nothing else is changed about the expression except the start position of the sphere. If you change the number to –5, the sphere will be set to –5 in Y as its start position. The other thing you could change is the direction of the constraint. Change the expression to read as follows, and then click the Edit button:

Sphere.translateY = 0 - Cube.rotateZ

When you rotate the cube, notice that the sphere goes in the opposite direction than it did before. Changing the plus to a minus makes the sphere move in a negative direction when the cube rotates in a positive direction, and vice versa. If you want to reduce the amount of the constraint effect, as done previously with the Multiply Divide utility node, use a division symbol like this:

Sphere.translateY = 0 - Cube.rotateZ / 10

Or you could multiply the amount like this:

Sphere.translateY = 0 - Cube.rotateZ * 10

The expression syntax for a basic channel constraint can be summarized as follows:

ConstrainedObject.channel = Default#(Start) +-(Direction) ConstrainingObject.channel */#(
  Amount)

As you can see, it is relatively easy to create a very specific constraint using mathematical expressions. I personally prefer using expressions to using the Connection Editor with utility nodes to constrain channels. Utility nodes do evaluate a little faster than expressions, however, and some professionals prefer using them for their controls. For the rest of this chapter, you use expressions for doing all constraints that involve math operations. Keep in mind, however, that in most cases you could also use utility nodes and the Connection Editor to do the same kind of constraints. It would just take you a little longer to set up.

Controlling the Backbone with Math Expressions

You may have noticed that the basic FK backbone on your character cannot be selected very easily. To animate it bending, you have to manually select and rotate each one of its three main joints. Because this is not very efficient, you create some controls to make animating the backbone easier. Instead of rotating each joint individually, you use math expressions to constrain the rotation of all the joints to a single control icon. This is much easier for you to select and animate.

Exercise 3.8
Making Basic Backbone Controls

  1. Open the scene that contains the basic character rig you have been building. To create some control icons for rotating the backbone joints, choose Create, NURBS Primitives, Circle [image]. In the Circle options box, set the Object Normal to Z, and click Create. Scale the circle so that it is slightly larger than the width of your character's torso, and then freeze its transforms. Name this circle BackBend. Then duplicate the BackBend circle, and name it BackBow. Rotate the BackBow circle 90 degrees in Y, and also freeze it. Finally, duplicate the BackBow circle, and name it BackTwist. Rotate the BackTwist circle 90 degrees in Z, and freeze it.

    At this point, you should have three circles sitting at the global origin. Select all three circles and group them, naming the parent group node BackControls. In the hypergraph view, parent the BackControls node under the UpperBody icon. You may also want to translate the BackControls to better position them in relation to your character (see Figure 3.44).

    3.44. Place three circle icons around the middle of your character's torso to control the backbone skeletons.

  2. When you have some control icons for the backbone, you can begin connecting channels in the Expression Editor. Keep in mind that your expressions must be based on how the centers of your backbone joints are oriented. If you created your backbone in the front view, Z should be pointed forward, Y to the side, and X oriented toward the next joint in the skeleton. With this orientation, BackBend controls the Z-axis, BackBow controls the Y-axis, and BackTwist controls the X-axis on the joints.

    To check how the centers on your backbone joints are oriented, select them and choose Display, Component Display, Local Rotation Axes. Specifically, look to see whether all the centers have the same orientation. If you didn't draw the backbone perfectly straight, some of the centers on the joints may be flipped 180 degrees in X. This occurs whenever you change directions when drawing a skeleton. Because this changes how your expressions affect the joints, it is a good idea to set all the centers so that they have the same orientation. Do this by switching to component mode, and after turning on the question mark (?) symbol, select a center axis that needs to be fixed. Do not type any values in the transform channels to rotate the center. Instead, activate the Rotation tool, and manually rotate the center a little in X. You won't be able to tell how far the center was rotated, but that doesn't matter. Open the Script Editor and find the last line in the gray History field. It should look like this:

    rotate –r –os 23 0 0;

    Highlight this line in the Script Editor, and use the middle mouse button to drag it down into the white scripting field. Then change the first number in the code to 180. It should look like this:

    rotate –r –os 180 0 0;

    After you have done this, highlight the code again, and use the middle mouse button to drag it to your shelf. This action creates a shelf button to flip your centers around 180 degrees in X. You can open the Shelf Editor to give the button a short name such as RotX. Close the Script Editor, and press Z to undo the preceding rotation. Then, with the center still selected, click your new shelf button to rotate the center exactly 180 degrees in X. You can use the button to rotate any other centers. Then turn off the question mark symbol, and switch back to object mode. When all the centers are oriented correctly, begin connecting your backbone controls by typing the following expression into the Expression Editor:

    BackRoot.rz = 0 + BackBend.rz;

    Name the expression BackRotate and click the Create button. Notice that this expression uses the short versions of the channel names, and ends with a semicolon. The semicolon terminates a line in an expression, and is necessary if you are going to write more than one line. After you create the expression, try rotating the BackBend circle in Z. You should see the first joint of the backbone rotating side to side in Z.

    Switch to the Expression Name selection filter if you have not already done so, and click the BackRotate expression to edit it. Highlight the line you just wrote, and copy it by pressing Ctrl+C. Then click the Enter key to go to the next line. Paste the line down by pressing Ctrl+V. Copying and pasting makes it easier for you to create new lines when you need to make similar expressions. Do this twice, and then change the backbone names so that you have the following three lines in your expression:

    BackRoot.rz = 0 + BackBend.rz;
Back2.rz = 0 + BackBend.rz;
Back3.rz = 0 + BackBend.rz;

  3. After you click the Edit button, try rotating the BackBend circle again. You should see all the backbone joints rotating in the same direction as the circle. This should make the backbone bend in a smooth manner from side to side. To fine-tune this motion, you can divide the effect on some of the joints. The lower part of a real backbone doesn't bend as much as the upper part, so you may want to adjust your expressions in a similar way to the following:

    BackRoot.rz = 0 + BackBend.rz / 4;
Back2.rz = 0 + BackBend.rz / 3;
Back3.rz = 0 + BackBend.rz;

    You can divide or multiply your expressions as needed for your character. Keep in mind that you do not have to get the rotations perfect at this stage. Try to get them close to how they should rotate, and then you can fine-tune them after you bind the models to your character, when you can better see the effect of the rotations on the skin. To finish your backbone connections, type expression lines for the rest of your backbone channels, and click the Edit button. Your final expressions will look similar to the following:

    BackRoot.rz = 0 + BackBend.rz / 4;
Back2.rz = 0 + BackBend.rz / 3;
Back3.rz = 0 + BackBend.rz;
BackRoot.ry = 0 – BackBow.rx / 4;
Back2.ry = 0 - BackBow.rx / 3;
Back3.ry = 0 - BackBow.rx;
BackRoot.rx = 0 + BackTwist.ry / 4;
Back2.rx = 0 + BackTwist.ry / 3;
Back3.rx = 0 + BackTwist.ry;

    Notice that the second set of expressions for the backbone's rotation in Y uses a minus sign rather than a plus sign. If your backbone centers are facing negative rather than positive in Y, you must adjust your expression accordingly. You can start by just using a plus sign, and if your joints are rotating in the opposite direction from your circles, just change the plus sign to a minus sign. Use this trial-and-error method when writing all your expressions.

  4. One last thing you should do is set some rotation limits on your circle icons. A general rule to keep in mind when setting up your rig is to put limits only on the objects you are going to animate directly. So in this case, you should place limits on the circle icons, and not on the joints they control. Right-click the BackBend circle, and choose the Attribute Editor. In the Transform tab named BackBend, click the Limit Information drop-down arrow to see the rotation limit channels. The BackBend circle should rotate only in Z, so click the arrows beside the Min and Max for X and Y, which should set their values to 0. Click the empty boxes to set the limits. Then rotate your BackBend circle positive in X until it is as far as you want your character's backbone to bend to the side, and click the arrow next to Max in the X limits. Copy the Max value, turn on the Min limit, and paste the same value with a negative sign added (see Figure 3.45). In addition, make sure you click all the empty boxes to turn on the limits for each axis. Test your BackBend circle to make sure it rotates only in Z the amount you set.

    3.45. Set the BackBend circle's rotation limits in the Attribute Editor under the Transform tab.

    Follow this same process to set limits on the other two circles. The BackBow circle should rotate only in X, and should rotate more to the front than to the back (see Figure 3.46). The BackTwist circle should rotate only in Y. When you have finished setting the limits, you may do one more thing to the circles. You may want to color the icons to cue the animator how they should be animated. For instance, you could make each circle the color of the channel it should be rotated in. Do this in the Shape tab of the Attribute Editor for each circle, by turning on Enable Overrides in the Object Display, Drawing Overrides section. Adjust the Color slider to set the color. Make BackBend blue, BackBow red, and BackTwist green.

    3.46. Set the limits so that rotating the BackBow circle makes the backbone bend more forward than backward.

Setting Driven Keys for Shoulder Motion

The third main way of connecting channels in Maya is to set driven keys. These are special keys that are not based on the timeline, but instead are based on the connected channels' relationship to each other. The object with the constraining channel is the driver, and the object with the channel constrained is the driven. Setting driven keys has some distinct advantages over other methods for creating basic constraints between channels. Driven keys are easy to set, and are extremely flexible. If you need to do math operations in your controls, however, you will still have to use expressions or the Connection Editor.

To set driven keys, choose Animate, Set Driven Key, Set [image]. In the Set Driven Key options box, you load the driver and driven, and click the channels you want to connect (see Figure 3.47). Press the Shift key to select multiple driven channels. Once loaded, you manipulate the channels in relation to each other, and click the Key button for each new position. After the keys are set, whenever the driver's channel changes, the driven channel responds.

3.47. Set driven keys to connect channels by loading objects into the Driver and Driven sections of the Set Driven Key options box.

One main difference between setting driven keys and other connection methods is that driven keys create animation curves that can be edited in the Graph Editor. This enables you to adjust the timing of a constraint in ways that would be difficult using other methods. An expression constraint occurs in a constant manner, for instance, which would be equivalent to a linear animation curve in the Graph Editor. A driven object, however, can respond at a variety of rates to a driver's motion. A driven object can speed up or slow down over the course of a move, which is equivalent to a spline-based animation curve in the Graph Editor (see Figure 3.48).

3.48. A driven key connection creates spline-based animation curves that you can edit in the Graph Editor.

An additional difference from other constraint methods is that driven objects can have multiple drivers. The driven key's channel is constrained, so you can't set regular animation keys on it manually, or attach another kind of constraint to it. But you can connect additional drivers to it. Being able to connect multiple drivers to a single driven allows you a great amount of flexibility when setting up your character controls. For instance, in the next exercise, you control the raising of your character's individual shoulders with three drivers. This creates automatic shoulder movement based on the position of the arm box and elbow icon, and allows you to use a custom channel for manually controlling the raising of each shoulder.

Exercise 3.9
Setting Driven Keys On the Shoulder

The first driven keys you are going to set make the left shoulder rise automatically when the left-arm box translates in Y. The shoulder in a real body is where the clavicle, scapula, and humerus bones come together. This area rises automatically when the elbow moves above shoulder level. This occurs because there is a notch on the ball joint of the humerus that clicks into place on the clavicle when the arm rises, which then pushes the clavicle up. You set driven keys to make this happen on your character whenever the arm box is raised past the level of the shoulders.

  1. Begin by opening the Set Driven Key options box, and with the left-arm box selected, click the Load Driver button. Choose the Translate Y channel of the arm box in the Driver Channels list. Then load the LtClavicleIK as the driven object, and also choose its Translate Y channel. Before continuing, select the arm box and press the S key to set keys for its default position at frame 1 on the timeline. Keep in mind that this key on the arm box has nothing to do with the driven key connection. You move the arm box around a lot while setting driven keys, and this enables you to easily get the arm back to its default pose when you have finished.

    The first driven key to set is the default position of the clavicle. Place the arm box on the same level in Y as the clavicle, and click the Key button in the Set Driven Key options box. Then translate the arm box above your character's head until the elbow locks out. Select the clavicle IK and translate it up in Y slightly. The arm should bend a little as the clavicle is raised. Set another driven key. To check the control, translate the arm box up and down to see whether the clavicle moves smoothly in Y (see Figure 3.49). Afterward, click the timeline to force your arm box back into its default position.

    3.49. Set driven keys on the clavicle IK to make the shoulder move up and down when an arm is raised.

  2. Select the elbow arrow icon, and load it as a second driver for the clavicle IK. Choose its translation in Y as the driving channel. To see how this control should affect your character, rotate your own elbow forward and upward, so your palm faces behind you. Notice your clavicle goes up.

    Before setting driven keys, as with the arm box, press the S key to set a key for the elbow icon's default position. Make sure the elbow icon is directly behind the lower arm joint, and set a driven key. Then raise the elbow icon in Y so the arm rotates about 80 degrees forward. Also raise the clavicle IK a little bit, and set another driven key. When your keys are set, test the control, and then click the timeline to reset your arm controls into their default position. After testing the automatic shoulder controls, remove the keys you set on the arm and elbow controls by selecting their channels in the channel bar, and right-click to break the connections.

  3. You may have noticed a problem after setting your automatic controls for the left shoulder. After you set driven keys, you cannot manually set translation keys on the clavicle IK. This can still be done, however, by creating a channel that manually drives your left shoulder. The best place to create such a channel is on the Shoulders icon. Select the Shoulders icon and choose Modify, Add Attribute on the top menu bar. In the Add Attribute options box, name the new channel ltShoulder (see Figure 3.50). Make sure that you are using a Float data type, which gives you smooth transitions in your new channel. Then set the Minimum field to –3, the Maximum field to 10, and the Default field to 0. Setting the Numeric Attribute Properties creates the limits on the channel. The reason you set the minimum to a smaller amount than the maximum limit is because a shoulder mostly moves up, rather than down.

    3.50. Create a custom channel on the Shoulders icon to manually drive the clavicle IK up and down.

    After you have a left-shoulder channel on your Shoulders icon, you can make it drive the manual translation in Y of your character's clavicle IK. Load the Shoulders icon into the Driver section of the Set Driven Key options box, and choose the new ltShoulder channel. Make sure the driven channel is set to the translation in Y of the left-clavicle IK. Make sure the driver channel is at 0, and the clavicle IK is in its default position, and click Key. Then change the driver channel to 10, raise the clavicle IK in Y, and click Key again. Finally, change the driver channel to –3, and lower the clavicle IK to slightly below its default position, and key it.

    When all the driven keys are set, select the ltShoulder channel in the channel bar, use the middle mouse button as a virtual slider, and scrub through the driven keys. As the channel changes, you should see your character's left shoulder moving up and down accordingly. Try out all three of the shoulder controls to see how they work together. Keep in mind that you can set more driven keys to refine this motion. You may want to drive some X translation channels in addition to the Y translation. You may also want to drive the arm root joint's translation to make it rise with the clavicle IK. When the left shoulder is working well, set similar driven keys on the right shoulder.

Creating Additional SDK Controls

In the preceding exercise, you made a custom channel to control the translation in Y of the clavicle IK. Doing this enabled you to set manual translation keys on a channel that was already being controlled by driven keys. Even if there were no other driven keys on the clavicle IK, however, creating a custom channel on the Shoulders node would still be desirable.

You may have noticed that some objects in your rig do not have easily selectable controls. If you made icons for every control in your character, your interface would soon get cluttered. Some objects in your rig that are difficult to select are the individual shoulder IK handles, the arm turn joints, wrist pivots, finger joints, and the jaw joint. The best place to put control channels for these objects is on the closest main control icon. For instance, arm, finger, and hand channels can be placed on the appropriate arm box, and jaw controls can be placed on the Head box. You can then connect all these channels to the objects they should control by setting driven keys.

Exercise 3.10
Setting Driven Keys On Other Parts of the Body

  1. Another automatic motion you can add to your shoulder is movement in Z when the arm moves forward and backward. This involves the Z translation of the clavicle IK, and some X and Z translation of the scapula root joint. Load the translation in Z of the arm box as driver, and load the Z translation of the clavicle IK as driven. Set driven keys with the arm box out in front of your character, and back behind your character about 30 degrees.

    Driving the clavicle IK in Z rotates the scapula a little because the scapula IK is child to the clavicle IK. When a real arm moves forward and backward, however, the scapula actually floats around the rib cage to some degree. You can best experience this motion by stretching both your arms backward, and then notice how your scapulas press together. To make the scapula translate around the rib cage, load the scapula root joint as driven, with the translation in Z of the arm box still as the driver. Hold down the Ctrl key to select the translation in X and Z of the scapula root joint. Then key the translations of the scapula to make it move in a small arc around the rib cage as the arm box moves forward and backward (see Figure 3.51).

    3.51. Also use driven keys to make the scapula translate around the rib cage in an arc when the arm is moved forward and backward.

  2. You can add several channels to each arm box to control your character's forearms, hands, and fingers. Begin by making three custom channels on the left-arm box named wristTurn, handWave, and handShake. Set the minimum for these channels to –10, and the maximum to 10. Open the Set Driven Key option box and load the wristTurn channel of the arm box as the driver. Load the LtArmTurn joint's X rotation channel as driven. Then set a driven key with the arm turn joint in its default position, and the wristTurn channel at 0. Then change the channel to 10, rotate the arm turn joint forward in X about 45 degrees, and set a driven key. Keep in mind that the degree to which a real forearm turns is very little. Most of the turning on the arm occurs from the shoulder, and should be done by translating the elbow icons. Change the wristTurn channel to –10, rotate the arm turn joint backward in X about 100 degrees, and set a key. Scrub the wristTurn channel to see the forearm turning.

    Next, use the same method to make the other two custom channels on the arm box drive the two group nodes that are parent to the hand joint. Make the handWave channel drive the up-and-down rotation of the LtWristWave node, and the handShake channel drive the side-to-side rotation of the LtWristShake node. Depending on which way the hands of your character are facing, the two driven channels will probably be Z and Y. Keep in mind when setting driven keys that the wave rotation is larger than the shake rotation. After you have all the driven keys set, you should be able to use the three custom channels to place your character's hand into any pose.

    To set driven keys for the fingers, create five channels on the arm box named indexFinger, midFinger, ringFinger, pinkyFinger, and thumb (see Figure 3.52). Because fingers only go in one direction, you may not need much of a minimum value on the channels. This depends on whether your character's fingers are straight or relaxed in its default pose. If they are relaxed, you will have to put a minimum value that is large enough to straighten them out. Set the maximum value for each finger channel to 10.

    3.52. Create several custom channels on each arm box to control the forearm, hand, and finger motions.

    Then load the indexFinger channel of the arm box as the driver. Hold down the Shift key in the hypergraph view to select LtIndexRoot, LtIndex2, and LtIndex3, and then load all three index finger joints in as the driven. Select with the Shift key all the finger joints in the Set Driven Key options box, and choose their rotation in Z as the driven channel. Set a key in their default position, with the driving channel at 0. Then change the driving channel to 10, rotate all the index finger joints into a closed position using the Up and Down Arrow keys to move through the finger hierarchy, and set another key. Set the driving channel to the minimum value, rotate all the index finger joints until they are straight, and set a final key. Repeat this process with all the finger joints. In addition, you can create fingerClosed and fingerSpread channels on the arm box that drives all the fingers at once. The fingerClosed channel should drive the Z rotations of all the finger joints, and the fingerSpread should drive the Y rotations of the finger root joints to spread the fingers away from each other.

  3. Create a few custom channels on the Head box to move the jaw and neck. Name the channels jawOpen, jawGrind, jawJut, neckBend, and neckTilt. The jawOpen channel should rotate the jaw joint in Z so the mouth opens and closes. The jawGrind and jawJut channels should translate the jaw from side to side, and translate the jaw forward and backward. Set the minimum and maximum values to the appropriate values to achieve these movements. Then load the jaw joint in as driven, and key the appropriate channels. The neckBend and neckTilt channels should make the NeckRoot joint rotate side to side and forward and backward.

Making a Hands-Follow Switch

Currently your hands should be following your backbone when it moves. The reason this occurs is because the arm boxes are child to BackPad2. If your hands were parented under the UpperBody icon, however, they would move with the torso, and not move with the backbone. At times while animating, both of these parenting solutions will prove useful. If your character was pushing a heavy object, for instance, it would be easier to animate if the hands did not move with the backbone (see Figure 3.53). On the other hand, if the character was walking, it would be easier to animate if the hands follow the backbone. Actually, both these solutions are possible if you use constraints.

3.53. It is easier to make your character push a heavy object if the hands do not follow the backbone.

Exercise 3.11
Using Constraints to Create a Hands-Follow Switch

  1. Create a locator named Hands, and make the Hands locator the parent of both arm boxes. Create two other locators named BackFollow and TorsoFollow. Make sure all three locators are sitting directly on top of each other. The BackFollow locator should be the child of BackPad2, and the TorsoFollow locator should be the child of the UpperBody icon. The trick to creating a switch for how the arms follow the backbone is to create two constraints that make the Hands locator switch between following BackFollow and TorsoFollow.

    Select the BackFollow locator, Shift-select the Hands locator, and choose Constraint, Point on the top menu bar. With both still selected, go to the Constraint menu again and choose Orient. This places both a point and orient constraint on the Hands locator. Select the TorsoFollow locator, Shift-select the Hands locator again, and create both point and orient constraints. If you select the Hands locator, you should see two point constraints and two orient constraints in the Inputs section of the Channel box (see Figure 3.54). Having these two constraints is the key to creating a switch. Notice that each constraint has a weighting that goes from 0 to 1. When the channel is at 0, the constraint is turned off, and when it is at 1, the constraint is fully turned on.

    3.54. Use a custom channel to control the weight channels of two point constraints to make the arms appear to switch parents.

  2. To create a way of switching the constraints, you must create a custom channel that will be connected to the weight channels of each constraint. Do this by selecting the UpperBody icon, and choose Modify, Add Attribute. Create a custom channel called armsSwitch, with limits from 0 to 1, and a default value of 0. You can use the Connection Editor, expressions, or set driven keys to create a connection between the armsSwitch channel and the constraint channels.

    The armsSwitch channel should make one of the constraint channels follow it exactly, and make the other constraint channel follow it in the opposite direction. This has the effect of turning one constraint on, while the other constraint turns off. For example, you can do this with an expression like this:

    Hands_pointConstraint1.BackFollowW0 = 1 - UpperBody.armsSwitch;
Hands _pointConstraint1.TorsoFollowW1= 0 + UpperBody.armsSwitch;
Hands _orientConstraint1.BackFollowW0= 1 - UpperBody.armsSwitch;
Hands _orientConstraint1.TorsoFollowW1= 0 + UpperBody.armsSwitch;

  3. When the channels are constrained, try rotating the BackBend circle, and then scrub the armsSwitch channel on the UpperBody icon. You should see your hands smoothly switching between staying still and following the backbone. The hands should still follow the upper body, even when they don't follow the backbone. If you didn't want the hands to follow anything, you would do the same process, only using a locator that is child to the Rig node, rather than the UpperBody node.


Advanced Animation Controls

In this section, you add some more complicated controls to your character rig. This process involves using math functions to create automatic torso motions, setting driven keys to create a rolling foot control, creating an advanced backbone with spline IK and clusters, and creating color indicators that warn when a control has been moved too far. Although these controls require more time to set up, they make it easier and faster for you to animate your character.

Some of the expressions used in this section use expression functions. An expression function is a predefined command that can be used in an expression instead of explicitly writing the complicated math associated with the command. Some common expression functions used in Maya are abs, trunc, cos, rand, and time. You can view a list of functions in the Expression Editor under the Insert Functions menu (see Figure 3.55). To view a complete list with detailed explanations of each function, look in the Expressions section in the online documentation of the Help menu.

3.55. You can find a list of the advanced expression functions on the menu bar in the Expression Editor.

Constraining the Torso to the Feet

One thing that can be useful for easily moving your character around in a scene is to connect the torso to the feet with an average expression. This always keeps the UpperBody icon between the two leg boxes whenever they move in X and Z. In addition, you create an expression to make the torso automatically dip in Y each time a foot takes a step. The amount of the dip is based on the size of the step (see Figure 3.56).

3.56. Add expressions to make your character's torso automatically move when each foot takes a step.

Keep in mind that although these expressions make certain actions easier to animate, they may not be appropriate for all scenes. Sometimes you will want to disable these expressions and animate these motions manually. This is especially true if your character is going to rotate extensively from the Rig node, such as to perform a 360-degree flip. This is because the Rig and Feet nodes, which are parents of the nodes involved in the expressions, cannot be affected by the upper body and leg boxes. The reason for this is that having a child node affect a parent node causes a cycle, which generates an error message from Maya. Because this is undesirable, using the expressions causes the Rig and Feet nodes to get left behind as soon as you begin moving your character around using the average expressions. In turn, this causes the pivot points to be off for any kind of body rotation using these nodes.

Exercise 3.12
Creating Torso Averages and Dip

  1. The first step in constraining the torso to automatically move when the legs move is to create a couple of group nodes that are sitting directly on top of, and are the parents of, the UpperBody icon. If you constrain the channels of the UpperBody icon directly with these expressions, you will no longer be able to manually animate the upper body of your character. Instead, you constrain the channels on some parent group nodes that propagate the movement to the upper body through the parent child relationship. You can then manually add keyframes to the UpperBody icon in addition to the automatic movements. The term often used for keeping the channels of a child node open for setting manual keyframes is a freedom node.

    In the hypergraph view, select the UpperBody icon, and press Ctrl+G twice. Name the top group node UpBodAuto1, and the lower group node UpBodAuto2 (see Figure 3.57). If your UpperBody icon was originally placed right on top of the Rig node, your two group nodes should be sitting right on top of the UpperBody icon. If not, go into insert mode and move accordingly. Because you are going to write expressions, you want the channels of your group nodes to have 0 values in translation and rotation, and 1 in scaling. If they are sitting right on top of the Rig and UpperBody nodes, this should be the case. Keep in mind that in versions of Maya before 4.5, you should not freeze the transforms of nodes that are parented in your skeleton hierarchy. Doing so changes the orientations of your skeleton centers and dislocates any IK handles that are child to these nodes. This problem seems to be fixed in the latest version of Maya, however.

    3.57. Making two group nodes as parents of the UpperBody icon creates extra channels that can be constrained in your expressions.

  2. After you have some channels to constrain on the UpBodAuto nodes, you can begin writing the expressions for averaging the torso between the leg box positions. One important thing to check before writing the expressions is that the Feet node is directly between the leg boxes. Keep in mind that the information in the channels of the leg boxes is based on the parent node's position. You want, therefore, to make sure that the Feet node is directly between the leg boxes in X, and lined up with the center of the boxes in Z. In addition, before writing the expressions, check the channels of the objects involved for any irregularities in the rotation or scaling channels. They should not, for instance, have Scaling values other than 1, or Rotation values other than 0. The first expression you write should constrain the X translation of the UpBodAuto1 node with an average. Adding a number of values, and dividing the result by the same number of values, creates an average. Use the following syntax:

    (A + B) / 2

    Replace the letters A and B in the preceding expression with each leg box's X translation to average the X translation of the UpBodAuto1 node. Do this on your rig by opening the Expression Editor, and type the following expression:

    UpBodAuto1.tx = (LtLeg.tx + RtLeg.tx) / 2;

    Name the expression Averages, and click Create. Test the control by translating one of the leg boxes in X. Your character's torso should remain directly in between both leg boxes. To constrain the Z translation in the same way, edit the expression by copying the first expression, and paste it on the next line, changing each X-axis to Z. The second line in your expression should look like this:

    UpBodAuto1.tz = (LtLeg.tz + RtLeg.tz) / 2;

    One other average constraint that you may want to use on your character is placed on the Y rotation channel. It is written like this:

    UpBodAuto1.ry = (LtLeg.ry + RtLeg.ry) / 2;

  3. One thing you may notice when you test your average constraints is the leg boxes tend to pull the feet out of their sockets when a foot steps. The reason this happens is because the torso doesn't dip when your character steps in X or Z. In a real body, when you take a step, your torso dips. The bigger you step, the more your torso dips. If your torso didn't dip, your feet would come out of your sockets too!

    So to make your character's torso automatically dip when your character takes a step, you can just create another expression. In the Expression Editor, click the New Expression button, and type in the following:

UpBodAuto1.ty = 0 – ((abs(LtLeg.tx - RtLeg.tx) + abs(LtLeg.tz -
  RtLeg.tz)) / 6);

    This expression finds how far the distance is between the feet by subtracting one foot from the other in X and Z. The absolute function removes negative signs from the expression, because there is no such thing as a negative distance. Dividing is needed because you don't want your character to dip as far as it steps. Name the expression Dip, click the Create button, and move your leg boxes to test the dip.

    You probably need to divide the effect by more than 6 to produce less of a dip. In addition, your character has probably moved out of its default position in Y (see Figure 3.58). This is because the expression is activated when the feet move apart, and the feet are already apart in their default pose. You can type in a number greater than 0 as the start number to adjust the character back up in Y. Another way you can make adjustments to your character's default position is by just translating your freedom nodes. The only channel that will be constrained on UpBodAuto2 is the X translation channel. So you can make any needed adjustments to the Z or Y translation of your character on this node. Also notice that although the expressions force the torso to move with the feet automatically, you can animate the UpperBody icon to compensate or add to the movement as needed. This enables you to animate basic movement of your character quickly, while adding subtle variations to the movement by manually animating the freedom node.

    3.58. Check to see whether the expressions constraining the torso caused your character to move out of its default position.

Writing Conditional Expressions

Another kind of advanced expression is a conditional expression, which uses the if and else commands. These commands enable you to set up a condition of some kind, and do one of two expressions depending on whether the condition evaluates as true or false. This is a good way, therefore, to have your character controls switch between two opposing actions. The automatic controls you create with conditional expressions on your character simulate the torso shifting weight when a foot is raised, and cause the hips to rotate in Y when a foot steps forward and backward. The general syntax for a conditional expression in Maya is as follows:

if (condition) Expression evaluated if the condition is true;
else Expression evaluated if the condition is false;

The condition used can be any mathematical statement that evaluates as true or false; for the examples in this book, however, you use greater than (>) or less than (<) statements. If the condition evaluates as true, the If expression runs. If it evaluates as false, on the other hand, the Else expression runs. Keep in mind that you can use the If command without the Else command, but the Else command always requires the If command be used before it. If you don't use an Else command, the expression does nothing if the condition evaluates as false.

Exercise 3.13
Using Conditional Expressions On Your Rig

  1. To make the torso automatically shift from side to side when a foot is raised, the translation in X of the UpBodAuto2 node must be constrained with a conditional expression. You must place this expression on the UpBodAuto2 node because the X translation channel on the UpBodAuto1 node is already being used by the average expression. This expression also uses the absolute function, because it involves calculating the distance each foot is raised to set the shifting amount. This amount is then divided at the end of the expression to make the movement subtler. In the Expression Editor, create the conditional expression in the following way:

    if (LtLeg.ty > RtLeg.ty)
UpBodAuto2.tx = 0 – (abs (LtLeg.ty - RtLeg.ty) / 2);
else
UpBodAuto2.tx = 0 + (abs (LtLeg.ty - RtLeg.ty) / 2);

    It's okay to separate the expressions onto different lines by pressing the regular Enter key, if this makes them easier to read. Maya still sees only one expression command until it reaches a semicolon. The above expression can be read, "If the left leg rises above the right leg, shift the torso to one side; otherwise, shift it to the other side." Name the expression Conditionals, and click Create. If you then raise one of the leg boxes, you should see the torso translate over the opposite leg as if its weight shifted to keep the character balanced (see Figure 3.59). Notice that the only difference between the If and Else expression is the plus and minus signs. If you find your character shifting in the wrong direction, reverse the signs.

    3.59. Use a conditional expression to make your character shift its torso over the opposite foot when a leg is raised.

  2. A similar conditional expression can be done to make the Hips box rotate in Y when a foot steps in Z. To do this, and still be able to manually animate the Hips box, you must make a group node parent to the Hips box. Do this by selecting the Hips box, press Ctrl+G, and name the new node HipsAuto. In insert mode, move the pivot of HipsAuto to sit on top of the Hips center. It doesn't matter whether the HipsAuto node has any numbers in its translation channels, but make sure the number in the rotation channels is 0. When finished, copy the previous conditional expression, and paste a second conditional expression in the same window. Then change the second expression to look like the following:

    if (LtLeg.tz > RtLeg.tz)
HipsAuto.ry = 0 – (abs (LtLeg.tz - RtLeg.tz) * 3);
else
HipsAuto.ry = 0 + (abs (LtLeg.tz - RtLeg.tz) * 3);

    When finished, click Edit to update the Conditionals expression. If you then move a leg box in Z, you should see the hips rotating in the same direction. Adjust the plus and minus signs if necessary to get the correct rotation. The reason the division should be changed to multiplication in the second expression is because the translation of the legs is affecting the rotation of the hips. For instance, 5 units of translation on the leg boxes makes the hips rotate only 5 degrees, which is not very noticeable. Multiplying the expression makes the hips rotate a noticeable amount.

Other Advanced Math Functions

A couple of other interesting expressions you can use on your character involve creating a breathing control, an eye-jitter control, and a tail-whip control. The breathing expression involves using a cosine function and a time function that references the timeline. The eye-jitter control involves using a randomize function and custom channels. Finally, the whipping tail expression also involves referencing the timeline, and introduces the use of MEL commands in an expression to create a delay effect.

Exercise 3.14
Using Functions to Create Additional Controls

  1. To create some breathing controls, in the top view draw a two-joint FK skeleton in the left chest area of your character. The skeleton should start inside the chest and end at the surface of the chest (see Figure 3.60). Translate and rotate the root joint as needed to place the skeleton correctly in the chest area. Name the joints LtBreathRoot and LtBreathEnd.

    3.60. Draw two skeletons in the chest area of your character to use as breathing controls.

    Mirror the skeleton to the right side, and name the right skeleton appropriately. Select both root joints and group twice, naming the group nodes BreathPad1 and BreathPad2. For now, make BreathPad1 child to Back3, so the breath joints move with your character's backbone. You use an expression to control the X scaling of the skeletons. This causes the front of the chest to move forward and backward.

    On the UpperBody icon, create two custom channels named breathSpeed and breathSize. Set the minimum and maximum limits of both channels to .1 and 10, with a default of 1. In the previous expressions shown in this chapter, you divided and multiplied your expressions by specific numeric values to control the amount of movement produced. Doing this sets a static amount of control that cannot change during your animation. In this expression, you divide by a channel that can be animated to change over time. This enables you to vary the movement produced by the expression over the course of your animation. Type the following lines in the Expression Editor to create the breathing effect:

LtBreathRoot.sx = 1 + (cos (time / UpperBody.breathSpeed) /
  UpperBody.breathSize);
RtBreathRoot.sx = 1 + (cos (time / UpperBody.breathSpeed) /
  UpperBody.breathSize);

    Name the expression Breathing, and click Create. This expression uses the cosine function in conjunction with the time function. A cosine function creates a wave, which is useful for making the X scaling of the breath joints go up and down. Using the time function makes the scaling happen automatically whenever the timeline is played. Scrub or play the timeline to see the breath joints scaling continuously. Change the breath speed and size channels to change the rate and scale of the breathing. Try setting the UpperBody.breathSpeed channel to .5, for instance, and the UpperBody.breathSize channel to 8.

    You may want to create an additional breath skeleton in the stomach cavity, to simulate deep breathing. This skeleton should be drawn from the middle of the abdomen to the belly button, and named LowBreathRoot. Use the same kind of expression as used on the chest skeletons to create the breathing effect. Bear in mind that these skeletons will later be bound to the skin of the torso to make it deform in a subtle manner as the joints scale continuously in X.

  2. To create an eye-jitter control, you must first parent two group nodes in between the EyesLook circle and the locators constraining each eye. Select the LtEyeLook locator, and press Ctrl+G twice. Name the top group node EyeJitterPad, and bottom group node EyeJitter. Then make the RtEyeLook locator child to EyeJitter. The translation channels on the EyeJitter node should all be at 0, and they should be sitting directly on top of the center of the EyeControl circle. Freeze the nodes if necessary to set the translation channels to 0.

    After you have created the two new nodes, make three custom channels that will control the jitter. On the EyeJitter node, create a jitterMin and jitterMax channel. The jitterMin channel should go from –10 to 0, with a default setting of 0. The jitterMax channel should go from 0 to 10, with a default setting of 0. Then on the EyesLook icon, create a jitterControl channel that goes from 0 to 10, with a default setting of 0. After you have made all the channels, type the following expression into the Expression Editor:

EyeJitter.jitterMax = 0 + EyesLook.jitterControl;
EyeJitter.jitterMin = 0 - EyesLook.jitterControl;

EyeJitter.tx = 0 + rand (EyeJitter.jitterMin, EyeJitter.
  jitterMax) / 8;
EyeJitter.ty = 0 + rand (EyeJitter.jitterMin, EyeJitter.
  jitterMax) / 8;

    Name the expression JitteryEyes, and click the Create button. The way this expression works is that the jitterControl channel controls both the jitterMin and jitterMax channels. When the jitterControl channel is set to 5, for instance, the jitterMin channel is set to –5, and the jitterMax channel is set to 5. These two channels are then used to define the minimum and maximum amounts that the randomize function requires, which is then used to control the translation channels of the EyeJitter node. Try increasing the jitterControl channel and notice that the eyes start to shake. The shaking continues as long as the timeline is played.

  3. The next expression creates a delay on the rotations of the joints in a tail to create a whipping effect (see Figure 3.61). Because Maya doesn't have a delay function, you have to use some MEL scripting to make the expression work.

    3.61. Use an expression that creates a delay on the rotation of joints to make a whipping effect on a tail.

    Draw an FK skeleton for a tail in the top view, starting in the middle of the hips and going straight back behind your character. For this example, the tail has five joints. Name the joints TailRoot, Tail2, Tail3, Tail4, and TailEnd. Point-constrain the root joint of the tail skeleton to the Hips box. When the tail skeleton is placed so that it starts in the Hips box and goes straight back behind the character, type the following lines in the Expression Editor:

    int $time = 'currentTime -query';
int $delay10 = 'getAttr -time ($time - 10) Hips.ry';
int $delay20 = 'getAttr -time ($time - 20) Hips.ry';
int $delay30 = 'getAttr -time ($time - 30) Hips.ry';
int $delay40 = 'getAttr -time ($time - 40) Hips.ry';
TailRoot.rotateZ = 0 + Hips.rotateY;
Tail2.rotateZ = 0 + $delay10;
Tail3.rotateZ = 0 + $delay20;
Tail4.rotateZ = 0 + $delay30;
TailEnd.rotateZ = 0 + $delay40;

  4. Name the expression TailWhip, and click Create. This expression uses MEL scripting to create a delay effect on the tail joints. Because this expression references the timeline, it is necessary to set keyframes on the Y rotation channel of the Hips box to see the whipping effect. Rotate the Hips box in Y, and right-click the Y channel in the channels box to set keys at several frames. If you then scrub or play the timeline, you should see a whipping effect on the tail.

    This expression uses two MEL commands: The currentTime command finds out what frame the timeline is on; the getAttr command enables you to get the value for the hips' rotation in Y at a particular frame. Both of the results for these commands are being placed in the variables $time, $delay10, $delay20, and so on. These variables are then used in the expressions to constrain each tail joint to rotate with an increasing delay. This creates the whipping effect on the tail. Don't worry if you don't entirely understand the MEL scripting used in this expression. You learn more detail about creating variables and using MEL commands in Chapter 6, "Scripting MEL Character Controls."

Creating a Rolling Foot

Next you create a more complicated foot hierarchy and set driven keys to drive a rolling foot control. The new foot setup involves creating group nodes that are used as pivot points for your current foot skeletons. A custom roll channel is created on each leg box to drive the pivot points so that each foot can roll forward and backward. When a foot rolls backward, it should pivot back on the heel. When it rolls forward, it should pivot up on the ball of the foot and then up onto the toe.

Exercise 3.15
Adding Foot Controls

  1. Open a hypergraph view, and zoom in on the feet section of your character rig hierarchy. Hide the visibility of the RtLeg box, so the right foot isn't in the way when you are working on the left foot. Disconnect the left-leg IK handle and polygon reference bones from your hierarchy by selecting them and pressing Shift+P. Be careful not to disconnect or change the parenting on the LtLeg box, or your torso may be affected through the expression connections. Then make sure your left-foot root joint is child to the ankle box. To create the new pivot points, select the foot root joint, and group three times. In the hypergraph, this creates three group nodes in the hierarchy that are between the left-leg box and the left-foot root joint.

    Name the three new group nodes from top to bottom as LtHeel, LtToe, and LtFoot. Press the Insert key, and move each group node's pivot to the appropriate place on the foot. The heel pivot should be where the heel touches the ground, the toe pivot should be where the toe touches the ground, and the foot pivot should be at the ball of the foot (see Figure 3.62). Then constrain the foot joints with IK twice. Using the IK handle tool, create IK from LtFootRoot to LtFootBall, and then create another IK from LtFootBall to LtFootEnd. Name the two new IK handles LtFootIK and LtToeIK. If your joints moved a little when you added the IK handles, translate the handles to put them back in place.

    3.62. Create three new group nodes for each foot to use as the pivot points in a foot roll.

    To finish the left-foot setup, parent the IK handles. Make the LtLegIK handle child to LtFoot, and make both the LtFootIK and LtToeIK child to LtToe. Then reparent the polygon foot bones under the foot root joint, and the polygon toe bones under the LtFootBall joint (see Figure 3.63). When everything is parented, test the three new pivot points by rotating them in X.

    3.63. Make all the foot skeletons and IK handles child to the new group nodes.

  2. To create a single control that drives all three of the foot pivots, create a custom channel on the left-leg box named roll. (Channel names are normally not capitalized.) Make the minimum and maximum limits on the channel go from –5 to 10, with a default setting of 0. Then load the LtLeg box into the Set Driven Key options box, and choose the roll channel as the driver. Load the X rotation of the LtHeel node as the driven channel. Set a driven key with the roll channel at 0, and the heel node in its default position. Then change the roll channel to –5, rotate the heel node back ward about 25 degrees in X, and set another key. This should create the backward rotation on the heel part of the foot roll.

    Set the roll channel to 0 again, and load in the X rotation of the LtFoot node as the driven channel. Key them both in their default positions. Then change the roll channel to 5, rotate the LtFoot node forward in X about 30 degrees, and set a driven key. This should make the foot roll up on the ball of the foot (see Figure 3.64). Finally, set the roll channel to 5, load in the X translation of the LtToe node, and set a driven key for its default position. It is important to do this at 5 on the roll channel, so the foot doesn't start at 0 to roll forward onto the toe. Then change the roll channel to 10, and rotate the toe node forward about 30 degrees in X, and set another key. Also at 10, load the LtFoot node in again, and rotate it backward about 20 degrees, and set a final key. This causes the foot to uncompress at the ball of the foot when it rolls up on the toe.

    3.64. Set driven keys on the group nodes to make the foot roll from the heel up onto the ball of the foot, and then onto the toe.

  3. When all the driven keys are set, test the roll channel. You should see your character's foot rolling backward when the roll channel goes in a negative direction and roll forward when the roll channel goes in a positive direction. One thing you should add to this setup is a node for manually animating the toes' rotation. Do this by selecting the toe IK, and press Ctrl+G. Name the group node LtToeRot, and move its pivot point to the ball of the foot. Then create a custom toeRotate channel on the left-leg box, and connect it with driven keys to the X rotation of the LtToeRot node. Keep in mind that you can still manually rotate your whole foot by just rotating the leg box.

Building a Flexible Backbone

Although the current FK backbone skeleton in your rig can bend in all directions, it has some limitations. It lacks fine controls for posing the backbone in more arched positions. It is also not easy to shift areas of the back—for instance, to stick your chest out—without causing problems to the joint centers. To upgrade your character's backbone controls to be more flexible, you create a new backbone skeleton that contains spline IK. This new backbone structure is added to your original backbone skeleton, so that you have two levels of backbone controls. In addition to this, you create a stretching quality to the backbone that can be used for both subtle or cartoon effects.

Exercise 3.16
Creating a Spline IK-Based Backbone

  1. Begin by creating two new box icons named MidBack and UpperBack. Move and scale the MidBack box so it is right above the Hips box and covers the abdomen area of your character. Move and scale the UpperBack box so that it surrounds the upper chest and shoulders area of your character (see Figure 3.65). You can also go into component mode and scale vertices to create a better shape. When in place, freeze the transforms on both boxes.

    3.65. Place a couple of new curve boxes to control the middle and upper areas of the new backbone skeletons.

  2. To create a more flexible backbone, you must draw a new backbone skeleton, with joints that follow the curve of the back. This doesn't mean, however, that you have to create as many joints as exist in a real backbone. You can create half the number of joints in a real backbone and still get enough flexibility. The fewer joints you have, the easier it is for you to add controls for each joint. Before drawing any joints, however, hide the BackPad1 node and the thorax polygon bone. This should give you a clear view of your polygon backbones in the side view. Also, make sure that IK is turned off in the Joint Tool options box before drawing joints.

    Draw the new backbone skeleton starting where the waist bends up to where the neck starts to bend. On real skeleton vertebrae, this is from between L2 and L3 to between T1 and C7. Use your polygon reference bones as a guide, drawing straight up the middle of the bones, placing each joint between every second vertebrae. In addition, do not draw a joint for every backbone, but instead draw one for every other backbone. This should create about eight backbone joints. When finished, name the joints B1 through B8.

    It is important for all the joint centers to be oriented correctly on your backbone skeleton. Show the centers on your joints, and check to see whether any are flipped 180 degrees in X (see Figure 3.66). This happens when you change directions when drawing a skeleton. If this is the case, use the same method described earlier in this chapter to rotate the joints to the correct orientation. This involves using the question mark (?) symbol in component mode to select the center and clicking the shelf button you created for rotating the center 180 degrees in X (the shelf button should execute the MEL code rotate –r –os 180 0 0.)

    3.66. Check to see whether any of the centers on your new backbone joints are flipped around 180 degrees in X.

    When your joint centers are all oriented in the same way, finish your new backbone skeleton by parenting all the appropriate polygon vertebrae to the new Maya joints. Each backbone joint should be parent to two polygon vertebrae. The polygon thorax bone should be made child to B5 or B6. You can adjust this later.

  3. Spline IK uses the shape of a curve to control the orientation of joints in a skeleton. Assign the spline IK to your character's new backbone by choosing Skeleton, IK Spline Handle Tool [image]. Set the spline IK options to the following:

    Root on Curve: On

    Number of Spans: 1

    Auto Parent Curve: Off

    Root Twist Mode: Off

    Auto Create Curve: On

    Twist Type: Linear

    Auto Simplify Curve: On

    Using these options creates a simple curve that follows the shape of the backbone skeleton. It also creates an IK handle that contains a twist channel used to rotate the joints in X with a linear falloff, so the top twists more than the bottom. Close the options box, and click your backbone skeleton's root joint, and then click its end joint. In the hypergraph view, notice that a new curve and IK handle are created. Spline IK differs from regular IK in that you do not animate the transforms of the IK handle. Instead, select the new curve and switch to component mode. The curve should have four points, and moving the points causes the backbone skeleton to flex. Name the new curve and IK handle BackCurve and BackIK.

  4. To make controlling the points on the backbone curve easier, create cluster handles for each point. Select the lowest point on the curve, and choose Deform, Create Cluster [image]. Make sure the options are at their default settings, with Relative turned off, and click Create (see Figure 3.67). Repeat the process for each point, and then name the clusters from lowest to highest Bc1 through Bc4.

    3.67. Create cluster handles on each point in your backbone curve.

  5. Repeat the same process for the hips of your character. Starting around the L1 vertebrae, in the side view draw a four-joint skeleton to the bottom of the pelvis. Because there are not many hipbones, you can draw a joint for each bone. When drawing, make sure you do not connect your hips skeleton to your backbone skeleton. To ensure this doesn't happen, click out to the side of the character, and drag the root joint of the hips over the backbone root joint. Name the hips joints from top to bottom H1 through H4. Once created, assign spline IK from the root to the end of the hips skeleton. Use the same settings as used previously. This action results in a curve with four points, and an IK handle, which you should name HipsCurve and HipsIK respectively. Create four cluster handles on the hips curve, and name them from top to bottom Hc1 through Hc4. Parent the polygon lower vertebrae and pelvis bone to the appropriate Maya joints.

  6. Yet again, repeat the same process for the neck. Start your new neck skeleton where the backbone skeleton ends, but don't attach it. Create joints for each neck vertebrae, from around C7 to C1. Name the joints N1 through N7. Then assign spline IK to the neck skeleton from the root joint to the end joint, with the same settings as used previously. Name the new curve and IK handle NeckCurve and NeckIK. Finally, create clusters on the points of the neck curve from bottom to top, and name them Nc1 through Nc4.

  7. To integrate the new backbone into your current rig hierarchy, you must make the clusters children of the control boxes, and the control boxes children of the original backbones. Do this by making Bc1 and Bc2 child to the MidBack box, and make Bc3 and Bc4 child to the UpperBack box. Create two group node parents for each back box, naming the group nodes from top to bottom MidBackPad1, MidBackPad2, UpBackPad1, and UpBackPad2. This keeps the rotation channels on the boxes at 0 when you parent them to the original backbone joints. Then make Back2 the parent of MidBackPad1, and Back3 the parent of UpBackPad1 (see Figure 3.68).

    3.68. Parent the MidBack and UpperBack boxes under the original backbone joints.

    To make sure everything on the limbs and head moves with the new backbone, make BackPad1 child to the last joint in your new backbone. Depending on how many new backbone joints you made, this will probably be B8. If there are any other children of the original backbones, such as the breathing skeletons, be sure to parent them under the appropriate new backbone joints. In addition, parent the neck clusters under the Head and UpperBack boxes. Make Nc1 and Nc2 child of the UpperBack box, and make Nc3 and Nc4 child of the Head box. Rotating the original neck joint moves the Head box, whereas rotating the box flexes the neck as the head and jaw rotate.

    After parenting the neck clusters, make the hip clusters child to the MidBack box and Hips box. Hc1 should be child to the MidBack box, and Hc2, Hc3, and Hc4 should be child to the Hips box. Also make LtLegRoot, RtLegRoot, LtHipRoot, and RtHipRoot child to H3 so that they will move with the new hip joints. When finished, check the parenting of the new backbone controls (see Figure 3.69).

    3.69. Check the hierarchy of your new backbone controls to make sure all the boxes and clusters are parented.

    Before testing your new backbone, make sure the pivot points of the boxes are in the correct places. The pivot point for the UpperBack box should sit on the top back curve cluster handle named Bc4. The MidBack box pivot should be in the middle of the stomach, and the Hips box pivot should be directly on top of Bc1 and Hc1. Move the pivot points in insert mode as needed.

  8. After you parent all the boxes and clusters, you should have three levels of controls for your character's back and neck, and two levels of controls for your character's hips. The first level of controls on the back and neck are the original FK skeletons. On the backbone, for instance, rotating the BackBend circle creates a basic side-to-side bend on the backbone. The next level of controls, namely the boxes, enables you to adjust the bend on three main sections of the backbone (see Figure 3.70). The finest level of controls is reached by translating individual clusters. You can animate the clusters manually, or set driven keys to control them with custom or transform channels on the boxes. This level of detail may not always be necessary, but is available when needed. On the hips, you do not have the FK level of control, but instead just the box and cluster levels.

    3.70. Rotate your circle controls to create a basic bend in the backbone, and then adjust the boxes to create more specific poses, such as an arched back.

  9. When testing your back controls, you may have noticed a problem. The controls that bend the character to the side, forward, and backward should all work fine, but the controls that twist the back in Y are no longer working right (see Figure 3.71). The character doesn't actually twist, but just wobbles slightly. The reason this is the case is that the spline IK is constraining the twist of the backbone, neck, and hip skeletons. After you put spline IK on a skeleton, you must control the twisting of the skeleton through the twist channel on the spline IK handle.

    3.71. When using spline IK, your character will no longer twist in Y by just rotating the controls, as seen here. Instead, you must use a separate twist channel.

    You can use an expression or set driven keys to control the twist channel on the spline IK handles. To make the rotation in Y of the UpperBack box control the BackIK.twist channel with an expression, for example, type the following line in the Expression Editor:

    BackIK.twist = 0 + UpperBack.ry;

    Name the expression Twists, and click Create. After creating the expression, try rotating the UpperBack box in Y. If the back is rotating in the wrong direction, change the plus sign to a minus sign. Although you could have made the green BackTwist circle constrain the twist channel, it makes more sense to do it on the level of the boxes that affect the spline IK. Because the BackTwist circle is no longer needed, just delete it. In addition, the Y rotation of the Hips box should control the HipsIK.twist channel, and the Y rotation of the Head box should control the NeckIK.twist channel. These expressions will look something like this:

    HipsIK.twist = 0 - Hips.ry;
NeckIK.twist = 0 + Head.ry;

  10. One other channel on the spline IK that you must set controls for is the roll channel. If you try rotating the UpperBody node in Y, you will see a problem similar to the previous twisting problem. The difference between the twist and roll channels is the twist channel has a falloff when rotating the joints, whereas the roll channel rotates all the joints evenly. To fix this, set driven keys on the roll channels of the spline IK for the back, hips, and neck.

    The reason you should use driven keys is because you may want to create more than one driver. Load the Y rotation channel of the UpperBody icon as the driver, and use the Shift key to load all the spline IK handles as driven. Again, use the Shift key to select all the spline IK handles in the Set Driven Key options box, and choose the roll channel as the driven channel. Rotate the UpperBody icon in Y, adjust the roll channels as needed to make the skeletons line up with the boxes, and set driven keys. If you are using the Y rotation average expression on the UpBodAuto1 node, load that node as a second driver, and set driven keys in a similar manner.

  11. Your character's backbone should be working correctly at this point. There are still, however, several stray nodes that are not parented into your rig hierarchy. Select the root joints for the new backbone, neck, and hips, and press Ctrl+G. Name the parent group node NewUpBody. Also select all the spline IK curves and IK handles, create a group node parent named SplineIK, and make it child to the NewUpBody node. Finally, create a group node parent of the Rig node named DoNotMove, and make NewUpBody and SplineIK child to it (see Figure 3.72). The spline IK curves and handles should never be transformed or animated. Because they are being controlled by constraints, if you move them directly they force a double transform on the skeletons. Because this will cause the pieces of your rig to separate, avoid it! There are times, however, when you will need to parent spline IK-controlled skeletons under a control object. This sometimes is required when using spline IK on appendages like ears or a tail. If your character has spline IK on some large rabbit ears, for example, you might see the skeletons twist when the Head box is rotated. This occurs independently of the roll and twist values in the spline IK handle. Parenting the spline IK constrained skeletons under the Head box will fix this problem.

    3.72. Finish your rig hierarchy by parenting all stray nodes. Make sure you parent the spline IK nodes and curves under a node that will never be animated.

  12. To make the backbone be able to stretch, you must get information on the length of the back curve. Do this by selecting the back curve, and type in the following MEL command on the command line or in the Script Editor:

    arclen –ch 1;

    Press the Enter key on the numeric keyboard to run the MEL code. Then, with the back curve still selected, graph the node in the hypergraph by clicking the icon for Input and Output Connections. You should see a node called curveInfo1. Right-click this node to open the Attribute Editor, and make a note of the value in the arcLength attribute (see Figure 3.73). This number is the default length of the back curve and is based on the size of your character.

    3.73. Make a note of the arcLength value of the curveInfo1 node in the Attribute Editor.

    To make the backbone stretch, you will use expressions to make the joints translate in their local X-axis according to the length of the back curve. Translating all the joints except the root joint according to their local X-axis causes the skeleton to get larger or smaller. In the following expressions, you divide the current curveInfo1.arcLength channel value by the original length, as noted previously in the Attribute Editor. When the expression is evaluated, if the lengths are the same, the result is 1, which causes no stretching. If the curve is longer or shorter, however, a result other than 1 is generated to make the backbone stretch. In the expression, the results generated by the curve length are multiplied by each joint's start value. It is important that this number reflect the default X Translation value of each joint. You must, therefore, select each joint to find out which numbers to use in your expression. Based on your character's backbone, your expressions should look something like this:

    B2.tx = .954 * (curveInfo1.arcLength / 7.714);
B3.tx = .923 * (curveInfo1.arcLength / 7.714);
B4.tx = .9   * (curveInfo1.arcLength / 7.714);
B5.tx = .87  * (curveInfo1.arcLength / 7.714);
B6.tx = .854 * (curveInfo1.arcLength / 7.714);
B7.tx = .8   * (curveInfo1.arcLength / 7.714);
B8.tx = .792 * (curveInfo1.arcLength / 7.714);

    Name this expression Backstretch and click Create. Because this is meant to have the effect of stretching the backbone joints, it is not necessary to write a line for the root joint. Make sure you use the default X Translation value for each joint as its start number. Look in the channels to get the correct value. After creating the expression, try translating the UpperBack box in Y to see the stretch effect on the backbone skeleton (see Figure 3.74).

    3.74. Create an expression that makes the backbone stretch when the backbone boxes are moved.

Creating Warning Signs

Many controls in your character rig have defined limits. These have been done through setting actual transform limits in the Attribute Editor, or by how you set the minimum and maximum settings on the custom channels of your control icons. Sometimes, however, it is better not to limit the controls, but instead make some kind of warning that tells animators that they have moved a control past its normal settings. Then the animator has the choice of how far to manipulate a control. Occasionally, the animator may want to go beyond the normal limits of a control to create dramatic effects. Such a warning can be done in a variety of ways, from making some text or symbol appear, to making your polygon reference bones change color. In the next exercise, you place some of these warning signs on your character when the backbone is stretched too far, or when an arm or leg is hyperextended.

Exercise 3.17
Making Text and Color Warnings

  1. A warning can be any kind of indication to the animator that a control has been moved too far. For instance, you could create a text message that is revealed whenever the backbone is stretched or compressed too far. Choose Create, Text [image] to create something to use as a warning message, such as "Whoa buddy, you're going a bit too far!" Make sure you use curves, and scale or translate the text as needed. Place it beside your character where it will be easy to see. In the hypergraph, name the top group node for the text WarningText1. Make the WarningText1 node child to the UpperBack box. The following expression sets the visibility of the warning text based on the length of the back curve. The expression contains an Or symbol, known as a double pipe (||), which can be found on the Backslash key. Your expression will look similar to the following:

if (curveInfo1.arcLength > 8 || curveInfo1.arcLength < 7)
  WarningText1.visibility = 1;
else WarningText1.visibility = 0;

    Name the expression Warnings, and click Create. The expression reads: "If the back curve gets stretched beyond 8 or gets compressed smaller than 7, reveal the warning text by setting its visibility to 1. Otherwise, hide the warning text by setting its visibility to 0." The values used in the expression should be based on the length of your character's back curve, and may differ from the example. When finished, test the warning by translating the UpperBack box in Y (see Figure 3.75). You should see the text warning appear whenever the back is stretched beyond the lengths specified.

    3.75. Create a control that shows a text warning whenever the backbone is stretched too far.

    You can use the same kind of expression to make your polygon reference bones change color when the back curve is stretched too far. Just constrain the incandescence channels on the Bonecolor material node rather than the text visibility. Open a hypershade view to select the Bonecolor material, and notice three incandescence channels are not being used. To have your bones turn red when the back is stretched, create a similar expression to the following:

if (curveInfo1.arcLength > 8 || curveInfo1.arcLength < 7)
  Bonecolor.incandescenceR = 1;
else Bonecolor.incandescenceR = 0;

  2. Another warning you can create is for when an arm or leg box is translated too far. To do this effectively, you need to calculate the distance between the shoulder and the hand. Keep in mind that the shoulder is the main pivot for the arm, while the hand moves around it in an arc. You want to have Maya calculate when the hand reaches the limit of that arc. To do this, you use the Distance tool by choosing Create, Measure Tools, Distance Tool. Then in the front view, click once above your character's left shoulder, and once above your character's left-arm box. This creates two locators that have a distance connection. Name the shoulder locator Loc1, and the wrist locator Loc2.

    To calculate the distance on the left arm, you need to point-constrain the locators to the arm root and arm box. Select Loc1 and Loc2 and group them, naming the parent node LimbDistances. When created, point-constrain Loc1 to the LtArmRoot joint, and point-constrain Loc2 to the LtArm box.

    Also notice that a distanceDimension node has been created in the hypergraph. Right-click the node to open it in the Attribute Editor, and note the distance listed under the Shape tab. This distance can be used to create a warning for when the left arm is translated too far. You can write such a warning by creating an expression similar to the following:

    if (distanceDimensionShape1.distance > 9.2)
Bonecolor.incandescenceG = 1;
else Bonecolor.incandescenceG = 0;

    This expression makes the Bonecolor turn green whenever the left arm is translated too far (see Figure 3.76). The best way to create warning colors on your character is to create multiple copies of the Bonecolor material and place them on specific areas of your polygon reference bones. This process enables you to specify a material that affects only a single limb, or just the backbone, in your warning expressions. Also keep in mind that you can do all these warnings by setting driven keys, instead of using expressions. This can produce a gradual changing of color on the polygon bones, instead of the color being full on or off.

    3.76. You also can use a distanceDimension node to create a warning color for when a limb is translated too far.


Wrapping It Up

Congratulations! If you made it this far, you should now have a fully functional skeleton rig. You have successfully used many of the skills and techniques that a professional character setup artist uses to create character controls. But wait, the rig is not finished. Although you have created lots of controls for animating the main parts of your character, you still have some important things to add. In the next few chapters, you create some muscle controls, face controls, and scripted MEL controls. Before you get to that, however, in the next chapter you bind your models to your current skeletons to see how they deform your skin.


Chapter 4. Deforming the Skin

This chapter shows you how to assign the skeletons in your rig to your character models as skin influences (see Figure 4.1). This process is called binding the skin, and enables you to deform the shapes of your models over time. The two binding methods available in Maya are called rigid skin binding and smooth skin binding. Although the basics of rigid binding are explained, this chapter focuses on creating a good smooth skin bind for your character.

4.1. Binding enables the skeleton rig you created in Chapter 3 to deform your character's skin.

In addition to smooth binding your skin to the skeletons you created in Chapter 3, "Character Skeleton Setup," you also draw new skeletons that facilitate better skin deformations. The new skeletons are used to stabilize the skin around your character's joints, and create muscle flexing on the skin. In addition, this chapter shows you how to use geometry-based deformers, called influence objects, to make your character flex its muscles.

Finally, this chapter shows you how to create more subtle skin effects that enhance the skeletal and muscle deformations on your character. These include making it appear like bones are sliding under your character's skin, producing wrinkles on the skin where joints bend, and creating muscle or fat jiggling on the skin.


Deforming the Skin with Skeletons

This section shows you how to assign a basic bind to your models, which enables the skeletons you created in Chapter 3 to deform your character's skin. This is the first step toward being able to animate your character with your rig controls. Like all deformers, binding only affects the components of your models. This occurs through assigning the points on the models to the closest skeleton joints. After you bind your skin, the transforms of your models are locked, as signified by a gray color on the channels. It is important to remember that after you bind your models, they should not have their transform channels animated.

To prepare your models for binding, make sure they are all parented under a single group node named Skin. Because you will not be animating their transforms, it doesn't matter whether the skin models are in any specific order in the hierarchy. Also make sure that all models in the skin hierarchy are meant to deform. Some models that shouldn't be deformed are eyeballs, armor, hats, and hard props such as eyeglasses. The eyeballs should already be parented under the HeadRoot joint so that they move with the head, but the other objects may not be parented to anything. Make these models child to a separate group node named DoNotDeform (see Figure 4.2). Later, parent each of these models under the appropriate skeleton joints in your rig so that they move with your character's skin. For instance, a wrist watch would be child of the ArmTurn joint, so it moves with the forearm.

4.2. Parent all the character models that should be a part of the deforming skin in a separate hierarchy than the models that should not deform, such as armor, eyeballs, and hard props.

Because any inputs into your character's skin could adversely affect your bind, it is important to delete history on your models before binding them. For instance, history connections to creation curves cause the bind to not work properly. Also keep in mind that any stitching or fillets connected to your NURBS surfaces are also removed when you delete history. This should not present a problem, however, because it is preferable to keep the tangency between surfaces through the bind assignment. Using stitching and fillets in conjunction with the bind causes your system to slow down dramatically. Instead, this section shows you how to keep the tangency between surfaces by adjusting how points on the skin are assigned to the skeletons, called skin weighting. This does not slow down your system any more than a normal bind does. Of course, to reduce the need to keep surfaces together, you can convert your NURBS patch models to polygon models that you then merge into a single surface. See Chapter 2, "Modeling the Skin of a Biped Character," for a detailed explanation of the conversion process.

Binding Methods

The two binding methods in Maya are rigid skin binding and smooth skin binding. Rigid has traditionally been used for low-resolution gaming characters, whereas smooth binding is normally used for high-resolution cinematic characters. This book focuses primarily on the smooth skin binding method, which gives you more control and flexibility over animating your character's skin. The basics of rigid binding are covered in this section, however, with the rest of the chapter describing in detail how to smooth skin bind your character.

Open the scene file named BasicBind.mb, and scrub the timeline to see how the bound skins deform. Each skin is assigned to a similar skeleton, but deforms very differently from each other when animated. The skin on the left is assigned with a basic smooth skin bind, whereas the one on the right is assigned with a basic rigid skin bind. Specifically, notice the area around the rotating joints. The skin on the left bends much more smoothly than the one on the right, which tends to intersect itself when the skeletons rotate upward (see Figure 4.3).

4.3. Notice that the smooth skin bind on the left deforms very differently from the rigid skin bind on the right.

The reason the skins bend differently from each other is because the points on the skins are assigned to the skeletons in very different manners. You can assign a point in a smooth skin bind to multiple joints, whereas you can assign a point in a rigid skin bind to only one joint. This creates a smoother bend on the smooth bound skin because the points around the deforming joint are moving partially with the rotating joint, and partially with the joint that remains still. How much each point moves with a particular joint is determined by the skin weighting assignment. The higher a joint is weighted, the more it affects the skin. On the rigid skin, however, the points are always initially assigned to only one joint with a full weighting. This causes the points above the animated joint to stay still, while the ones below the animated joint move completely with the rotating joint. Because of this, the skin assigned with a rigid bind intersects itself when the arm bends.

You assign a rigid skin bind by selecting the skin model's hierarchy, then Shift-select all the skeletons, and choose Skin, Bind Skin, Rigid Bind [image]. In the Rigid Bind options box, you must choose between binding to the complete skeleton or selected joints (see Figure 4.4). Choose the Complete Skeleton option if you Shift-selected only the root joints of the skeletons when you began to bind. This forces Maya to assign all the joints in the skeletons to your character's skin. If you specifically selected particular joints, perhaps because you want to leave out some joints from the bind, you should use the Selected Joints option. Binding the complete skeleton is fine for a simple character rig, whereas binding selected joints is often better for complicated rigs.

4.4. In the Rigid Bind options box, you must choose between binding the complete skeleton or selected joints.

One property that rigid skin binding has that is not available in a smooth skin bind is colored joints. By turning on the Color Joints option, the joints in your skeletons become color coded. Because each point on a rigid bound skin can be assigned to only one joint, turning on the Colored Joints option also colors the points on the skin to reflect the joint colors. Select the bound skin and switch to component mode to see the colored points.

The last option for a rigid skin bind is the Bind Method option. In most cases, you should use closest point, which places the skin points in cluster sets based on how close they are to particular joints. If you want to bind only specific points in your models to the skeleton joints, you can create your own cluster sets ahead of time by creating a partition under the Create menu. Also under the Create menu, in component mode, select the points on your skin that you want to bind, and create a named set that you add to your custom partition. After you place the set in the partition, the name of your partition appears in the Rigid Bind options box under Partition Set. Select it to bind only the points in the set you created.

You may wonder why anyone would use rigid binding if it causes the skin to intersect itself so badly. However, there are ways of reducing intersection problems on a rigid bound skin. To make it deform more smoothly, and even produce some simple muscle flexing, you add flexors to the skin.

Flexors are unique to rigid skin binding, and are easy to assign to the skin. You create a flexor by choosing Skin, Edit Rigid Skin, Create Flexor [image] on the top menu bar. The three types of flexors to choose from are lattice, sculpt, and joint cluster. To add any of these flexors, you must select the skeleton joint where you want the flexor to control the skin deformation. Then you must choose whether you want to add the flexor around the joint itself, or around the bone that connects the joints. If you add a lattice flexor around the lower-arm joint, for instance, it enables you to adjust the elbow deformation. On the other hand, adding a flexor to the lower-arm bone enables you to adjust simple muscle deformations on the forearm (see Figure 4.5).

4.5. You can place lattice flexors around a joint, or around the bones between joints for simple muscle effects.

Creating a lattice flexor assigns the lattice to the skin, and parents it to the skeleton. Select the lattice, and notice that several channels are available under the Shapes section in the channel bar. Adjust these channels to move parts of the lattice to improve the deformation of the skin. You can manually key these channels when animating, or set driven keys so that the skeletal joints drive them. You can use a lattice on the upper-arm bone to animate a biceps muscle, for instance, or you can use a sculpt flexor. The sculpt flexor creates a spherical sculpt deformer at the bone that can be scaled to push out a biceps. Adjust the pivot point of the sculpt flexor to affect only the biceps side of the arm skin.

The other flexor you can create is called a joint cluster. This flexor has upper and lower bound channels that you can adjust to remove skin intersections at the deforming joints. Select the main joints in your skeleton and add the joint cluster flexor to the selected joints. A small letter J will appear on each joint signifying it has a joint cluster. Then adjust the attributes in the channel bar or the Attribute Editor (see Figure 4.6). As with the other flexors, the channels can be driven to automatically correct intersection problems when the arm bends.

4.6. Adjusting the upper and lower bound attributes of a joint cluster flexor can remove intersection problems on a rigid bound skin.

In component mode, select some points on the skin after assigning flexors. Then open the Component Editor by choosing Window, General Editors, Component Editor, and select the Rigid Skins tab. The values displayed are called skin weights, and they show how much each selected point is assigned to a particular joint. Even though a point on a rigid bound skin can be assigned to only one joint, reducing the weighting to less than a value of 1 can make the skin deform more smoothly. This occurs automatically when you assign flexors to the skin. You can also manually type in values less than 1, or use the interactive slider to adjust the values. You also can adjust the skin weights in other ways, such as by selecting the skin and choosing Deform, Paint Cluster Weights Tool [image]. This tool gives you a black-and-white visual representation of the weights in shaded view, and enables you to interactively paint the weight values. Painting skin weights is covered in more detail in the "Additional Smooth Skin Binding Techniques" section later in this chapter.

In addition to adjusting the value of skin weights, you can use the Edit Membership tool to change the joints to which a point is assigned. Do this by choosing Deform, Edit Membership Tool, and select a rigid bound joint. The points assigned to that joint become highlighted (see Figure 4.7). To add to this set, hold the Shift key down while clicking additional points. The new points in the set should also become highlighted, and will also deform with the selected joint. Select additional joints to continue editing the joint cluster membership. You can also hold down the Ctrl key when selecting points to remove them from all memberships. This should only be done, however, if you don't want those points to move with any skeletons. Another way you can edit cluster membership is by selecting the skin and choosing Deform, Paint Set Membership Tool [image]. This tool works like the other paint tools, enabling you to paint membership to the selected joint.

4.7. Use the Edit Membership tool to see which points on a rigid bound skin are assigned to a selected joint, and use the Shift key to add points.

Creating a Smooth Skin Bind

The rest of this chapter concentrates on smooth skin binding, which gives you more control over how your skin deforms. To create a smooth skin bind, select your skin models, and Shift-select the skeleton joints you want to assign to them. Then open the Smooth Skin Bind options box by choosing Skin, Bind Skin, Smooth Bind [image]. In the resulting options box, similar to the Rigid Binding options box, you must first decide whether you want to bind to the complete skeleton or selected joints (see Figure 4.8). As mentioned previously with rigid binding, this depends on how you selected the joints in your skeletons. Be aware, however, of the advantages and disadvantages of each method.

4.8. The Smooth Skin Bind options box has some options that are similar to rigid binding, such as whether to bind to the complete skeleton or selected joints.

The advantage of using the Complete Skeleton option is that you don't have to take the time to select every joint you want to bind. By selecting only the root joints, all the joints in the skeleton are added to the bind. This can be a disadvantage, however, on a complicated character with a lot of skeletons in its rig. If your skeletons are in a rig similar to the one detailed in Chapter 3, reducing the amount of joints in your bind is desirable, because this reduces the size of the list of deformers assigned to the skin. Leaving some joints out of your bind, such as the end joints on each skeleton, does not change how the skin deforms. Usually the end joints are never actually animated, and are just there to serve as a goal for the previous joint's X-axis to point at. By using the Selected Joints option, you can remove the end joints from your bind by just not selecting them.

The next option you need to set is the binding method. You have a choice between the Closest Distance option and the Closest Joint option. The Closest Distance option assigns each point in the skin to the joint closest in distance. Then it assigns additional joints also based on how far they are from the point. Remember from the preceding section that a single point on a smooth bound skin can be assigned to multiple joints, which produces a smoother deformation on the skin than rigid binding. This ability to assign multiple joints to control a single point on the skin can be a problem, however, in areas where limbs branch off the body. For instance, fingers placed very close together can have points in one finger assigned to joints in the adjoining finger, because they are close in distance. If this occurs on the hand, you see the skin stretching on the inner side of one finger when the adjoining finger moves (see Figure 4.9). The same problem can happen on the upper arms and legs. This is one of the reasons you created your character models with the arms and legs stretched out away from the torso. This keeps the joints in the limbs from being close in distance to joints in other parts of your character's body when binding.

4.9. Using the Complete Skeleton option on your skin bind can cause fingers close to each other to have their points assigned to joints in the adjoining finger.

The Closest Joint option reduces the problem of points being assigned to joints in the wrong skeleton. Like the closest distance method, this method assigns the points to the first joint that is closest in distance. Then, this method assigns additional joints based both on distance and where they exist in the rig hierarchy (see Figure 4.10). In your character's hand, for instance, a point on the end of one finger will be assigned to the appropriate finger joint, and then the second joint may be on the same finger, or the next finger. When Maya considers binding the next finger joint because it is close in distance, it also checks the joint's position in the hierarchy. A joint in the next finger is all the way at the end of a separate branch in the hierarchy from the first assigned joint, so Maya does not assign it to the point.

4.10. The Closest Joint option assigns points based on both distance and position in the rig hierarchy. If a finger joint is close in distance to the first finger joint assigned, but far in the hierarchy because it is on adjacent fingers, the second joint is not assigned.

It is not always easy to decide which binding method to use. Using the closest joint method on the entire character reduces the problem of the wrong joints being assigned, but it can cause other problems. In a complex character such as the one built in Chapter 3, there are many group nodes and control objects in between skeletons. Using the closest joint method can make Maya not assign joints that should be assigned, because the nodes appear to be separated in the hierarchy. One way to get the best of both methods is to use different options on different parts of your character. For instance, you could use the closest distance method on the torso and arms, to make sure all the joints are assigned, and use the closest joint method on the hands, to make sure the finger assignment is correct. Because you cannot smooth bind the same skin more than once, to use multiple options you must first detach your character's skin into separate surfaces. Then bind each surface with the appropriate method. The key to doing this correctly is to make sure there is an overlapping of the assigned joints on each skin surface. When binding the arm separately from the hands, for instance, make sure that the lower-arm joints are assigned to both the arm skin and the hand skin (see Figure 4.11). This ensures that they have the same joint assignment in the area where the skins meet. Otherwise, the skins may come apart at the seams.

4.11. When binding separate but adjoining surfaces, make sure you assign an overlapping joint to prevent the seam from coming apart.

The last two smooth binding options work together to determine how many joints are assigned to each point on a skin. Set the Max Influences option to limit the total number of joints that can be assigned to a single point. In most normal cases, a point never needs to move with more than five joints. You may set the maximum number of influences to five in complex areas such as the face. On the other hand, it is normally not necessary to assign any less than three joints to points in most areas of your character's body. With this in mind, try setting the maximum number of influences for most of your skins to between three and five joints. When assigning the bind, Maya keeps looking for joints until it reaches the value set for the maximum number of influences, or it reaches the limit set for the drop-off rate. The Drop-off Rate option tells Maya how far away from the point it can look for joints to assign. Set the value high to get a faster drop off, which only assign joints that are close to the point, or set it low to make Maya assign joints that are farther away from the point. (Generally, I recommend setting the drop-off rate pretty high, such as around 7.5. This setting makes your bind more specific.)

Exercise 4.1
Smooth Skin Binding Your Character

In this exercise, you do a smooth skin test bind on your character models to see how they deform. Make sure that all the deforming skin models are parented under a single group node named Skin. Then make sure the history is deleted on the entire Skin group.

  1. You do most of the binding process by Shift-selecting nodes in the hypergraph view. Check to make sure that all the nodes in your rig are visible, and there are no nodes sitting on top of each other (see Figure 4.12). For this test bind, you bind all your skin models to all the appropriate Maya joints in your character rig. This process shows you how well your skeleton joints are placed, and how well your skins are made. A good bind requires that you have the pivot points for all joints placed correctly, and it requires that all your skin models have enough detail to bend well around each joint.

    4.12. In the hypergraph view, make sure no nodes are obscuring the joints you must select to bind your character's skin.

    Begin the process by selecting the Skin group node, and then hold down the Shift key to select the joints that you want to bind. Make sure you are only selecting nodes that are displayed with the skeleton joint icon on them. When selecting, do not Shift-select the end joints on your skeletons.

    In other words, Shift-select the root joints and all animating joints, but do not select the last joint in each skeleton. This reduces the list of deformers in your bind. Also keep in mind that a few joints should not be selected in this process (see Figure 4.13). These include joints in the original backbone and neck skeletons, which are only meant to control other skeletons.

    4.13. When selecting joints, leave out the end joints, the original back joints, and the original neck joints.

    When all the joints are selected, choose Skin, Bind Skin, Smooth Bind [image] on the top menu bar. In the Smooth Skin Bind options box, set the Bind To option to Selected Joints, set the Binding Method to Closest Distance. Because you are binding all the skins together for this test, using closest distance gives you the most predictable result. Set the Max Influences to 4, and set a Drop-off Rate of 7.5. When all the options are set, click Bind Skin.

    After binding, select the skin, and notice that the transform channels are all grayed out. A smooth skin bind locks the transforms, and creates a skinCluster node on each skin surface (see Figure 4.14). If you ever question whether a surface has been bound, just select it to see whether it has a skinCluster node under the Inputs section of the channel bar. Also keep in mind that a single surface can have only one skinCluster node, which contains all the information for the smooth bind.

    4.14. On a smooth skin bound character, the transform channels are locked, and the Inputs contain a skinCluster node.

  2. Before testing your rig controls, make sure that all the control objects have a key set on them at frame 0. Do this by selecting the appropriate control channels, and right-click to set a key. Be careful not to set a key on every node in your rig, because this will cause problems, especially on the splineIK nodes. Keys should be set only on your control icons and the custom channels you created to control the joints in your rig. By setting keys on all the control objects in your rig, you can get back to your default pose after testing your bind.

    Use the rig controls you created in Chapter 3 to test your smooth skin bind. For instance, translate an arm box down to the side of your character's hip. Check to see how the skin is deforming where the arm connects to the torso. You will probably see the upper chest caving in a little, because points in the chest have been assigned to the upper-arm joint (see Figure 4.15). The reason for this is that Maya is setting the skin weights of the upper-chest points to the few joints in that area, which are the backbones, upper arm, and breathing joints. The spot under the arm doesn't currently have any joints specifically made for that area. You have to manually change the weighting of the points under the arm to remove this problem.

    4.15. When testing your initial bind, look for areas of the skin that are not deforming well due to weighting problems.

    Later in this chapter, and in Chapter 5, "Character Setup for Animating the Face," you learn how to add influences to your rig to make your bind more specific. The goal of this is to reduce the amount of weighting you have to do to manually adjust skin weights. The fewer joints you have in your rig, the more weighting you have to do. You can see this quite clearly by rotating your character's jaw. Moving the channel that controls your character's jaw makes the entire face collapse. This is because there are currently no joints in the face area to weight the points to, which would keep the nose and cheeks stable when the jaw moves. To fix this, you must either adjust the point weights manually or add more influences.

    Other problem areas may occur on the neck, stomach, forearms, fingers, and the inner sides of the legs. Try crouching your character to see how the knees deform. You are mainly looking for joints that are not placed correctly. Your character's joints should rotate around the same pivot points that bones in a real skeleton would rotate around. If they are not correct, the deformation on the skin shows this. Continue moving your rig controls to test them. When finished, click the timeline at frame 0 to reset your character into its default pose.

  3. After you have tested your bind thoroughly, select the skin surface, and remove it by choosing Skin, Detach Skin [image]. In the resulting options box, set the History option to Delete History (see Figure 4.16). This option deletes the skinCluster node entirely, which unlocks the transform channels, and returns the skin to its original shape. The other option, Keep History, disables the bind without removing the skinCluster node. The Bake History option deletes the skinCluster node, while permanently freezing the components into the deformed shape the skeletons created. Use this option if you ever want to model using skeletons. Disregard the Remove Joint Colors option, because this is only applicable to a rigid skin bind. Click the Detach button after you have correctly set the options.

    4.16. After thoroughly testing your bind, remove it by detaching the skin with the Delete History option.

Creating Extra Skeletons for a Better Bind

The goal of binding is to do as little manual tweaking of skin weights as possible. One way to achieve this is by binding additional joints. Adding more joints into your character's skeletal rig before you do your final bind makes your skin weighting more specific. Adding more influences into the areas of the rig that do not currently have any keeps the points on the skin from being assigned to joints in distant skeletons. The best way to begin making your bind more specific is to draw new skeletons that contour the polygon reference bones. You can add skeletons for some of the ribs, for instance, or add skeletons in the nose and cheekbone areas of the skull (see Figure 4.17). As described later in this chapter, you also can draw many joints to represent the muscles and fat pads in the body.

4.17. Adding skeletons that contour the polygon reference bones, such as the ribs, can improve your initial bind.

Whenever you add skeletons to make your bind more specific, keep in mind that each new skeleton must be parented under the main skeletal joints in your rig. Otherwise, they will not move correctly with your character controls. If you add skeletons to represent ribs in your character's torso, for instance, make sure you parent the new skeletons under the appropriate backbone root joints. To keep a lot of extra bones from being drawn when you parent, create two group nodes between the skeletons. In addition to parenting, you can adjust movement on the new skeletons by setting driven keys on them. Rib skeletons should move with your character's backbone and breath controls, for instance, so set driven keys to make these objects drive the new joints as needed.

Manually Improving Smooth Skin Weights

As mentioned earlier in this chapter, the weighting on each skin point determines how the skin deforms when the skeleton joints rotate. Smooth skin binding allows each point on a skin to be assigned to multiple joints, based primarily on how close the joints are to a particular point. Joints closest to a given point are given the highest weighting, and affect the point more than joints that are farther away. To make the effects of weighting logical and predictable on a smooth skin bind, the weights are normalized.

Normalized weighting sets a limit on the maximum amount that a single point can be weighted. It assigns the largest amount of weighting to the closest joint, and assigns smaller amounts to additional joints based on the bind options settings, until it reaches a maximum combined weighting of 1. In an arm skin, for example, a point in the biceps area may be assigned to a biceps joint, upper-arm joint, and lower-arm joint. The biceps joint is assigned the largest amount of weighting, such as .6, because it is the closest joint. The upper-arm joint is the next-closest joint, so it gets a smaller amount of weighting, perhaps a .25 weight. The last joint, therefore, must have a .15 weighting, because the total weight must equal 1 (see Table 4.1).

Table 4.1. NORMALIZED WEIGHTS

Joint

Weight

Joint1

=

.6

Joint2

=

.25

Joint3

=

.15

Weight total

=

1

The most intuitive way to manually adjust the skin weighting on your character is to use the Paint Skin Weights tool. Before you paint skin weights, however, enlarge the perspective view to full screen, and make sure it is in shaded mode. In addition, on the perspective view's top menu bar choose Shading, Shade Options, Wireframe on Shaded to show the wireframe structure of your character's skin in shaded mode. Because weighting occurs only on the points and not on the surface between points, it is easier to paint if you can see your model's surface topology. Then select the skin you want to paint, and choose Skin, Edit Smooth Skin, Paint Skin Weights Tool [image]. The Paint Skin Weights Tool options box opens, and your skin should change to being shaded in grayscale colors. Weighting on the skin is represented by tonal values, with white signifying a weight of 1, black signifying a weight of 0, and shades of gray signifying values between 0 and 1.

Under the Influence section in the Paint Skin Weights tool, choose in the list which joint you want to adjust skin weighting for. This is where it is important that all your bound joints are named correctly. When you click a joint name, Maya displays, in grayscale, values of how the skin is weighted to that joint (see Figure 4.18). Then set the radius of your brush and decide what kind of paint operation you want to use when painting. Use the Replace option to set the weighting to a specific value. Use the Add option if you want to gradually increase or decrease the weighting value. If you know you want some points to be fully weighted to a joint, for instance, set the option to Replace and the Value to 1. Then paint on the appropriate points, which should turn them white. On the other hand, if you just want to increase the weighting gradually, set the operation to Add, and use a decimal value. To reduce the weighting, also use the Add operation, but set the value to a negative decimal number. Make sure your Min setting is –1, and not 0, to enable you to type in negative values.

4.18. Select the name of a joint in the Paint Skin Weights tool to see a grayscale representation of the weighting.

Other useful settings in the Paint Weights options box include the Smooth operation, Flood button, and Toggle Hold Weights on Selected button. Use the Smooth option to average values, which creates a gradual falloff in weighting. Click the Flood button if you want to set all the points on a surface to a particular value. If you know you want a joint to have no influence on a skin, for instance, set the operation to Replace and the value to 0, and flood the surface. The Hold button is useful if you don't want weights assigned on specific joints to change while painting. Normalized weights are always updating to have a total weighting of 1. If you reduce the weight value assigned to one joint, for instance, all the weight values to other joints automatically increase. If a joint has a hold on it, however, its weight does not change when other weights are adjusted up or down. Although setting a hold on a joint can be useful, make sure the hold is turned off after you have finished painting weights.

For many people, painting weights is both easy and intuitive. However, it is not the most accurate way to adjust your character's skin weighting. The problem with painting weights is that it is sometimes difficult to distinguish extreme gray values from white or black values. A very light value may appear white while not having a weight of 1, or a very dark value may appear black while not having a weight of 0. This can cause small movements on the skin that are not meant to be there. To make sure the weights are set accurately, you must use the Component Editor.

To use the Component Editor, select some points on your skin in component mode, and on the top menu bar choose Window, General Editors, Component Editor. Click the Smooth Skins tab to see an exact summary of how the selected points are weighted (see Figure 4.19). The points are listed on the left, and the joints or influences assigned to the skin are listed across the top. In a complex character, this list can be quite long, forcing you to scroll to the right. To make the list more manageable, click List in the editor's menu, and turn off Show All Columns. This removes from the Influence list any joints not assigned to the particular points you have selected.

4.19. Click the Smooth Skins tab in the Component Editor to see the exact weighting values of selected skin points.

Notice that the exact values for the weighting to each joint are given, and that they all total to 1. You can type in values for an individual point or use the Shift key to select the weights for many points. If you Shift-select many points, you can set them all to a particular weight by typing in the value, or use the slider at the bottom of the editor to interactively adjust all the weights. Notice that as you move the slider all the weights change, not just the ones you have selected. This shows you how normalized weights work. When you increase the values to one influence, all the other values go down, and vice versa. Also notice that when you move the slider, you can see the points moving interactively in the other views. To use the slider to adjust an entire column of weights, click the name of an influence at the top of the editor.

One tip for weighting points in the Component Editor is to set some keys on your controls so that the skin you are weighting deforms into some extreme poses (see Figure 4.20). Do this on a few frames so that it is easy for you to access all the poses by just scrubbing the timeline. This enables you to adjust the weights on your character without having to switch from component mode to object mode to see the effects of your weight changes on the deforming skin.

4.20. Keyframe your rig controls to create some extreme poses that reveal any weighting problems.

Just as in the Paint Skin Weights tool, you can put a hold on weights so that the weights to a particular influence are not affected by normalizing. If you set a column of weights to have a setting of .5, and then adjust another column of weights, the first column's values change when the weights normalize. To keep this from happening to the first column of weights, turn on a hold by typing a 1 into the Hold field at the top of the column. Then when you adjust the settings on the second column of weights, all the other columns normalize except the column being constrained by the hold. When you have finished adjusting the weights, make sure you turn the hold off by typing in a 0 in the Hold field.

If you bind separate surfaces because you are using NURBS patches, or because you are using different binding methods for different parts of your character, you have to keep the seams between surfaces from separating. Doing this on NURBS patches using fillets or stitches is not very efficient, and considerably slows down your computer system. Keeping the seams together through weighting is much more efficient, and does not slow down your system any more than any other kind of bind. The thing to keep in mind is that all you need to do to make points on separate surfaces move in the same way is make sure they are weighted in the same manner to the same joints.

The easiest way to make sure points stay together on separate surfaces is to place the seams in the middle of a bone, and not directly on a rotating joint. If the seam is in the middle of a bone, the edge points on both surfaces can be weighted fully to the bone. If you want to bind the hands separately from the arms so that you can use different binding methods, for example, it is best to separate the surfaces at the lower forearm. This places the seam in the middle of the arm turn bone. The weighting may get assigned automatically to the correct joint. If you have to adjust it manually, however, you can just set a weighting of 1 to the arm turn joint.

On the other hand, if your seam is placed directly on the wrist, points on the edges of each surface may be assigned weights to different joints. One may be weighted more to the hand joint, whereas the other may be weighted more to the arm turn joint. Such an occurrence normally happens when the edge points were not properly snapped together on the separate surfaces during the modeling process. This causes the seam to come apart during animation. You can correct this error manually, however. Keep in mind that it is not necessary that the points on both surfaces are weighted to only one joint, just that they are weighted with the same values to the same joints (see Figure 4.21). Points on a wrist seam may be weighted .6 to the arm turn joint, and .4 to the hand joint, and the surfaces still stays together.

4.21. Points on the edge of two separate adjacent surfaces must be weighted the same amount to the same joints to keep the surfaces together when animating.

Also keep in mind that to keep tangency between two surfaces, you must keep a straight line between the four points across a seam. This means that you not only have to match the weights on the points directly on the seam but also on the points directly on either side of the seam. If all the points across the seam do not maintain tangency, even though the seam may not come apart, a crease may become visible during animation. It is also easier to maintain tangency on seams that are not directly on a rotating joint.

You can use several other useful weighting commands under the Skin, Edit Smooth Skin menu. You can export and import weight maps. Exporting a weight map, by choosing Skin, Edit Smooth Skin, Export Skin Weight Maps [image] and setting a resolution, creates a folder that contains several grayscale image files that represent the weighting information on the skin (see Figure 4.22). The files are similar to the black-and-white skin appearance when using the Paint Skin Weights tool. On a complex character, this can create a lot of image files, so be careful not to set your resolution too high on the maps. After exporting, choose Skin, Edit Smooth Skin, Import Skin Weight Maps to assign the weight maps to the same or different skin. The weight map file itself is a .weightMap text file that tells Maya where the weight map images should be assigned on the skin. You can edit the file using Notepad to change how the weights are assigned. Usually, however, weight maps are exported and imported to assign weights that were set on a low-resolution version to a high-resolution version of the same skin. Because setting weights involves interacting with points on a surface, setting weights on a low-resolution skin is easier than setting weights on a high-resolution skin.

4.22. Exporting a weight map creates one text-based weight map file, and a folder that contains a gray scale image file for each influence.

If you are weighting a single surface skin that is symmetrical, such as a head or torso, you can mirror weights from one side of an axis plane to another. This does not work on separate skins, such as NURBS arm patches lofted off of a separate torso surface. To mirror weights from one side of a single surface torso to the other side, with the torso selected choose the Edit Smooth Skin menu, and then select Mirror Skin Weights [image]. In the resulting options box, set the plane that you want to mirror across, and whether you want to mirror the weights in a positive or negative direction. This command works in a similar manner to the Mirror Joints command. Although mirroring the weights can speed up your weighting tasks, to use it effectively, first be sure that your skin surfaces are centered on the global axis.

Other useful commands under the Edit Smooth Skin menu are Copy Skin Weights, Prune Small Weights, and Remove Unused Influences. Copying the skin weights enables you to copy weights from one skin to another skin. It assigns the weights based on the similarity of the two skins, and where points are located in 3D space. The Prune Small Weights command sets to 0 all weights that are below a specified value. Then you can use the Removed Unused Influences to remove all the joints that have a 0 weighting. Under the Edit Smooth Skin menu, you can also disable and enable the normalizing of weights on a skin. Use this only under special circumstances, however, because it can lead to unpredictable deformation results.

Exercise 4.2
Adjusting Skin Weights On Your Character

In this exercise, you rebind your character and manually adjust the skin weights. Before you do this, make sure you make any needed adjustments to the skeletons you tested in the preceding section. Also make sure you have added any additional skeletons that you think will improve your bind, such as ones that contour bone structures such as the ribs. This can reduce the need to spend a lot of time manually adjusting skin weights.

  1. First, create new skeletons in various areas of your character to improve the bind, such as adding skeletons that contour some of your polygon reference bones. Name all the new skeletons appropriately, and parent them all into your rig under the nearest skeletal joints. Then, rebind all the joints in the hypergraph view in the same way as you did before. Make sure you Shift-select any new joints you added to improve your basic bind, and smooth skin bind all the joints using the Selected Joints option. Also make sure you leave out the end joints, and do not bind the original back or neck skeletons. When finished, test out your new bind to see how well it is deforming.

  2. Make sure all your control objects have keys set on them at 0 in their default positions. Then set some additional keys to deform the character into some extreme poses. Look for poses that expose problems in the skin's deformation. When you see some problems in how the skin is deforming, select the skin, and open the Paint Skin Weights tool.

  3. Open the Paint Weights Tool by choosing on the top menu bar Skin, Edit Smooth Skin, Paint Skin Weights Tool [image]. Paint the weights as needed in the perspective view with the Shading, Shade Options, Wireframe on Shaded option turned on. Hold down the B key to adjust the size of your brush. Notice that you can sort the joints in your influence list by either hierarchy placement or alphabetically. You can also right-click a joint in the perspective view to select it for painting. Then use the Add and Replace options to quickly fix major problem areas. Remember that you can decrease values by using the Add operation with a negative value setting.

  4. After you fix all the major weighting problems with the Paint Skin Weights tool, use the Component Editor to finish the weighting. Look for areas on the skin that are not moving correctly, and switch to component mode to select the appropriate points. Then open the Component Editor to adjust the weights in the Smooth Skins tab. Make sure you don't select too many points, or you will get a very long list of deformers. Reduce the list as much as possible by turning off Show All Columns in the List menu. Adjust the weights by Shift-selecting values in the columns, and either type in values or use the interactive slider.


Deforming the Skin with Muscles

So far you have been mainly working with skeletal deformers, which enable you to animate all the main parts of your character's body. You can, however, make your character more realistic by adding secondary muscle flexing. There are a couple of ways to do this in Maya. One way is to add muscle skeletons that have their transforms driven to produce flexing, and the other way is to use geometry-based muscle objects that can actually change shape to produce flexing. In both cases, you set driven keys to drive the muscles, which in turn deform the skin.

Creating Muscle Skeletons

The simplest way to add muscle flexing to your character is to create muscle skeletons parented under the main skeletal joints and assign them with your other joints when you bind. When the muscle skeletons are parented correctly, you can set driven keys to drive them automatically when the joints rotate. In addition, you can create custom channels that enable you to drive the muscle joints manually.

Adding muscle skeletons to your current rig is not very different from how you added skeletons in the preceding section to make your bind more specific. The only difference is that a muscle skeleton must be animated, so it should be drawn according to how the muscle flexes. Most of the time, a convenient way to do this is to draw the joint so the X-axis points in the flexing direction. You can then drive the scaling in X of the muscle joint to produce the desired result (see Figure 4.23).

4.23. Draw muscle joints in the direction that the muscle should flex, and then drive its scaling in X.

To create some muscle skeletons in the upper arm, for instance, you would draw several two-joint skeletons in the biceps and triceps areas. From the previous skeleton, you may already have drawn an elbow skeleton to stabilize and better articulate the elbow. The muscle skeletons should radiate outward from the upper-arm bone. In a simple character, a single skeleton for the biceps and a single skeleton for the triceps are sufficient. If you have a more realistic character, however, draw multiple skeletons for each muscle so that you can have more control over the shape of the deformations on the arm skin.

It is important that all the muscle skeletons are parented under the correct skeletal joints. Both biceps and triceps skeletons should be child to the appropriate upper-arm joint. Create two group nodes between the skeletons to keep extra bones from being drawn. Then move your arm character controls around to make sure all the muscle skeletons move correctly with the arm. When everything is parented, drive the transforms of the muscle skeletons with the Z rotation of the lower-arm joint. On the left arm, for instance, load the LtArmLow joint as the driver, and the X scaling of the biceps muscle joint as the driven. Set driven keys on the biceps joint when the lower-arm joint is in its fully extended position and fully rotated position. If you have multiple biceps joints, you can load them all in at the same time, and drive their X scaling together. Keep in mind that you may also have to drive other transform channels on the muscle joints to get the desired skin deformation. Set similar keys to drive the triceps-muscle skeletons but making the triceps flex when the arm rotates in the opposite direction.

The reason it is best to use driven keys to control muscle skeletons is so that you can use multiple drivers. On the upper arm, for instance, you can also drive the muscle skeletons when the arm turn joint rotates in X. In a real arm, this action automatically changes the shape of the biceps muscle, because the radius bone stretches it when the forearm rotates. To change the shape of the biceps, you must do more than just control the scaling in X of a single biceps skeleton. Instead, you must drive multiple biceps skeletons that are assigned to each part of the skin's biceps area (see Figure 4.24). Finally, you can create muscle channels to manually drive the flexing of each muscle skeleton. This is meant to simulate the last level of muscle contraction, so the skeletons should be transformed so that the skin is in its most extreme deformation. Place the manual muscle channels either on your existing icon controls, or create additional muscle icons to place them on. Make the new muscle icons child to the main skeletal icons.

4.24. To better deform the shape of the skin, try adding multiple joints for a single muscle area, such as in a biceps.

Using Influence Objects for Muscle Deformation

Another way to create muscle deformations is to add influence objects to your rig. You can create an influence object from NURBS surfaces, polygon surfaces, curves, and locators. Influence objects can be added only to a surface that has already been bound as a smooth skin. Actually, even if you want to add more skeletons to your previous bind, you do it by adding them as influence objects. The new influences are added to the list of deformers on the skinCluster node, and their weights can then be painted or adjusted in the Component Editor.

It is relatively easy to assign influence objects. Just select the skin that you want to add a new deformer to, Shift-select the influence object, and choose Skin, Edit Smooth Skin, Add Influence [image]. In the resulting options box, choose to Use Geometry if your influence object is a surface or curve. If you are adding a skeleton or locator, it is not necessary to turn on the Use Geometry option. This option bases the weight assignment on the shape of the influence object's point structure (see Figure 4.25). For instance, a U-shaped influence curve would have points on the skin weighted to it in the same U shape. If you don't turn on this option, the weighting is assigned to fall off from the center of the influence object, and ignore its component shape.

4.25. Turning on the Use Geometry option assigns the weighting of the skin to reflect the shape of the influence object.

The Dropoff option for muscle influences should be set to a high value, because you want the muscle to affect only the area of the skin directly around it. You can increase the Polygon Smoothness and NURBS Samples options to make the influence object deform the skin more accurately. However, these settings should only be increased if necessary, because they can considerably slow down your computer system. If you are adding an influence object before manually adjusting weights on your character's skin, you should leave the Weight Locking option turned off. Maya recalculates the weights in the area of the influence object according to the drop-off setting. If you have spent time adjusting weights, turn the Weight Locking option on, and set the Default Weight value to 0. This prevents Maya from assigning any weighting to the influence object. You can then manually add weighting to the influence object using the Paint Skin Weights tool or Component Editor, while placing holds on weights that should not be changed through normalizing of the weights. When all the settings are correct, click the Add button.

One thing that you should be aware of when adding influence objects is that your character must be in its bind pose to add an influence object successfully. The bind pose is the position your skeletons were in when you first did a smooth bind on the skin. If you test your bind by moving your character controls, and do not click Undo to get back to the bind pose, you will get an error message when you try to add an influence object. On a simple skeleton, getting back to the bind pose is relatively easy. Just select the skeleton and choose Skin, Go to Bind Pose. On a complicated rig, however, channel constraints such as expressions can prevent this command from working. As mentioned previously, a good way to ensure that you can get back to your character's default pose is to set keys at frame 0 on all your character controls before you bind. This enables you to get back to the bind pose by setting the timeline back to 0. If you cannot get the character back into its bind pose, you receive an error message when you try to add an influence object.

When prevented from getting back to the bind pose, you can do one other thing. First, select a bound skeleton, and in the hypergraph view, turn on Input and Output Connections to graph all the nodes. Then find the bind pose node and delete it (see Figure 4.26). This should enable you to add influence objects, and Maya generates a new bind pose node after the influence is added. If for some reason you still can't add influences, it may be necessary to delete your current bind and rebind your character. If you have done a lot of work manually adjusting weights, use the Export Skin Weights command to save your skin weights, and import them again after rebinding.

4.26. Delete the bind pose node if you get an error message when trying to add influence objects to your skin.

You can drive the transforms of muscle influence objects in the same way as driving the transforms of muscle skeletons. First, make sure all the influence objects are child to the appropriate skeletal joints. Then drive the transforms of the influence objects with the rotation of the skeletal joints. When driving the transforms, you may need to adjust the position of the pivot points on the influence objects. In the arm, for instance, you can use influence objects rather than skeletons to simulate biceps and triceps muscle flexing. Simple spheres can be scaled to fit inside the appropriate muscle areas. However, you should place their pivot points toward the center of the upper-arm bone so that the influence objects scale correctly in relation to the arm (see Figure 4.27).

4.27. Make sure you place the muscle influence pivot points in the correct place for driving muscle flexing on the skin.

If you are going to just drive the transforms of muscle influences, you don't need to use a surface or curve as an influence object. Using a skeleton or locator works just as well, and does not use as much of your computer system's resources. Just make sure not to turn on the Use Geometry option when adding the influences. The main reason to use a surface or curve as an influence object is to use the components of the influence object to drive the shape of the muscle deformation on the skin. Components can be driven on an object by selecting them in component mode, and by setting driven keys for their positions when a skeletal joint rotates. To drive the shape of a biceps sphere, for instance, switch to component mode and select all the points on the sphere. Then load the points into the Driven section of the Set Driven Key options box, and load the lower-arm joint's Z rotation into the driver section. Hold down the Shift key to select the X, Y, and Z positions of the biceps sphere's points, and set a key for their default position (see Figure 4.28). Then rotate the arm joint into a fully bent pose, move the points on the biceps sphere, and set another key.

4.28. You can drive the shape of a muscle influence object by loading its components into the Set Driven Key options box.

After setting some driven keys on the points of the biceps influence object, you should see it change shape when the arm rotates. However, you will not see the effect of the deforming muscle object on the skin yet. To have the components of an influence object actually affect the skin, you must turn on a channel for the skinCluster node of the skin, which is by default always turned off. If you select the arm skin, and click the skinCluster node in the Inputs section of the channel bar, you will see a useComponents channel. Type a 1 into this channel to turn it on (see Figure 4.29). After the channel is turned on, you should see the points of the biceps influence object deform the skin when the arm bends. Keep in mind that, on a character with multiple skin surfaces, this needs to be done to every skin that will be affected by a deforming muscle influence.

4.29. In the useComponents channel of the skinCluster node, type a 1 to turn it on, and enable the components of a muscle influence object to deform the skin.

Muscle influence objects can be added in every part of your character's body. Using NURBS or polygon surfaces rather than curves requires that you hide the muscle surfaces when rendering your animation. Do this by placing all the muscle influence objects on a separate layer named Muscles that can then be easily hidden. But to make sure your muscle influence objects never accidentally show up in your renders, always use curves rather than surfaces. Also keep in mind that deforming the skin with the components of influence objects requires much more computer resources than deforming the skin with muscle joints. If your computer system has limited resources, you should instead use joints for muscle deformations.

Exercise 4.3
Adding Muscle Influences

In this exercise, you add muscle skeletons and muscle influence objects to your bind.

  1. First, you need to choose what kind of influence to add based on the design of your character, and your computer system's resources. Keep in mind that using geometry-based influence objects requires more system resources than using skeleton influences. One approach is to use both kinds based on the amount of detail required. Draw each skeleton or place each influence object so that it fits right inside the skin. After creating each influence, make sure you also parent it to the appropriate main skeletal joint.

  2. Add each influence to your bind by selecting the skin, Shift-select the influence, and choose Skin, Edit Smooth Skin, Add Influence [image]. Turn on the Use Geometry option only if you are adding a surface or curve as an influence object. Set the Dropoff option relatively high, so the influence affects only the skin around the muscle, and leave the Polygon Smoothness and NURBS samples at their default settings. If you have spent time painting weights, turn on the Weight Locking option, and set it to 0. This assigns the influence with no weighting, which enables you to carefully add the weight manually. Otherwise, Maya assigns the weighting, which can change your previous weight settings. Once added, you can manually add the weighting by painting weights or using the Component Editor.

  3. Finally, set driven keys on the transforms of all muscle skeletons to make them automatically flex when the appropriate skeletal joints rotate. Use a similar method to drive the components on muscle influence objects. Switch to component mode to select their points, and load them into the Set Driven Key options box. Shift-select all their positions, and set driven keys on them. Remember that you can also create custom channels on your icon controls to manually drive the muscle influences as needed.


Deforming the Skin with Bones, Wrinkles, and Fat

A third level of detail that you can add to your character's skin is making it appear to stretch, wrinkle, and jiggle when the skeletal and muscular controls move. There are a variety of ways to do this in Maya. This section shows you some of the most common ways to add such details to your character's skin.

Skin Sliding Over Bones

To make it appear that muscles are moving under the skin, you can add sculpt deformers to your rig. A sculpt deformer is a spherical deformer that pushes the points of a surface around, based on where a sculpt locator is placed. The locator is created with the sculpt deformer, and is like a base object that the deformer uses as the center of the effect. By parenting the sculpt deformer and locator under joints in your rig, you can make it appear that bones or cartilage are pushing the character's skin from the inside.

You assign a sculpt deformer by selecting the skin and choosing Deform, Create Sculpt Deformer [image]. In the resulting options box, set each option as needed. The most predictable mode for pushing a surface from the inside is the Stretch option (see Figure 4.30). You can experiment with the other modes, but the Flip Mode option may make the skin pop if the sculpt sphere goes too far, and the Project Mode option may make the skin bunch up. The Inside Mode option should normally be set to Stretch to evenly push the skin around with a Linear drop-off setting. The Max Displacement and Dropoff Distance options can be left at their defaults, and adjusted later in the channels. In most cases, turn on the Center Within Selection option, and then adjust the positions of the deformer and locator as needed.

4.30. Set the Sculpt Mode option to Stretch, Even, and a Linear drop-off to push the skin from the inside.

You can use sculpt deformers in many areas of your character. For instance, you can use one to simulate an Adam's apple in your character's neck. Or use them to make your scapulas look like they are moving under the skin of your character's back. You could even use one to make an eyelid deform slightly as it slides over the cornea of an eye.

Exercise 4.4
Using Sculpt Deformers

In this exercise, you use a sculpt deformer to simulate an Adam's apple.

  1. To create an Adam's apple as a sculpt deformer, in object mode select the part of your model that contains the neck skin and choose Deform, Create Sculpt Deformer [image]. Then set the Mode option to Stretch, and the Inside Mode option to Even. This smoothly pushes the skin outward on the front of the neck. Make sure that Max Displacement is set to .1, Dropoff Type is Linear, and Dropoff Distance is set to 1. Also turn on the Positioning option, and turn off the Grouping option. When all the options are set correctly, click the Create button.

  2. A locator will be created that will be the center of the deformation effect. Make sure this locator is placed in the middle of the neck, and is made child to the closest neck joint. Scale the spherical sculpt deformer so that it is the size of an Adam's apple, and move it toward the front of your character's neck (see Figure 4.31). In addition, the sculpt deformer should be made child to the same neck joint that you made the sculpt locator child to. To improve the deformation effect, adjust the maximumDisplacement and dropoffDistance input channels on the sculpt deformer.

    4.31. Place a sculpt deformer in the neck to simulate an Adam's apple.

  3. Finally, create a custom channel on the Head box to use as a driver for moving the sculpt deformer up and down. This is meant to simulate an Adam's apple moving when your character swallows. Remember to check your channels when moving the Adam's apple, because it may not be registering movement according to the expected axis, because it is child to a skeleton joint. You could create some group nodes between the neck joint and sculpt deformer, as done with previous controls, to make the motion more standard.

Creating Wrinkles On the Skin

One way to create geometry wrinkles is to assign curves as influence objects to the skin where you want to create the wrinkles. Do this in the same way as adding muscle influence objects, making the influence curves child to the appropriate skeletal joints. The advantage to creating wrinkles with an influence curve over a wire or wrinkle deformer is that the curve is added to the skinCluster node, and you can adjust its weighting with all the other skin weights. Drive the components of the curve to animate the wrinkles when the joints rotate, and make sure the useComponents channel is activated on the skin.

Keep in mind that you must have surface details in the right place to create a geometry-based wrinkle. Each wrinkle requires one row of points to create the crease, and two rows on either side to keep the edges from collapsing. The influence curves should be drawn in the same way as the point rows, with a separate curve for each row. The best way to do this is by holding the V key down to snap the curve to the surface points as you draw (see Figure 4.32). Obviously, it is not practical to do geometry-based wrinkles for every place that might wrinkle on the skin. You will want to use this technique only in areas where large wrinkles occur, or where there will be a close-up shot of the skin bending. Large wrinkles can occur on the torso, elbows, knees, wrists, and face.

4.32. Create a wrinkle influence curve by snapping the curve points to points on the skin.

Another way to create wrinkles is to use skeletons to drive the channels of color and bump texture maps on a skin shader. This does not require that the surface geometry be as detailed as when using wrinkle influences. Such a technique is good for small wrinkles in the skin, such as in the fingers. You can also use it in conjunction with larger geometry-based wrinkles to enhance the skin deformations.

This technique involves assigning textures to the color and bump channels of the skin shader. The two image file textures are assigned through a ramp, so that you can transition from one to the other. One texture is the default skin appearance without any wrinkles, whereas the other isthe skin with wrinkles drawn on it. Use the 3D Paint tool to initially create the wrinkle image (see Figure 4.33). Animating the transition from one image to the other is done using an expression that connects the position channels of the ramp to custom channels. In addition, you should assign a grayscale bump version of the wrinkled texture to the bump channel of the skin shader. Both the custom channels that control the color transition, and the depth channel of the bump map, can be then driven by the rotation of skeletal joints.

4.33. Draw wrinkles on the skin using the 3D Paint tool, and then open the image in Photoshop to create the finished wrinkle texture.

Keep in mind that you don't necessarily have to choose one or the other of these methods. In some cases, you may want to combine both methods to get the best result. This is most determined by how noticeable the wrinkles will be in a particular scene and the level of realism required by the character design.

Exercise 4.5
Using a Bump Map to Create Wrinkles

In this exercise, you create texture-based wrinkles on the skin by driving texture map channels on the skin with joint rotations.

  1. First, use the 3D Paint tool to draw where the wrinkles should be placed on your character's skin. Select the skin, and then open the 3D Paint tool by choosing Texturing, 3D Paint Tool [image]. If your skin doesn't already have a file texture, assign one under File Textures by choosing a JPEG or TIF image format, and click the Assign Textures button. Set the size of your image to 500 by 500 pixels, choose a color, and paint the wrinkles on the surface. Then click the Save Textures button.

  2. The wrinkle texture should be saved with a default name in the 3D Paint Textures folder that was created where your scene files are stored. Open the wrinkle texture file in Photoshop and revise it as needed, painting wrinkles and compositing with other skin textures. When done, save the file with a new name, such as WrinkleColor. Also make a nonwrinkled version, and save it as NoWrinkleColor. Finally, make a grayscale version that just focuses on the wrinkles to use as a bump map version, and save it as WrinkleBump.

    Use a ramp to blend between the nonwrinkle image and the fully wrinkled image. Drag a ramp into the work area of the hypershade view using the middle mouse button. Double-click the ramp to open it in the Attribute Editor, and delete the green color by clicking the box with an X in it. Then activate the top color by clicking the top circle, and click the link icon to the right of the Selected Color attribute. Choose a file texture, and in the resulting options box, load your WrinkleColor into the Image Name option. Repeat the same process to load the NoWrinkleColor image into the other ramp color. Once loaded, notice that dragging the color circles changes the Selected Position values, and blends the wrinkle textures (see Figure 4.34). A setting of 0 on one, and a high value such as .95 on the other, makes the second one blend over the first. Name your ramp WrinkleRamp.

    4.34. Load the WrinkleColor and the NoWrinkleColor image files into the ramp colors, and drive their positions to make the wrinkles appear on the skin.

  3. Create a Phong material named Skin and drag it into the work area of the hypershade. Then use the middle mouse button to drag your ramp onto the Phong material, and choose Color to connect them. Open the Skin material and click the link beside the Bump Mapping attribute. Choose a file texture, and on the File tab load in your WrinkleBump image. Adjust the Bump Depth attribute to increase or decrease the bump mapping effect. Do some test renders to check how your images appear with different settings.

  4. Create two custom channels for controlling the position attributes of your ramp with an expression. You can make them on any convenient control icon, naming them wrinkle and noWrinkle, and making them both go between 0 and 1. The position attributes are difficult to find, because they do not come up in the Channel box or in the Set Driven Key options box. They do come up in the Connection Editor, but the best place to find the correct name is in the History field of the Script Editor. In the hypershade view, change one of the ramp's position attributes, and notice in the Script Editor a line that is something like this:

    setAttr "WrinkleRamp.colorEntryList[0].position" 0.95;

    This shows that the name of one of the position attributes is WrinkleRamp.colorEntryList[0].position, so this is the name you should use to connect the attribute to a custom channel. After finding both attribute's names, in the Expression Editor type an expression that is similar to the following:

    WrinkleRamp.colorEntryList[0].position = 1 - Finger.wrinkle;
WrinkleRamp.colorEntryList[2].position = 0 + Finger.noWrinkle;

    You can then load the constraining channels into the Set Driven Key options box to drive them with the appropriate joint rotations. To also drive the bump on the skin, drive the Bump Depth channel of the bump map using the same joints. Set some keys on the joint drivers and run a batch render to test the wrinkle effect.

Making the Skin Jiggle

Creating a jiggle deformer is one easy way to make the components of an influence object jiggle your character's skin. Do this on muscle influences to give them weight and volume or add specific fat influence objects for jiggling when your character moves around.

First, you must assign a jiggle influence object that is either a surface or curve and then make sure the useComponents channel on the skinCluster node is turned on. A jiggle deformer can be used on a previously assigned muscle influence object. This causes the muscle to jiggle as it moves and flexes. You can also separate the jiggle and muscle-flexing controls by creating a separate jiggle influence object assigned to the same area of the skin. Separating the jiggle from the muscular controls enables you to weight the skin points to both as needed, so you can control how much each affects the skin. The easiest way to do this is to just duplicate the appropriate muscle influence object and assign the copy as the jiggle influence object for the same skin. For instance, you can duplicate a triceps-muscle sphere and assign the copy as a jiggle influence object for the triceps muscle. Then assign the points on the skin near the triceps area a partial weighting to the triceps-muscle influence and a partial weighting to the triceps jiggle influence. Finally, create a jiggle deformer on the jiggle influence, and adjust the influence weighting to make your character have flabby triceps.

Assigning a jiggle deformer is relatively easy. Just select the jiggle influence object and choose Deform, Create Jiggle Deformer [image]. Leave all the options at their default settings, and assign the deformer. You can adjust the two main Stiffness and Damping options in the Channel box after you see how the deformer affects the skin (see Figure 4.35). The Weighting option should be left at a setting of 1. Turn on the other two options only if you do not want the object to jiggle as your character moves around. Also, to see the jiggle effect on the skin, you must use the Paint Jiggle Weights tool in the Deform menu. Simply paint the weighting to assign jiggle to the skin around the muscle.

4.35. The stiffness and damping channels on the jiggle deformer can be adjusted in the Channel box to increase or decrease the jiggle effect.

The jiggle effect is based on movement, so in the example of a flabby triceps muscle, the arm box should be animated to see any jiggling. When the arm is moving around, you must run a simulation to see the influence object jiggle the skin. Do this by choosing Deform, Create Jiggle Disk Cache [image]. Set the simulation options to use the timeline by choosing Time Slider as the Cache Time Range, and leave the Over Sample Rate option to a value of 1. Increasing the Over Sample Rate option is only necessary to calculate collisions with rigid bodies, and is not necessary for a muscle influence. Click the Create button to run the simulation. When the simulation is complete, play the timeline to see the effect of the jiggle deformer. If you need more or less jiggle, adjust the jiggle deformer stiffness and damping channels in the Channel box, and re-run the simulation. Decreasing the stiffness and damping values creates more jiggle on your character's skin.

Another way to create some jiggle on the skin is to switch to the Dynamics module, and assign a soft body to an influence object. It is best to create this jiggle effect directly on a muscle influence. To make a biceps muscle jiggle, for instance, first select the muscle influence, and choose Soft/Rigid Bodies, Create Soft Body [image]. Inside the Soft Body options box, set the Creation Options to Duplicate, Make Copy Soft. Also turn off Duplicate Upstream Graph, turn on Hide Non-Soft Object, and turn on Make Non-Soft a Goal. The initial Weight option should be set to a .5 value. When finished, click Create.

Creating a copy of the biceps muscle as a soft body creates a CopyOf Bicep sphere that is connected to a particle node. Turning on the Make Non-Soft a Goal option makes the soft body copy follow the flexing of the original muscle influence, while still jiggling. A goal object is a target that the soft body always tries to reach. Set some keys on the rig controls to move the arm around, and play the timeline to see the soft body biceps jiggle. To adjust the amount of jiggle, increase or decrease the goal weight channel on the particle node, which is child of the CopyOfBicep node (see Figure 4.36). Increasing the weight reduces the amount of jiggle. Keep in mind that you will not see the jiggle effect on the skin until you assign the soft body copy as a new muscle influence object. Assign it as you would any other influence, and make sure you set the skin weights appropriately. The original muscle object can have its weighting reduced, or you can remove the weighting entirely by setting it to 0.

4.36. The particle node for your soft body influence is the child of the soft body copy and contains the goal weight channel.

To have even more control over the muscle jiggle, you can add springs to the soft body influence. First add springs directly to the soft body by selecting it, and choose Soft/Rigid Bodies, Create Springs [image]. Name the springs for the soft body biceps influence BicepSprings, and turn off all the options. Set the Creation Method to Wireframe, with a Wire Walk Length value of 1, and click Create. This creates a set of springs that reflects the structure of your influence object but will not be too heavy.

Then add some springs to anchor the muscle to the arm. To do this, you need to create two curve-based objects that will be child to the arm joints. Draw a two-point linear curve, or create a small curve box to use as an anchor object. Name it BicepAnchor1, duplicate it, and place one anchor on each side of the soft body biceps muscle. One anchor should be close to and the child of the lower-arm joint, and the other should be close to and the child of the upper-arm joint. Then switch to component mode to select points on one side of the biceps muscle, and Shift-select a couple of points on the closest anchor object. Create another spring named BicepAnchorSpring, and this time use the MinMax creation method with values from 1 to 100. Click Create to create springs that connect one end of the muscle to the closest anchor. Repeat this process for the other side of the muscle, but Shift-select the new BicepAnchorSpring after selecting points on the soft body and anchor, and turn on the Add to Existing Spring option to add the springs on the other side of the muscle to the BicepAnchorSpring node (see Figure 4.37). Play the timeline to see the soft body and springs move. Adjust the stiffness and damping channels on the spring nodes as needed to improve the muscle jiggle.

4.37. Adding springs can anchor your soft body jiggle influence to the skeleton joints through a couple of curve objects. This causes the movement of the joints to influence the jiggle effect even more on the soft body.


Additional Smooth Skin Binding Techniques

Generally speaking, the binding process is the same for both NURBS and polygon surfaces. To bind subdivision surfaces, however, you must be aware of some differences. When binding subdivision surfaces in polygon proxy mode, for instance, you have to be careful to select the right node for binding. If you just select the proxy hull to bind, you actually bind both the polygon proxy node and the subdivision surface node. This results in a double transform when you animate your character controls, causing your skin to come out of its proxy hull (see Figure 4.38). To avoid this problem, make sure you select only the polygon proxy node as the skin you want to bind. The easiest way to do this is to use the arrow keys after selecting the surface in polygon proxy mode. Just click the Down Arrow key, and then click the Left Arrow key, to get to the proxy node. You can tell you are on the proxy node because the proxy hull becomes highlighted and the subdivision surface becomes pink colored. When the proxy node is selected, you can Shift-select the joints you want to bind.

4.38. Make sure you select the correct node when binding a subdivision surface or you will get a double transform.

You can also choose to bind in standard mode, which only binds the subdivision surface node. Keep in mind, however, that you can only bind the level 0 of a subdivision surface, and you cannot switch back to polygon proxy mode after binding. To manually adjust weights in the Component Editor, make sure you are selecting points on level 0.

Instead of binding the subdivision surface directly, you may want to try binding the subdivision surfaces indirectly through a wrap deform. To do this, you need a duplicate of your polygon proxy or level 0 subdivision surface. The idea is to do all your binding, weighting, and animating on a low-resolution polygon version of your skin, and use a wrap deformer to make it drive a high-resolution subdivision surface version of your skin. When doing this, make sure your subdivision surface is in polygon proxy mode and use the arrow keys to select the polygon proxy node. Then Shift-select the low-resolution polygon skin and choose Deform, Create Wrap [image].

Set the Weight Threshold option to 1, and turn on Limit Influence Area to Use Max Distance. Then set the distance to a very small number, such as .02. Setting this saves memory when calculating the wrap deform. As long as you are using a low-resolution polygon that is very similar to the polygon proxy on your subdivision surface, you can set the Max Distance value very low. Increase the number a little if the two surfaces have differences in their point structure. For instance, your low-resolution polygon skin does not have to contain details that will not be animated, such as a belly button or nipples on a torso (see Figure 4.39). However, you may want your final model to contain these details. So the point structure may be slightly different in these areas, and you must increase the Max distance value to make the wrap deform control the additional points.

4.39. When driving a subdivision surface skin with a polygon wrap deformer, you can leave out nonanimated surface details such as a belly button on the bound polygon skin.

After the wrap deform is created, you can bind the low-resolution polygon skin to the appropriate skeleton joints. All weight painting is done only on the low-resolution polygon skin. When you move your character controls, you should see both your polygon and subdivision surface skins deform in the same way. Then, to speed up your system when animating, hide the subdivision surface skin. You can even turn off thewrap deform by setting the Envelope channel on the wrap deformer node to 0. Or, you can even wait until after animating the low-resolution polygon skin before making the wrap deformer connection. As long as the character can be returned to its default pose at frame 0, you can wait until you are ready to render before adding the wrap deform.

Another way to improve the deformations created by skeletons on a smooth bound skin is to assign a lattice to the skin. Sometimes skeletons cause problems on the deforming skin that even manual tweaking of the weights won't fix. One such area that usually has this problem is the forearm when it twists to turn the wrist. Inside a real forearm, the muscles wrap around the radius and ulna bones in a complicated manner that is difficult to emulate in a computer-generated character. After you bind your character's skin, you may notice that your character's forearm collapses when you test the channels that drive the arm turn joint. Adjusting the weights so that the skin is controlled more by the arm turn joint than the radius and ulna joints can reduce some of the problem. However, it is sometimes necessary to add a lattice to counteract and smooth out the twisting of the forearm. A good alternative to using a lattice is to drive the components of several influence curves that are added around the forearm.

Exercise 4.6
Placing a Lattice Around Your Character's Forearm

In this exercise, you create a lattice around your character's left forearm. Do this after you have finished binding and adjusting the weights of the arm influences. Make sure that the lattice is detailed enough to correct any problems in the arm geometry when the forearm twists.

  1. Begin by selecting in component mode the skin points from slightly below your character's left elbow to the left wrist. If you have multiple surfaces, Shift-select all the surfaces involved, and switch to component mode to select the appropriate points. Then create a lattice by choosing Deform, Create Lattice [image].

  2. In the resulting options box, set the Divisions option to 3 3 3. Turn on the Local Mode option, and set the Local Divisions option to 2 2 2. You should later adjust these numbers as needed in the Channel box. Turn on the Positioning option to center the lattice around the selected points, and turn on the Grouping option to parent the lattice and base together. If the lattice doesn't come up as desired around the points, re-apply the lattice with this option turned off, and position the lattice group manually around the forearm. Leave the Parenting and Freeze Mode options turned off.

  3. In the hypergraph view, parent the lattice group node under the left lower-arm joint. This ensures that the lattice follows the arm as it moves. It is important that both the base and the lattice stay together, which is why you grouped them in the creation options.

  4. Drive the lattice points in the same way as muscle influence objects. Just load the points into the Driven field of the Set Driven Key options box, and Shift-select their positions. Load the left-arm's turn joint X rotation as the driver. Then set driven keys for the forearm poses, using the lattice to fix any surface twisting problems (see Figure 4.40). When finished, do the same for your character's right forearm.

    4.40. You can place a lattice on the forearm and drive the components on the lattice to fix deformation problems on the skin.


Wrapping It Up

You should now have a better idea of what is involved in creating a good bind for your character. Although the concept of binding is not hard to understand, it can be challenging and time consuming to do well. If you proceed carefully through each step in the process, however, you should be able to create a decent bind for your character. Keep in mind that it can be acceptable, even if it is not perfect. Small imperfections that show up only infrequently can be fixed in the final renders by using rotoscoping methods to paint out the problems. This happens more often than most people realize, even in professional productions. In the next chapter, you finish working on your character's skin by focusing on how the face deforms.


Chapter 5. Character Setup for Animating the Face

This chapter shows you how to create animation controls for the face. Because the face is the most expressive and complex area on your character's body, it requires finer controls than other body parts. Some of the techniques shown in this chapter involve creating additional influences in the face area, and are an extension of what you learned in Chapter 4, "Deforming the Skin." Other techniques such as creating morph targets, called blend shapes, are introduced as a way of enhancing skeletal deformations. In the advanced section of this chapter, both influences and blend shapes are used to create several levels of controls that mimic the muscles of the face. Before beginning this process, however, it is a good idea to separate your character's head skin from the rest of the body at the neck, so you can add all the face influences only to the head skin, and you only have to duplicate the head skin to create blend shape targets. Otherwise, your blend shapes would include other body parts, such as the neck and torso, which would not be very efficient. If using NURBS surfaces, do this by selecting an isoparm at the top of the neck, and detach it from the head. Or if using a single-surface polygon skin, separate the head from the neck along an edge at the top of the neck. Try to choose an edge to separate that is not directly on a joint to ensure a minimum amount of deformation on the resulting seam.


Creating Basic Face Controls

When you tested your skeletal bind in Chapter 4, you probably noticed that rotating the jaw joint caused the entire face of your character to stretch (see Figure 5.1). This happens when you bind the basic rig, because only the head and jaw skeletons are being assigned to the skin of the face. All the features of the face are assigned a certain amount to each of these skeletons, and therefore they move when the jaw is rotated. To produce a better bind, and gain more control over each area of the face, you must create additional face influences. Keep in mind as you do this that all the new face influences must move with either the head or jaw skeletons, so they should be parented accordingly. Remember that you can insert two group nodes between skeletons to keep too many extraneous bones from being drawn.

5.1. When you only bind a head and jaw skeleton to your character's head, the weighting on the face is very generalized, which causes the entire face to stretch when the jaw joint is moved.

Adding Face Influences to the Head

To make your bind more specific, you can create skeletons that lock down all the facial features that should not move with the jaw. These skeletons should contour the skull to some degree on the cheekbones and forehead. For instance, a skeleton can be drawn going from the top of the nose to the tip of the nose. Two small, two-joint skeletons can be created on either side of the nose to flare the nostrils by scaling them in X. Draw skeletons from the center of the head out to the center of each cheek to puff out or pull in your character's cheeks by also scaling in X. You also can draw three skeletons from the top of the forehead down to the left, right, and middle of the brow. You can scale these to raise each part of your character's brows (see Figure 5.2). Group all skeletons in the top part of the face under the HeadRoot joint so that they move with the head.

5.2. You can draw skeletons to make the weighting in your character's face more specific, such as creating several joints in the forehead area to flex the brows.

Skeletons can also be drawn from the center of the eyes out to both the upper and lower eyelids (see Figure 5.3). Because the eyeballs are round, the lids must close on an arc to prevent intersection problems. Assigning the lids to skeleton joints that rotate from the center of each eye ensures they deform around the eyeballs in the correct manner.

5.3. Drawing skeletons from the center of each eyeball to the edge of each eyelid creates controls that close the eyelids on an arc.

You can also draw two skeletons to better contour the jaw. Draw these starting below each ear, and end them in the center of the chin. In addition, to force a better lip bind assignment, you can draw one upper-lip and one lower-lip skeleton. You should draw the upper-lip skeleton from the bottom of the nose to the middle of the upper lip, and draw the lower-lip skeleton from the middle of the chin to the middle of the lower lip. Group together all the new skeletons in the jaw and lower-lip area to be parented under the original jaw joint (see Figure 5.4).

5.4. Skeletons in the lower part of the face, such as one for the lower lip, should be child to the jaw joint so that they move with the jaw.

If you have separated your character's head skin from the rest of your character's body, as recommended at the beginning of this chapter, you need to rebind all the head and face skeletons again. If you left your character's head attached to its body, however, because it has already been meticulously bound and weighted, add each new skeleton to the existing skinCluster node as an influence. You may want to set a weighting of 0 in the Add Influence options box and then manually set the weight for each new influence as needed with the Paint Skin Weights tool and the Component Editor.

One technique you can use in conjunction with assigning skeleton influences is to use the geometry of the skull as a motion track for the influences to move on. This enables you to make it appear that your muscles and skin are moving according to the bone structure of the face. Do this by creating some underlying geometry for the bones of the face or just use your existing polygon reference bones. Then use a geometry constraint to force the influences to stick to the surface of the underlying geometry. The best kind of influences to use with this technique are either single-joint skeletons or locators assigned as influence objects. To try this, create a single-joint skeleton by activating the Joint tool, clicking once, and pressing Enter. Then select the polygon reference skull bone, Shift-select the single-joint skeleton, and choose Constrain, Geometry. When you translate the joint, it should stick to the surface of the polygon skull (see Figure 5.5). Make sure you still parent the joint under the HeadRoot joint to ensure it moves correctly with the head. You can also use a similar technique with sculpt deformers to make it appear that bones are sliding under the skin.

5.5. You can geometry-constrain influences to the polygon reference skull bone to make the skin deform according to the structure of the underlying bones.

Another way to animate facial features is to add more influence curves than skeletons to the head skin. In this case, you hold down the V key to snap to the points on the face as you draw each curve. Try to draw the curves so that they contour the main features and wrinkles of the face. For instance, curves can be created around the mouth and around each eye. Curves can also be drawn to follow the brow lines and the smile lines (see Figure 5.6). When drawing your curves, try to simplify the curve by snapping only to the main areas you want to control. Then assign these curves as additional influences, along with your head and jaw skeletons. Adjust the weighting of the skin to the curves as needed using the Paint Skin Weights tool and the Component Editor. Also make sure you turn on the useComponents channel on the skinCluster node to force the skin to deform with the curves.

5.6. You can assign curves as influences that contour the eyes, mouth, and wrinkle lines to use as face controls.

After you have assigned the influence curves, you can create single-point clusters on each point of the curves. Do not turn on local mode, which turns off the capability of the clusters to deform the skin when their parents get transformed. Parent the clusters under the main skeleton joints with which they should move. Clusters on the eye curves should be child to the HeadRoot joint, for instance, whereas clusters on the lower-lip curves should be child to the JawRoot joint. Grouping together all the clusters for each joint makes setting driven keys more predictable. Finally, create custom channels on the Head box that drive the clusters and joints together. Using channels as multiple drivers for the same cluster handles, you can set driven keys to create a variety of controls for each area of the face.

One variation you could use with this technique is to assign the curves to the skeletons with a rigid bind instead of parenting the cluster handles to the joints directly. The advantage of doing this is that you can adjust the rigid bind weighting of the curves to follow the skeletons more smoothly than they would through just parenting. In this variation, you group the cluster handles under a node that is made child to the HeadRoot joint.

You can also use similar techniques on other parts of your character's body. For instance, you could create influence curves to improve the forearm skin deformation instead of using a lattice as detailed in Chapter 4. Add influence curves that are drawn from the upper forearm to the wrist, and create single-point cluster handles that are parented to the lower-arm and arm turn joints (see Figure 5.7). Then you can set driven keys on the cluster handles to smooth out the skin when the armTurn joint rotates.

5.7. You can use influence curves in other areas of the body, such as for smoothing out the twisting of a forearm.

Exercise 5.1
Adding Face Influences to Your Bind

In this exercise, you add face influences to your bind. Begin by making the weighting in your character's face skin more specific. The most efficient way to do this is to bind the head with additional skeletons that contour the features of the face.

  1. First, create skeletons that will keep the edges of the face stable when the head and jaw are animated. Begin by drawing skeletons that contour the cheekbones, bridge of the nose, and top of the head. Name all the new skeleton joints appropriately, such as LtCheekRoot, NoseRoot, and RtBrowRoot. Then select all the skeleton roots, group them together twice, and name the group nodes SkullPad1 and SkullPad2. Be sure to make SkullPad1 child to the HeadRoot joint so that it will move correctly with the head.

    Draw a couple of skeletons that contour the edge of the jaw, and parent them under the main jaw joint. Shift-select both new jaw skeletons and group twice, naming the group nodes JawPad1 and JawPad2, and make JawPad1 child to the original JawRoot joint. This ensures they move correctly with the jaw.

  2. Create skeletons that can be scaled or rotated to make the areas of the eyes and mouth flex. In the eye area, draw three skeletons from the top of the forehead to the left, middle, and right brows. Also, draw two-joint skeletons that start in the middle of each eye, and end at the top and bottom eyelids. Give the brow and eyelid skeletons appropriate names, and make them all child to the SkullPad2 node. In the mouth area, draw two-joint skeletons for the upper lip and lower lip. Also draw skeletons that start in the middle of the head and end on the middle of the cheeks. Scaling these skeletons in X should pull back the upper and lower lips, and puff out the cheeks.

    Name all the new skeletons appropriately, and parent the new skeletons under either JawPad2 or SkullPad2, depending on how they should move. The lower-lip skeleton should move with the jaw, for instance, so it should be child to JawPad2. You can also set driven keys on some skeletons to make necessary adjustments. For instance, parenting the cheek skeletons under SkullPad2 makes them move with the head, but setting driven keys can also enable you to move and scale them slightly with the rotation of the jaw.

  3. Smooth skin bind all the new skeletons, along with the main head and jaw skeletons, to your character's head skin. If your head skin is already bound, add the new skeletons as influences. If rebinding, use the same binding settings you used previously, making sure to Shift-select all the necessary new joints. If you are adding the new skeletons to an already bound and weighted head skin, add each one as an influence with a locked weighting of 0, and add the weighting manually. Transform the eye, jaw, and mouth skeletons to see whether the weighting on the head has been improved. For instance, rotating the main jaw joint should no longer make the whole face collapse (see Figure 5.8). Use the Paint Skin Weights tool and Component Editor to adjust weights if there are still any problems on the skin's deformation.

    5.8. After you assign all the new influences to your character's face, moving the jaw joint should automatically produce a better deformation on the skin.

  4. Although some skeletons, such as the cheek skeletons, may be automatically driven when the jaw rotates, you should create several custom channels on the Head box to manually drive some of the skeletons. Set driven keys to make these channels manually rotate the eyelid skeletons, scale the brow skeletons, scale and translate the cheek skeletons, and scale the lip skeletons. You can also add some curves as influence objects to places where you want to create wrinkles on the skin. You can draw these on the surface of the forehead and on the cheeks to help form smile lines and brow creases. You can also draw influence curves around the eyes and mouth to help adjust the shapes of these areas when they open and close. Parent the influence curves under either SkullPad2 or JawPad2, depending on how they should move, and drive their components with custom channels on the Head box to animate them. Do this by loading their points into the Driven field of the Set Driven Key option box. Alternatively, you can create clusters on the points of the curves and drive the clusters.


Creating Blend Shapes

This section shows you how to create and edit blend shapes to animate facial expressiveness. A blend shape is used to morph between a main shape and any number of target shapes. It is an easy and efficient way to have your character's face deform smoothly from one facial expression to another. Multiple blend shapes can be mixed while animating to produce a wide variety of facial poses. This section also shows you how to correctly combine bound influences and blend shapes on the face skin to produce the best results.

Tips for Making Target Shapes

The most efficient way to create blend shapes is to create separate targets for each expressive area of the face. The two main expressive areas on a face are the area of the eyes and the area of the mouth. The reason you want to separate these facial areas when creating targets, as opposed to making separate targets for the whole face, is to enable you to mix areas of expression during animation. Instead of making an angry face target, and a happy face target, you make an angry eyes target, angry mouth target, happy eyes target, and happy mouth target. You can then mix the targets, combining angry eyes with a happy mouth for instance, to create a maniacal expression (see Figure 5.9). Just do the math to see how this is more efficient. If you create 6 eye shapes and 6 mouth shapes, you have 36 possible combinations of shapes. This is much more efficient than creating 36 target shapes for the whole face, because you only had to create 12 shapes to get the same number of expressions.

5.9. Separating the expressive areas of the face into distinct blend shape targets enables you to mix areas to create new expressions, such as mixing a happy mouth with angry eyes.

The best way to ensure your target shapes work correctly is to create them by duplicating the main head. If your main head is made from multiple surfaces, such as a NURBS patch head, group all the surfaces and duplicate the group to create the targets. Because you will be using only the component information to create the blend shapes, you can transform the target heads away from the main head to make it easier to modify them. You can also scale them if they are taking too much space. In addition, because creating blend shapes only involves animating the components of the main head, it is important to make sure you do not change the basic component structure of the targets. Points on the main head are numbered in a specific way, and the target shapes have to retain the same numbering scheme to create a smooth blend between the shapes. Therefore, you shouldn't add points, delete points, or cut the surface of target shapes. Also avoid making any adjustments to the center pivots, such as moving them in insert mode. Components are registered in relation to the center position, and modifying the center pivots may make your blend shapes shift the main head out of position.

As long as you move points only on your target shapes, your blend shapes should morph smoothly and predictably. You can use any tools or techniques that move only points to do this, such as using the Sculpt Surfaces tool or Surface Editing tool. When modifying each target, avoid moving any points that are not in the expressive area of the face that you are working on for that particular shape. For instance, do not move any points in the eye area if you are working on a mouth shape. When you create the blend shape, Maya copies only the component information that has been modified on the target head to the main head. This enables you to mix the expressive areas of the face without any problems. Finally, when you have finished adjusting all the target shapes, give them short, descriptive names.

Try to create enough target shapes to move each area of the face. The mouth and eye openings should all have shapes that close them. Some basic expressions that you want to create in the mouth and eye areas are: happy, sad, angry, and surprise (see Figure 5.10). In addition, if your character is going to be animated to talk, make a set of shapes for the mouth that will be used for lip-syncing. These should cover shapes for vowel sounds such as A, E, I, O, and U, as well as shapes for consonant sounds such as M, K, L, and V.

5.10. A full set of blend shapes should include basic expressions for each area of the face, such as happy, sad, angry, and surprise mouth shapes.

Assigning Blend Shapes to the Skin

To create blend shapes for your character, you hold down the Shift key to select all the target heads and Shift-select the main head last. If you have multiple surfaces, follow the same procedure with the group node parents. When everything is selected, on the top menu bar choose Deform, Create Blend Shape [image]. In the resulting options box, type a name for the blend shape node. It is often best to put all the shapes for the face on a single node, which makes it easier to mix the shapes together. Leave the envelope weight value at 1 for a full weighting of each shape to the skin.

For head shapes, you also want to set the Origin option to Local, and make sure the In-Between option is checked off. This setup assigns only the component information from the target heads to the main head and creates a separate slider for each target shape so that they can be mixed. Choosing the World option assigns both the component and transform information from the target heads to the main head and causes the main head to shift to wherever each target head is positioned. Turning on the In-Between option creates a single slider that contains all the target shapes in a specific order. Use these options when you need to morph something from one place to another in your scene. For instance, you could position several target models of a bird in various stages of flight in a scene and turn on Global and In-Between to create a slider that makes the bird fly through the scene.

Finally, make sure the Check Topology option is turned on and the Delete Targets option is turned off. You should use the Check Topology option whenever your target shapes are duplicated copies of your main head; this option ensures that Maya creates a predictable morph based on the point-numbering scheme of the target and main head models. Only turn this option off if you are trying to morph objects that were not created with the same structure, such as morphing a human into an animal. Maya then bases the morph on where points are positioned in 3D space, instead of basing it on their numbers. Deleting the targets should be done later, after you make sure all the blend shapes are working correctly. When all the options are set, click the Create button to assign the blend shapes to your main head (see Figure 5.11).

5.11. Set all the blend shape options and click the Create button to assign the blend shapes.

Mixing and Animating Blend Shape Sliders

After you have assigned blend shapes to a character's head, you open the Blend Shape Editor to mix and animate them. Do this by choosing Window, Animation Editors, Blend Shape. Inside the editor, you will see multiple vertical sliders in a horizontal row (see Figure 5.12). The sliders represent target shapes, and the name of each target head displays below each slider. Each slider's limit goes from 0 to 1, with 0 representing no shape, and 1 representing a full shape. Moving several sliders enables you to additively mix shapes together on the main head. For instance, mixing a Close Mouth slider with a Happy Mouth slider creates a closed-mouth smile pose. Experiment with different combinations to see what looks good. If you want to animate specific sliders, move the sliders as needed, and click the Key buttons below the appropriate sliders. To set keys on all the sliders, just click the Key All button to the left of all the sliders. Clicking the Reset All button sets all the sliders back to their original value.

5.12. Open the Blend Shapes Editor to mix blend shapes by manipulating the vertical sliders.

Also keep in mind that each blend shape slider is associated with a channel that exists on the blend shape node. Click the Select button to select the blend shape node, and view the blend shape channels (see Figure 5.13). Because all the channels can be animated, you can later connect controls to your character's blend shapes using expressions, the Connection Editor, or by setting driven keys.

5.13. Click the Select button in the Blend Shape Editor to select the blend shapes node, which displays the blend shape channels in the channel bar.

Editing Blend Shapes

You can adjust the default limits set on the blend shape sliders in a couple of ways. One way is to select the blend shape node by clicking the Select button in the editor, and then setting the weight channel to a value above or below 1. Setting it below 1 causes all the sliders to produce less of a shape, whereas setting it above 1 causes all the sliders to go beyond their target shape. To have more control, however, leave the weight setting at 1, and type values in the fields below each slider to change their individual limits. For instance, with a slider set on 0, type in a value of –1 in the field to reset the minimum limit. Then move the slider to 1, and type in a value of 2 in the field to reset the maximum limit. Then, if you move the slider below 0 or above 1, the points on your character's face continue moving to create extreme face shapes. Sometimes these shapes do not look very good. Sometimes, however, you will get some surprisingly useful new expressions that you didn't even have to create. For instance, setting a slider that closes the mouth to above 1, and other sliders to below 0, can create an unusual mouth pose that was not expected (see Figure 5.14).

5.14. Setting the slider limits above 1 and below 0 can sometimes produce useful new shapes.

You also can edit existing blend shapes by modifying the target shapes. A history connection exists between the target heads and the main head, which updates the main head whenever a target is modified. This is one of the reasons you don't want to delete the target heads when you create your blend shapes.

You can add new blend shapes to a blend shape node in a couple of ways. To add a new target head as a blend shape, select the target and Shift-select the main head, and then choose Deform, Edit Blend Shape, Add [image]. In the resulting options box, you can specify which blend shape node you want to add it to, and where to place it in an in-between or serial slider. For a head with a single blend shape node, leave all the options turned off except the Check Topology option. The other way to add a blend shape is to create a new shape from mixing existing sliders. If you use a combination of sliders a lot, you may want to create a separate slider for that shape. You do this by moving the sliders into place, selecting the main head, and clicking the Add button in the Blend Shape Editor. This creates a new slider and target shape, which you can move to the side or delete. Then you can reset all the sliders, give the new slider a name, and test it to make sure it creates the desired shape. Another use for the Add button is to create in-between sliders for your main target shapes. One problem with blend shapes is that when a slider is at .5, the shape produced may not be entirely accurate. Maya moves points in a straight line from no shape at 0, to a full shape at 1. This is not how the muscles in a real face move, because flexing doesn't always occur in a straight line. To reduce this problem, you could create an in-between shape for each expression. Just set the slider to .5, and click the Add button with the main head selected. Move the new target head to the side, and proceed to adjust the shape to be more accurate (see Figure 5.15). Then to make the shapes occur in the right order, create a custom channel that will drive both blend shape channels. For instance, you first create a Head.smile channel on the Head box that goes from 0 to 10. Then you load the Head box into the Set Driven Key options box as the driver, and click the Select button in the Blend Shape Editor to select the blend shape node, and load it in as driven. You then use driven keys to make the Head.smile channel drive the MouthShapes.halfSmile channel and the MouthShapes.fullSmile channel. Set the keys so the mouth shape goes to a half smile when the driver channel is animated from 0 to 5, and the mouth shape goes to a full smile when the same channel is animated from 5 to 10. Because the two channels are additively mixing, you may also need to set another driven key to reduce the half-smile slider at 10. This gives you a smoother transition between shapes during animation.

5.15. Use the Add button to create in-between shapes for a particular expression. Then drive the half shape and full shape with one custom channel to produce a more natural blend.

Another way to edit your sliders is to reposition the order of the sliders. To swap the order of two sliders, Shift-select the two target heads, and choose Deform, Edit Blend Shape, Swap [image]. Set the option only if you have multiple blend shape nodes on your head and you need to specify the node on which you want to swap sliders. Finally, to remove specific sliders from a blend shape node, select the target head and Shift-select the main head, and choose Deform, Edit Blend Shape, Remove [image]. Set the options if needed, and click Apply and Close. This removes a slider and shifts the rest of the sliders together. To remove all the sliders, and delete the blend shape node, just click the Delete button to the left of all the sliders.

Reordering Deformers

One thing you have to be aware of when assigning both blend shapes and influences to your character's skin is that the order of the deformers makes a difference. In most cases, the skinCluster node should be evaluated after any blend shape nodes. If you bind your character's head first, and then add blend shapes afterward, the nodes are in the wrong order. This wrong order causes the head to shift when you animate the blend shapes on top of the skeleton controls. To avoid this problem, just right-click the skin to choose Inputs, All Inputs to reorder the deformers. This action opens a list that goes from bottom to top, called a stack, with the last thing in the list being at the top. To reorder the deformers, hold down the middle mouse button to drag the skinCluster node below the blend shapes node (see Figure 5.16). Keep in mind that you can only drag downward, not upward, in this list. You must do this on all skins that contain both a skinCluster and blend shape node in the wrong order.

5.16. If your character's head shifts when combining skeleton and blend shape deformations, right-click the skin to reorder the deformers so that the skinCluster node is above the blend shapes node.

Exercise 5.2
Adding Face Blend Shapes

In this exercise, you add some blend shapes for deforming the eye and mouth areas of your bound head. You also make sure the order of deformers is set correctly so that your head skin doesn't shift when animated. Then you use your blend shape sliders to create additional targets for half shapes, and animate them using custom channels.

  1. Duplicate your main head, or a group node parent if your head is composed of multiple patches, and move each target away from the main head so that it is easy to see. Scale all the targets if necessary to make them fit more easily onscreen. Name each target head according to the expression, such as full Smile, fullGrimace, and fullClose. Choose the names so that each target specifies a particular shape for either the mouth area or the eyes area.

  2. Create the blend shape connections between the targets and the main head before you even start making modeling adjustments to the targets. This ensures that the blend shape connection is working right from the beginning. Do this by selecting all the target heads, and then Shift-select the main head last. If you are using grouped multiple patches, select all the group node targets, and Shift-select the main head group last. Then choose Deform, Create Blend Shape [image]. Name the blend shape node FaceShapes, set the Envelope option to 1, and set the Origin option to Local. In-Between should be turned off, Check Topology should be turned on, and Delete Targets should be turned off. Click the Create button to assign the target shapes to your character's main head.

  3. Test your head skin by crouching your character, and then open the Blend Shape Editor to move one of your sliders. If your head shifts back to its default position when you move the slider, you must change the order of the deformers (see Figure 5.17). Do this by right-clicking the head skin, and choose Inputs, All Inputs. In the resulting list, use the middle mouse button to drag the blend shapes node below the skinCluster node. When the order is correct, try moving your character out of its default position again, and then open the Blend Shape Editor to test each slider. You should not see any shifting occur when you move each slider from 0 to 1. If you do, something else happened in the creation of the targets to change their structure so they don't match the main head, and you may have to remake them.

    5.17. If your head shifts when you combine moving your skeletons and blend shape sliders, change the order of deformers on the Inputs of your head skin.

  4. When all the blend shapes are working correctly, start modeling each target face expression by manipulating points. After you have finished the full expressions, use the existing sliders to create in-between expressions. Do this by setting each full expression slider to a .5 value, and then select the main head and click the Add button. Transform the new target as needed, and give them names such as halfSmile, halfGrimace, and halfClose. Move points on the half-shape targets to create natural variations. Then create custom channels on the Head box to drive the sliders to go from no shape to a half shape to a full shape. Set driven keys on the blend shape channels, with your custom channels loaded as the drivers. Each custom expression channel should drive a half-shape channel so that it produces a half shape at .5, and move a corresponding full-shape channel so that it produces a full shape at 1.

COntrolling a Character's Face with a Dummy Head

One technique that you may find useful is to create all your head controls on a separate copy of your character's main head. The main head is assigned only to a head skeleton, so it moves with the body. The copy is then assigned to a separate head skeleton, jaw skeleton, and all the other face deformers. These can include face skeletons, blend shapes, influence curves, and lattices, but the head copy will not move with the character's body. You may even want to create a special camera that only looks at the copy, or dummy head. Finally, to make all the deformations on the dummy head appear on your character's main head, create a single blend shape between the two. Assign the dummy head as the target, and leave the blend shape slider for the dummy head always set to 1. This ensures that all the deformations created on the dummy head are transferred to the main head through a blend shape connection.

This technique separates the body animation from the face animation. You can then animate the body first, with the dummy head hidden on a layer, and animate the face afterward. Using a dummy head makes it easy to find and view the face. You can also hide the character's body to concentrate on only the face animation after you have established the timing of the body animation. Alternatively, you can animate the dummy head in a completely separate scene, and import it later to use as a blend shape target for the main head of your character.


Creating Advanced Face Controls

The face is the most complex area on the human body, and as such, requires some special considerations. To create believable face expressions, you must be able to control all the subtleties created from facial muscles flexing. The problem with using only blend shapes is that there is a moment in the middle of a morph between shapes when the face isn't moving like a real face. Even adding in-between shapes doesn't completely fix this problem. On the other hand, using only influences on the face is both time consuming to pose and can use a lot of system resources. Usually, it is best to use a combination of these two methods to create levels of control over posing the face. The goal is to have a set of high-level controls that create overall face poses, while also having a complete set of low-level controls for making asymmetrical variations in posing for all the areas of the face.

Mimicking the Muscles of the Face

The human face is composed of lots of little muscles that surround each eye and radiate out from the mouth. To create influences that mimic the main face muscles, you must know where the muscles originate, and where they are inserted. The origin point is where the muscle flexes from, while the insertion point is what is moved when the muscle flexes. In a real human body, the insertion point can be on bones, other muscles, or skin. In the face, most of the insertion points are moving either the jaw bone, other muscles, or skin. Using an anatomy book as a guide, try to draw the face-muscle skeletons so that they start at the correct origin points, and end at the correct insertion points (see Figure 5.18). Then to animate the face skeletons, you primarily set keys on the X scaling of each muscle skeleton.

5.18. Use an anatomy book as a guide to draw each muscle skeleton from its correct origin point to its correct insertion point.

No matter how good a job you do of drawing your character's main face-muscle skeletons, when you bind them you will find they do not produce exactly the results you want. They may produce a pretty good result, but to get really good poses in the skin of the face requires that you have even finer controls. One technique you could use to get control over smaller areas of the face is to assign single-joint skeletons to the face. By choosing the Joint tool, you can hold the V key down to snap the joints directly to the face skin. Then press Enter on the keyboard to draw only one joint. You can place as many of these single-joint skeletons on your face as you need. Draw them so that they contour wrinkle lines and in places where the skin needs to be smoothed or compressed during animation (see Figure 5.19). Make sure you place the joints in all the areas of the face.

5.19. Creating single-joint skeletons that are child to the main muscle skeletons is a way to achieve finer control over areas of the face.

Although the main muscle skeletons drive the muscle flexing of the face, they should not be assigned to the skin as deformers. Instead, assign the single-joint skeletons to the face skin. To make sure the single-joint skeletons move when the main muscles are scaled, make each of the single-joint skeletons child to the closest main muscle skeleton. Place a couple of group nodes between each main skeleton and its single-joint children to keep a bunch of bones from being drawn between them, and to make their center orientations more standard for setting driven keys.

Parenting this way enables you to flex large areas of the face by driving the main muscle skeletons and also drive the single-joint skeletons to have finer control over each area of the skin that the main muscles are affecting. Create custom face-muscle channels on an empty group node to drive both the main muscle skeletons and single-joint skeletons in specific areas of the face. Name the channels something descriptive, such as ltInnerBrow, to raise the middle of the brows, and name the group node FaceMuscles. Then create the same muscle channels on the Head box, as well as high-level face expression channels, such as a happy channel. Because you can have multiple drivers for each muscle channel, make low-level and high-level muscle channels on the Head box drive the same channels on the FaceMuscles node (see Figure 5.20). For instance, a happy channel should drive all the muscle channels on the FaceMuscles node that produces this high-level expression, including a lowerLip channel. In addition, a separate lowerLip channel on the Head box should drive the channel with the same name on the FaceMuscles node. In this way, you can create both high-level pose controls and low-level muscle-tweaking controls for your character's face.

5.20. On the Head box, create both high-level pose channels, and low-level muscle channels that drive similar muscle channels on a FaceMuscles node.

Tweaking Skin Deformations with Blend Shapes

The reason you use single-joint skeletons in the preceding section, instead of driving the points of the skin directly, is that skin points are constrained by the skinCluster node. When you try to set driven keys on the points of a bound skin, they often don't move in a predictable manner because of conflicts with the bind. Assigning small sections of the skin to single-joint skeletons is a way to get around this problem and thus improve the deformations created by the main muscle skeletons. Another way to improve the deformation created by the main muscle skeletons is to use skeletons to drive blend shape tweaks on the skin.

Unlike the preceding technique, the main muscle skeletons should be bound and weighted to the head skin. You also should create some custom channels to drive the X scaling of multiple muscle skeletons to create basic flexing on the face skin. Then you want to use blend shapes to improve the muscle skeleton deformations for each area of the face. When using a leftSmile channel to drive muscle skeletons to create a smile on one side of the mouth, for example, there may be problems with forming a good smile line and dimple (see Figure 5.21). So you want to use a blend shape to tweak the main skin deformation to create these details.

5.21. Even though you can use skeletons to make part of the face flex, you may need to tweak the deformation with a blend shape to create details such as a good smile line and dimple.

To create the blend shape, first duplicate the main head in its default position, but don't move it anywhere. Make sure you unlock its channels by right-clicking them in the channel bar, and then choosing Unlock Selected. Then delete all history on the new head copy, and bind it to the face-muscle skeletons in the exact same way you bound the main head. To make sure they both deform in the same way, copy the weights of the main head to the copied head by selecting the main head, shift-selecting the copy, and choosing Skin, Edit Smooth Skin, Copy Skin Weights. When they are deforming exactly the same, hide the main head so that you can see only the copy, and set your muscle channel that controls one side of the face to create a smile. At this point, you want to create tweaks on the head copy to create a good smile line and dimple, but you run into the same problems as previously mentioned about moving points on a bound skin.

To be able to tweak your bound head copy without interference from the skinCluster node, you must reorder the deformers. Right-click the copy, and choose Inputs, All Inputs. In the resulting list, notice that because the skinCluster node is at the top of the list, it is evaluated last on the skin. You must change this order to be able to create tweaks on the skin in addition to the deformations that occur from the bind. Do this by just using the middle mouse button to drag the skinCluster node below the tweak node. Then move points to create a good pose for the smile line and dimple (see Figure 5.22).

5.22. Reorder the skinCluster and tweak nodes to be able to model a good smile line and dimple on the bound copy of your head.

After you have tweaked the shape of the copy so that it looks good, set the muscle channel to 0 to set it back to the default pose. This time, however, the area that was tweaked on the copy retains the changes because they were done on top of the skeleton deformations. With the muscle skeletons in their default position, entirely remove the bind from the head copy, which makes it ready to be used as a blend shape tweak target. Move the tweak head out to the side so that it isn't obscuring your main head. Then unhide the main head, and create a blend shape between the main head and the tweak head. This process creates a blend shape node that has a channel for the tweak. Finally, hide the tweak head, and set driven keys on the blend shape tweak channel using the same muscle channel that is driving the muscle skeletons. You should drive the blend shape tweak channel so that raising the muscle channel should raise the tweak channel from 0 to 1. This should create the desired pose using a blend shape to tweak the skeleton deformations.

You can create as many of these muscle tweaks as needed, adding each one to the same blend shape node. You can also drive the blend shapes with the skeleton rotations directly, instead of using the muscle channels as drivers. Either way, using this technique enables you to create fine controls for each area of the face. Create multiple channel drivers as mentioned previously to create a full set of high-level and low-level pose controls. In addition, you can use this technique in other parts of your character's body to improve skeleton deformations. For instance, you can use it on an arm to remove intersection problems and create muscle flexing when the arm bends (see Figure 5.23). You can also use it to improve the lower-arm deformation when the forearm twists. In most cases, you want to drive such blend shape tweak channels to occur automatically when the skeleton joints rotate.

5.23. You also can use blend shape tweaks in other areas of your character's body to automatically improve and enhance skeleton deformations.

Exercise 5.3
Create High-Level and Low-Level Face Controls

In this exercise, finish creating your face controls as needed by adding more accurate muscle joints, single-joint skeletons, or blend shape tweaks. Then create custom channels that produce both high-level face poses, and low-level asymmetrical variations in the mouth and eye areas.

  1. Finish your character's face controls by adding some muscle skeletons to the head skin. Either do this by assigning single-joint skeletons that are child to the main muscle skeletons of the face, or assign the main muscle skeletons directly, and adjust their effect on the skin with blend shape tweaks. The ultimate goal is to have detailed control over the flexing in each area of the face. When you have all your controls, you can create high-level and low-level channels to drive them.

  2. Create an empty node or locator named FaceMuscles that is child to the Head box. Create as many low-level muscle channels as needed on the node, and set driven keys for each muscle area of the face. Give descriptive names to the low-level muscle channels, such as rightMouthUp, right Mouth Side, and MidUpLipUp. Make sure the channels drive relatively small areas on each area of the face, so it can be posed asymmetrically. Make each channel drive several skeleton joints and blend shapes simultaneously to flex a specific face area.

  3. Create the same low-level muscle channels on the Head box that you created on the FaceMuscles node. Make the low-level channels on the Head box drive the low-level FaceMuscles channels with the same names. Then create a full set of high-level face channels on the Head box that drive multiple FaceMuscles channels. Use the high-level controls to create the initial expressive poses for the entire face. Use the low-level controls to make adjustments to the high-level poses to make the face expressions more asymmetrical. This makes your character's face appear more natural and organic when it is animating (see Figure 5.24).

    5.24. Animating with your high-level and low-level controls enables you to quickly create asymmetrical face poses that look natural.


Wrapping It Up

The techniques described in this chapter should give you several approaches to creating a full set of animation controls for your character's face. Because there is no one right way of doing this, the methods you use are up to you and depend on the expressive needs of your character. When all the parts of your character are fully bound and weighted, your character controls are almost complete. The last step in setting up your character is to create a MEL-scripted interface for your character controls. Many animators consider using MEL controls as the easiest and most efficient way to animate a character. In the next chapter, you learn how to create a full-featured set of these controls.


Chapter 6. Scripting MEL Character Controls

This chapter shows you how to create MEL-scripted character controls. MEL, or Maya Embedded Language, is the scripting language that creates the entire Maya interface. MEL scripting enables you to create a custom graphical user interface for animating your character. This is usually in the form of a floating window that contains a variety of character controls (see Figure 6.1). Inside the window, you create buttons that select various parts of your character, sliders that are connected to attributes on your character, and check boxes that turn on or off the visibility of your character's skin.

6.1. MEL-scripted character windows contain a variety of useful controls for animating a character, such as buttons, check boxes, and sliders.

A MEL-scripted interface provides several advantages when animating your character. Such an interface is very intuitive to use, because all the controls can be clearly labeled, and written directions for their use can be included in the window. An animator doesn't have to remember whether a particular icon should be translated, rotated, or scaled, because all those specifications are inherently present in the MEL controls. In addition, because all the necessary limits are set into each MEL-scripted control, it is very difficult to break the rig when animating. In many cases, a character setup artist removes most of the normal menus and tools in Maya, and provides the animator with only what the animator requires to animate the character in the MEL-scripted window.

Another advantage of using a MEL interface is that it is generally faster to pose and set keys on your character with MEL controls than it is by keying iconic controls. The reason for this is that, when animating, it takes time to select your iconic controls, and it also takes time to change your active Transform tool. You can create a pose for your character by moving MEL sliders without having to select anything, and without having to change tools. To set a key on all of your character controls, you just have to click a single button.

One thing to keep in mind when using MEL is that it differs from other methods previously shown for controlling attributes. Unlike connecting channels, MEL controls do not constrain attributes in any way. When you assign a MEL slider to control an attribute on your character, for instance, the channel for the attribute does not turn yellow. The reason for this is that MEL controls are just an interface. They are not themselves an attribute that can be keyframed. When you set a key on a MEL control, it sets the key on the attribute it is controlling, not on the slider or button itself. The end result of this is that you can use both iconic and MEL controls on a character without them interfering with each other. Then the animator can choose to use one kind of control, or the other, or both.

Although most of this chapter focuses on creating a MEL-scripted interface for animating your character, additional uses of MEL scripting are presented toward the end of the chapter. You can use MEL scripting for a variety of purposes in Maya. More advanced uses, such as procedures and scripts that contain conditional statements, loops, and script jobs, are introduced.


Basic MEL Controls

This section shows you how to use MEL scripting to create a basic character window. How to write a MEL command in the Script Editor is described in detail, as well as where you can store and access your MEL code in Maya. You learn how to create several useful controls for your character, including buttons, sliders, and check boxes. In addition, you learn several layout commands that enable you to place your MEL controls in a variety of positions within your character window.

Getting Started with MEL

MEL scripting facilitates everything you do in Maya. Whenever you create, modify, or transform something using menu commands or tools, Maya is performing the action through MEL commands in the background. Normally you don't see this happening, although you may occasionally notice some MEL results that Maya writes out to the Feedback field of the command line. To see what Maya is doing, you must open the Script Editor by clicking its icon in the lower-right corner of the interface, and look in the History field (see Figure 6.2).

6.2. Use the gray History field in the Script Editor to view MEL commands that occur while you are working in the Maya interface.

The Script Editor contains two fields. The top, gray-colored section is the History field, and the bottom, white-colored section is the Scripting field. The History field is where you can see what MEL code Maya is running when you do something in the interface. In a blank scene, for example, create a primitive NURBS sphere by choosing Create, NURBS, Sphere. Notice that a line of code is written to the History field that looks like this:

sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -r 1
-d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1;

This is the MEL command that Maya uses to create a NURBS sphere. The command itself is sphere, followed by several letters preceded by dashes, called flags, and ending in a semicolon. The flags are setting the options on the sphere command, which you normally specify when working in the interface within an options box. For instance, the -p flag is specifying the sphere's pivot-point placement. The three numbers after the flag represent the translation values of the sphere in 3D space, so that 0, 0, 0 specifies placement at the global origin. The -ax flag sets the axis of the sphere to point up in Y. In addition, the -ssw flag sets the start sweep of the sphere to 0 degrees, and the –esw flag sets the end sweep to 360 degrees, which creates a full sphere. If the -esw flag were set to 180 degrees, only half a sphere would be created. Some flags require numeric values, whereas some are switches that are set either on or off, and others require a string of text.

With the sphere still selected, type a value of 5 into its Y translation channel. A line of MEL code should be written in the History field that looks like this:

setAttr "nurbsSphere1.translateY" 5;

The setAttr MEL command sets an attribute to a particular value. Notice that the syntax of the command is written as all lowercase letters, except the first letter of the second word, which is capitalized. This is true of all MEL commands. They always start lowercase, with the first letter of each additional word being capitalized, and no spaces between the words in the name of the command. If there were a MEL command named My Big Command, for instance, it would be written as myBig Command. Keep this in mind when you are writing MEL code, because any mistake in the capitalization results in an error message.

The History field proves an invaluable resource to find out what MEL commands are used by Maya to do specific tasks. To actually input a MEL command, you must type it in the command line, or type it in the Scripting field inside the Script Editor. The command line is mainly used to input a single command, whereas the Scripting field is used for typing in multiple commands. In the Script Editor, the regular Enter key on the keyboard enables you to create multiple lines of code, whereas pressing the Enter key on the numeric keypad actually runs all the commands. As an example, highlight the setAttr command that occurred earlier in the History field for moving the sphere in Y, and hold down the middle mouse button to drag it down into the Expression field. When the line of code is in the Scripting field, change the Y value in the line of code. Also highlight the line of code to copy it by pressing Ctrl+C, press the regular Enter key to go to the next line, and paste the code by pressing Ctrl+V. Change the second line of code to specify a translation value in X, rather than Y. Your two lines of MEL code should look similar to this:

setAttr "nurbsSphere1.translateY" -3;
setAttr "nurbsSphere1.translateX" 10;

When your two lines of code are complete, press the Enter key on the numeric keypad to run it (you can also press Ctrl +Enter). If the code contains no errors, it passes from the Scripting field to the History field, and the sphere should move in Y and X to whatever values you specified in your two setAttr commands.

Many times when researching MEL commands in the History field, you won't know what a particular flag means. A MEL command named help gives you more information on any MEL command. Just type in help, followed by the name of the MEL command. To get help on the sphere command, for instance, type the following in the Script Editor:

help sphere;

Running this code results in a summary of the sphere command in the History field that looks like this:

Synopsis:  sphere  [flags]  [String...]
Flags:
   -e -edit
   -q -query
  -ax -axis                       Length Length Length
 -cch -caching                    on|off
  -ch -constructionHistory       on|off
   -d -degree                     Int
 -esw -endSweep                   Angle
  -hr -heightRatio                Float
   -n -name                        String
 -nds -nodeState                  Int
 -nsp -spans                       Int
   -o -object                      on|off
   -p -pivot                       Length Length Length
  -po -polygon                     Int
   -r -radius                      Length
   -s -sections                    Int
 -ssw -startSweep                  Angle
 -tol -tolerance                   Length
  -ut -useTolerance                on|off

All the flags for the sphere command are listed, including their long and short names, as well as some clues as to how each flag should be set. The -d or -degree, for instance, requires an integer or whole number. The -n or -name flag, on the other hand, requires a text string in double quotes. The -o or -object flag is a Boolean type of on or off switch, which can be written as true or false.

If a command is pretty simple, like the sphere command, the basic help command may be adequate for understanding how to use it. However, you may require more information to effectively use some commands. To get more information about a command, you can use a flag on the help command. To get more detailed information on the setAttr command, for example, type the following:

help –doc setAttr;

Running this code opens an Internet Explorer web page with detailed information on the setAttr command. An explanation on how to use the command is given, as are additional details about each flag. One of the most important things on this page is the example code at the bottom of the page. You can copy and paste the code into the Script Editor to run it, and view a simple example of what the command does. This is a good way to start using a command. Many times you can modify the code given in the example by just adding your own content to customize it for your own purposes. Another useful thing at the bottom of the page is a list of commands related to the setAttr command.

One thing you may have noticed is that some of the basic tasks you do while working in the Maya interface do not produce any MEL commands in the History field. Changing tools, for instance, does not produce any MEL code. To force Maya to write the code for these tasks to the History field, on the Script Editor's menu bar, you must choose Script, Echo All Commands. This causes Maya to write everything it does to the History field. Changing tools, for instance, produces the changeToolIcon command in the History field when Echo All Commands is turned on. Echoing all the commands should only be turned on when you need it, however. Doing regular tasks, such as creating a sphere, produces several more lines of code than previously produced. While working in a complex scene, forcing Maya to write everything to the History field will considerably slow down your system, so it is best to keep Echo All Commands turned off most of the time.

Also in the Script menu, make sure Show Line Numbers is turned on. This is useful for when you are debugging multiple lines of MEL code. If you receive an error message when trying to run your code, Maya writes to the History field what line number the error is on. Then you can count down to more quickly identify the error, and correct it.

One other way you can get help on MEL commands is to use the MEL Command Reference. Access this on the top menu bar by choosing Help, MEL Command Reference. This opens an Internet Explorer page that contains all the available MEL commands in Maya. The commands are grouped alphabetically by name, by category, and as a complete list. If you click the letter S link, you will see all the MEL commands that begin with an S. Clicking the setAttr command brings you to the same page that opened when you previously typed in the command help -doc setAttr. Go back to the previous page, and scroll down to view all the categories of MEL commands, such as Animation, NURBS, and Windows. Clicking the NURBS link, for instance, brings you to a page that lists all the MEL commands that relate to NURBS surfaces. Using categories is a good way to see whether Maya has a particular MEL command for doing a specific kind of task. If you can't find a MEL command for a particular task, chances are you can't do it in Maya at all, or it can only be done through more complicated programming.

Sometimes code for which you cannot get any documentation appears in the History field. For instance, try looking up the changeToolIcon command that came up earlier when you turned on Echo All Commands. You won't find this command listed anywhere in the MEL Command Reference. To find information on this command, you must use the whatIs MEL command. Type the following into the Scripting field:

whatIs changeToolIcon;

The whatIs command returns either the word Command, for a MEL command, or it tells you it is something else, and where the script is located. The output of the preceding command states that the changeToolIcon command is a procedure found in the Scripts folder that Maya runs when the program is launched. This illustrates an important point to remember when working in the Script Editor; everything in Maya is not done strictly through MEL commands. Hundreds of other scripts are being used in addition to the standard MEL commands. The whatIs command can help you to track down these other scripts, so that you can open them to find out how they work.

Scripting a Simple Control Window

To begin creating your MEL-scripted character controls, you must first create a floating window to hold all the controls. You must use two commands to make a custom character window. The command for creating a window is window, and the command for actually displaying the window in the Maya interface is showWindow. If you look up the window command in the MEL Command Reference, you can see all the flags you can add to the command. Some useful flags are -t or-title to give the window a name on the title bar, and -wh or-widthHeight to set the size of the window. Type the following into the Scripting field:

window –title "My Window" –widthHeight 300 200;
showWindow;

Running this code should create a 300-by-200 pixels floating window with My Window on the title bar (see Figure 6.3). You can move, minimize, and scale your custom window just like any other floating window in Maya. Close the window by clicking the close icon on its title bar.

6.3. You must first create a basic window before you can create any other MEL-scripted character controls.

Notice that the code you wrote for the window passed from the Scripting field to the History field in the Script Editor. This is fine if you are only typing in a command once. If you are gradually refining and testing the code, however, there is a more efficient way to run the code. Just highlight the code in the Scripting field that you want to run, and press the Enter key on the numeric keypad. This keeps the code from passing out of the Scripting field. Use this technique as you gradually add controls to your custom window.

Adding Buttons and Sliders

To add some controls to your window, make sure you copy the window commands you ran earlier from the History field back into the Scripting field. Also rename the sphere in your scene from its default name to a simple name such as Sphere. Keep in mind that all the lines of code you add for the controls should be written between the window and showWindow commands.

Before adding controls to a window, you must tell Maya how you want the controls to be placed. This is called a layout command, the simplest one being columnLayout, which stacks the controls vertically, flush left, in a single column. After the columnLayout command, you can start placing some controls, which will be buttons. The command for creating a button is just button, and there are a few important flags that you should include with the command. These include the -l or-label flag, which is used to display a name on the button, the -w or -width flag to set the size, and the -c or -command flag to make the button run a command. Buttons are best used for doing one particular thing, such as selecting an object. To find out what MEL command to use for selecting the sphere, just do it and look in the History field. To make the select command work in the button, you must put double quotes around the entire command. To make a button that selects the sphere, for example, type the following into the Scripting field:

window –title "My Window" –widthHeight 300 200;
columnLayout;
button –label "Select" –width 100 –command "select –r Sphere";
showWindow;

Note

MEL Syntax in Maya 5: When writing MEL code, you can use the regular Enter key to break the code up into multiple lines, and use the Tab key to indent in order to make the code easier to read. Maya reads the code as one command until it reaches a semicolon. However, in Maya 5, if you break a text string into multiple lines, you will get an unterminated string error message. A text string is a line of code within double quotes, such as in the "Select" button command after the -c flag. In most cases, avoid breaking a string into multiple lines.

If you must break a string into multiple lines, use a \ symbol at the end of the broken line to keep from getting an error message. Keep in mind that in the script examples shown in this chapter, continuous lines of code that are wrapped to the next line due to formatting are symbolized by a bold arrow. These should be written in Maya as one line, and do not require the \ symbol.

All the correctly written MEL code for the examples in this chapter can be found on the download site, which can be opened in a text editor, and copied directly into your script editor for testing.

Running this MEL code should create a window with a single Select button that selects the sphere when you press it. After you have one button made, it is easy to make additional buttons by just copying and pasting. Copy and paste to create an Unselect button, and drag a selection box in an empty area of the perspective view to clear the selection. Use the History field to get the command for unselecting the sphere, which should be a select command with a -cl or -clear flag. Copy the command from the History Editor to the -c flag of the new button command. Your code should look like this:

window –title "My Window" –widthHeight 300 200;
columnLayout;
button –label "Select" –width 100 –command "select –r Sphere";
button –label "Unselect" –width 100 –command "select -cl";
showWindow;

After running the code, test both buttons to see how they work (see Figure 6.4). You may also want to look up in the MEL Command Reference the command for selecting objects, and make a note of the other flags available for this command. There is a flag, for instance, that enables you to toggle the selection. By being familiar with the available flags for a command, you will be able to customize your controls for exactly what you need them to do.

6.4. Place basic selection buttons as the first controls in your custom MEL window.

The second MEL control you want to add to your window is a basic slider. Sliders are best used for animating attributes smoothly over time. The command for creating a basic slider is attrFieldSliderGrp. The -l or -label flag also applies to this control, as do the -min and -max or the minValue and maxValue flags to set the minimum and maximum limits of the slider, the -cal or columnAlign flag, which sets the label flush left, and the -at or -attribute flag to connect the slider to an attribute. To create a slider that makes the sphere move up and down, specify Sphere.ty in the -at flag. Double quotes are not needed to specify an attribute. Notice in the example that you can also use the short version of the channel names in your MEL commands. Your MEL code should look like the following:

window –title "My Window" –widthHeight 300 200;
columnLayout;
button –label "Select" –width 100 –command "select –r Sphere";
button –label "Unselect" –width 100 –command "select -cl";
attrFieldSliderGrp –label "Move Sphere Up and Down"
      –minValue –20 –maxValue 20 –columnAlign 1 left –attribute Sphere.ty;
showWindow;

Running this code should create a slider that translates the sphere up and down 20 grid units in Y. To make another slider control the movement of the sphere from side to side, copy and paste the first slider, and just change the name and attribute. Notice that when setting the limits on sliders, there is a minimum and maximum setting, but not a default setting. This is because MEL sliders are not constraining the object, but just an interface for accessing the attributes of the objects. The default setting for an attribute is whatever the channel is already set to. If you select the sphere and translate it in Y manually with the Translate tool, the slider updates accordingly. Notice that the object can actually be moved beyond the slider limits. You can also set keys on the slider by right-clicking its label and choosing Set Key, but the keys are not set on the slider. The keys actually go directly on the attribute the slider is controlling.

One other thing you might want to do is make the buttons and sliders scale with the window size. Do this by adding an -adj or -adjustableColumn flag to the columnLayout command. In addition, add an -adj flag to each of the attrFieldSliderGrp commands. Your MEL code should look like this:

window –title "My Window" –widthHeight 300 200;
columnLayout -adjustableColumn true;
button –label "Select" –width 100 –command "select –r Sphere";
button –label "Unselect" –width 100 –command "select -cl";
attrFieldSliderGrp –label "Move Sphere Up and Down"
      –minValue –20 –maxValue 20 –columnAlign 1 left
      -adjustableColumn true –attribute Sphere.ty;
attrFieldSliderGrp –l "Move Sphere Side to Side"
      –minValue –20 –maxValue 20 –columnAlign 1 left
      -adjustableColumn true –attribute Sphere.tx;
showWindow;

After you have run this code, try resizing the window by dragging one of its edges. The buttons and sliders should scale with the window (see Figure 6.5). Although the buttons scale completely with the window, there are limits on how a slider can stretch. Because of the set width of the slider itself, it only moves in relation to the text label, instead of actually scaling larger or smaller.

6.5. Set command flags to make your basic buttons and attribute sliders scale with your window.

Where to Store Your MEL Code

Until this point, you have just been using the Script Editor to work on your MEL code. This gives you the advantage of having access to the History field for copying commands and reading error messages. You can save your MEL code in the Script Editor by highlighting the code and choosing File, Save Selected. However, saving MEL code as a MEL script in the Script Editor is usually reserved for more complicated scripts. If you are just writing a few lines of code to create a control window, you can store the code in other places for easy access. One place that you have already used in previous chapters is the shelf. Highlighting the code in the Script Editor and using the middle mouse button to drag it onto the shelf is an easy way to store your code. Doing this creates a shelf button that you can click to run the MEL code, and open your control window.

To edit MEL code placed on the shelf, click the drop-down arrow button to the left of the shelf, and choose Shelf Editor. Inside the editor, choose the Shelves tab to pick the shelf that contains your MEL code, and then go to the Shelf Contents tab to pick the button to edit. If you drag the code written previously for controlling a sphere to the shelf, for example, choose the code in the list that starts with a window command. Type in a more descriptive label, such as "This opens my sphere control window," that will show up if you place your cursor over the button. Also give the button a short icon name, such as Win1. As an option, you could click the Change Image button to assign a custom image to your button. Create the image in a paint program, such as Photoshop, and save it as a 35-by-35 pixels bitmap image. Make sure you place the image in the Icons folder with all the other Maya icons so that it will be there when you click the Change Image button. To edit the MEL code in your custom button, with it highlighted in the shelf editor, choose the Edit Commands tab. Add code as needed to create additional controls, and click the Save All Shelves button.

A similar way to store, edit, and access your MEL code is to assign it to a hotkey. Open the Hotkey Editor by choosing Window, Settings/Preferences, Hotkeys (see Figure 6.6). Click the New button to create a new hotkey. Then type in a name, short description, and make sure the category is set to User. Place your MEL code in the hotkey by dragging it with the middle mouse button to the Command field. When you are done, click the Accept button. This creates the contents of the hotkey, but doesn't assign it to a particular key. You must first query a key to see whether anything is already assigned to it. Try typing in F7 to the Key field, and click Query. Chances are this key has not been assigned to anything. To assign it, just click the Assign button with the Press Direction turned on. If F7 is already assigned to something, try adding a Ctrl or Alt modifier. When the key is assigned, click the Save button, and close the Hotkey Editor. Then activate one of the views, and press your new hotkey to open your control window.

6.6. Copy your MEL code into the Hotkey Editor to assign it to open your window when you press a hotkey.

A third place to store, edit, and access your MEL code is in a marking menu. Marking menus can be called up by holding down a key while pressing a mouse button and moving the cursor. The most common example of this is to hold down the Spacebar to access menus in the hotbox. Open the Marking Menu Editor by choosing Window, Settings/Preferences, Marking Menus. Click the Create Marking Menu button, and use the middle mouse button to drag your MEL code over one of the empty boxes. A MEL button will appear in the window, which you can right-click to edit the label or image. When your MEL code is in the window, give the marking menu a name, and click the Save button. The name you gave your new menu should come up in the Marking Menu Editor list. You must then assign the new marking menu to either a hotkey or to the hotbox. Try assigning it to a space in the hotbox by choosing Hotbox in the Settings drop-down list. Set the Region to Center, and the Button to Left. Click the Apply Settings buttons, and close the Marking Menu Editor. To run your code, just hold the Spacebar down and click with your left mouse button on the middle of the Hotbox menus. The name for your menu should appear. Just drag your cursor over it to open your control window. Clicking the same region with the middle or right mouse button gives you access to a different menu.

Keep in mind that all these methods shown for storing your MEL code are limited to your local machine. Code being stored on a shelf, in a hotkey, or in a marking menu is being stored with the rest of your preferences in a Maya directory created for your login on the C: drive. It is not being stored with your character scene file that you have been building, so it won't be available if you open your character on a different computer. You would have to copy those preferences files over to the same directories on the other machine to use your MEL character controls. Or, to save MEL code with a particular scene file, you must create a script node in the Expression Editor.

Open the Expression Editor, and choose Select Filters, Script Node. First type a name for your script node. Then just use the middle mouse button to drag your MEL code into the white Scripting field, and click the Create button. You should see the name of your script node come up in the list of script nodes (see Figure 6.7). After your MEL code has been stored in a script node, it will be saved with your scene file. Click the Test Script button to run your MEL code and open your control window. Keep in mind that if you make any changes or additions to your MEL code, it is not enough to just click the Test Script button. You must also click the Edit button to have the changes saved into the script node. Otherwise, you may lose all of your edits when you open your scene file later.

6.7. Creating a script node in the Expression Editor enables you to save your MEL-scripted window with your scene, so it is always available.

Exercise 6.1
Create a Basic Character Window

In this exercise, you create a simple character control window. The controls, consisting of selection buttons and attribute sliders, are stacked vertically in the window using column layout. Make sure you first open your character scene so that you won't get any error messages when you test your MEL controls.

  1. Click the New Script Node button in the Expression Editor, and begin creating your MEL controls by typing a window command with the title "Character Controls" that is 400 pixels wide and 600 pixels high. Then add selection buttons for many of the main parts of your character, starting with the arm, leg, elbow, and knee controls. Make sure you write the correct name for each object in the -c flag of each button command. Use the columnLayout command to stack the buttons vertically, and turn on the adjustable flag to make them resize with the window. To make your code more compact, try using the short name versions for common flags. Your MEL code should look similar to this:

    window -t "Character Controls" –wh 400 600;
columnLayout –adj true;
button -l "Left Arm" -c "select -r LtArm";
button -l "Right Arm" -c "select -r RtArm";
button -l "Left Leg" -c "select -r LtLeg";
button -l "Right Leg" -c "select -r RtLeg";
button -l "Left Elbow" -c "select -r LtElbow";
button -l "Right Elbow" -c "select -r RtElbow";
button -l "Left Knee" -c "select -r LtKnee";
button -l "Right Knee" -c "select -r RtKnee";
showWindow;

    Name the script node MyControls, and click the Create button. Then run the code by clicking the Test Script button. Click each of your selection buttons to check that they work correctly. If you get any error messages, check to make sure the names in your code are correct. When finished, close your character control window.

  2. Next, add some sliders to the window for controlling attributes on your character rig. At first, make sliders for all the main parts of your character, such as the torso, back, head, and hips. Make sure you label each slider, and set the limits to what is appropriate for each attribute. The torso crouch slider, for instance, should mainly have negative values, because it should only move downward. Keep in mind that the values for your character may differ from the values in the example code. Also set your sliders to adjust with the window size by using the -adj flag. Your MEL slider code should look similar to the following:

window -t "Character Controls" –wh 400 600;
columnLayout –adj true;
button -l "Left Arm" -c "select -r LtArm";
button -l "Right Arm" -c "select -r RtArm";
button -l "Left Leg" -c "select -r LtLeg";
button -l "Right Leg" -c "select -r RtLeg";
button -l "Left Elbow" -c "select -r LtElbow";
button -l "Right Elbow" -c "select -r RtElbow";
button -l "Left Knee" -c "select -r LtKnee";
button -l "Right Knee" -c "select -r RtKnee";
attrFieldSliderGrp -l "Torso Crouch"-min -10 -max 1 –cal 1 left
  –adj true -at UpperBody.ty;
attrFieldSliderGrp -l "Torso Move Side"-min -7 -max 7 –cal 1
  left –adj true -at UpperBody.tx;
attrFieldSliderGrp -l "Torso Move Front"-min -7 -max 7 –cal 1
  left –adj true -at UpperBody.tz;
attrFieldSliderGrp -l "Torso Rotate Side"-min -35 -max 35 –cal 1
  left –adj true -at UpperBody.rz;
attrFieldSliderGrp -l "Torso Rotate Front"-min -35 -max 35 –cal
  1 left –adj true -at UpperBody.rx;
attrFieldSliderGrp -l "Hip Swing"-min -45 -max 45 –cal 1 left
  –adj true -at Hips.rz;
attrFieldSliderGrp -l "Hip Twist"-min -55 -max 55 –cal 1 left
  –adj true -at Hips.ry;
attrFieldSliderGrp -l "Hip Thrust"-min -35 -max 35 –cal 1 left
  –adj true -at Hips.rx;
attrFieldSliderGrp -l "Back Bend Side"-min -45 -max 45 –cal 1
  left –adj true -at BackBend.rz;
attrFieldSliderGrp -l "Back Bow"-min -25 -max 55 –cal 1 left
  –adj true -at BackBow.rx;
attrFieldSliderGrp -l "Back Twist"-min -55 -max 55 –cal 1 left
  –adj true -at UpperBack.ry;
attrFieldSliderGrp -l "Shoulders Shrug"-min -2 -max 4 –cal 1
  left –adj true –at Shoulders.ty;
attrFieldSliderGrp -l "Left Shrug"-min -2 -max 10 –cal 1 left
  –adj true –at Shoulders.ltShoulder;
attrFieldSliderGrp -l "Right Shrug"-min -2 -max 10 –cal 1 left
  –adj true –at Shoulders.rtShoulder;
attrFieldSliderGrp -l "Head Nod"-min -50 -max 50 –cal 1 left
  –adj true –at Head.rx;
attrFieldSliderGrp -l "Head Shake"-min -40 -max 40 –cal 1 left
  –adj true –at Head.rz;
attrFieldSliderGrp -l "Head Twist"-min -60 -max 60 –cal 1 left
  –adj true –at Head.ry;
attrFieldSliderGrp -l "Head Shift Front"-min -10 -max 10 –cal 1
  left –adj true –at Head.neckTilt;
attrFieldSliderGrp -l "Head Shift Side"-min -10 -max 10 –cal 1
  left –adj true –at Head.neckBend;
showWindow;

    When you have added some sliders, click the Edit button, and then click the Test Script button (see Figure 6.8). Move each slider to test its limits. Edit the code as needed, and retest the sliders. After the sliders are working well, add other sliders for the hands, jaw, and even face-shape sliders. You can create sliders for any control on your rig that has an attribute, including custom attributes you added manually, and attributes on the blend shape node.

    6.8. Create a basic character window that contains vertically stacked selection buttons and attribute sliders for controlling all the main parts of your character.

Other Useful Controls

When writing your MEL code, it is a good idea to add comments to remind yourself, or anyone else who may use your code, what the script does. A comment is a text string that Maya does not run as part of the code. In MEL, lines in a script can be commented out by placing two forward slashes (//) in front of each line. For instance, you may add comments at the beginning stating who wrote the script, and describing the purpose of the script. You can also add comments throughout the script to describe how each section works. Here is an example of adding comments at the beginning of your script:

//This MEL script by Chris Maraffi creates a basic character window:
window -t "Character Controls" –wh 400 600;
columnLayout –adj true;
//This section creates selection buttons:
button -l "Left Arm" -c "select -r LtArm";
button -l "Right Arm" -c "select -r RtArm";
button -l "Left Leg" -c "select -r LtLeg";
button -l "Right Leg" -c "select -r RtLeg";

In addition to commenting out a whole line, you can comment out specific sections of text by surrounding it with an asterisk (*) and forward slash (/), as follows:

Your MEL code /*comments*/ Your MEL code

You may also want to display some text in your control window to give the user some additional headings or instructions for how to use the controls. You can do this by using a MEL text command. The main flag to use with this command is a -l or -label flag, where you can specify the text that you want to display by placing it in double quotes. Other flags you may want to use are the -al or -align flag, -w or -width flag, and -fn or -font flag. Here is an example of using a text command to create a heading for the buttons in your script:

window -t "Character Controls" –wh 400 600;
columnLayout –adj true;
//This section creates selection buttons:
text –l "Selection Buttons:" -align left -w 400 - font "boldLabelFont";
button -l "Left Arm" -c "select -r LtArm";

One way to make your control window more organized is to add separators. A separator is a graphic line that can delineate sections of your window for specific controls. The main flag to use is the -w or -width flag to set how much space in the window the separator will take. Other flags you may want to use are the -st or -style flag, and the -hr or -horizontal flag. These flags set the graphic style of the separator, and set whether the separator should be horizontal or vertical. Here is an example of how you could add separators between your controls in a column layout:

button -l "Left Arm" -c "select -r LtArm";
separator –width 400 –style "double" – horizontal 1;
attrFieldSliderGrp -l "Torso Crouch"-min -10 -max 1 –cal 1 left –adj true -at UpperBody.
  ty;
separator –width 400 –style "double" – horizontal 1;
attrFieldSliderGrp -l "Hip Swing"-min -45 -max 45 –cal 1 left –adj true -at Hips.rz;
separator –width 400 –style "double" – horizontal 1;

Another control you will want to add to your character window is a Boolean style on-off switch. The best MEL command for doing this is the checkBox command. You can use a check box to turn the visibility of objects on or off, or to control whether an IK solver is on or off. Another use is to toggle switches in the interface, such as turning the Auto Keyframe button on or off. The two flags that make the check Box command work are the -onc or -onCommand, and -ofc or -offCommand. These two flags run separate commands when the check box is clicked on or clicked off. You should also use the -l or -label flag, and the -al or -align flag in the command. To create a check box for hiding your character's skin, for instance, you should set it to control the visibility of the group node parent of your models. Do this by using a setAttr command to set the Skin.visibility channel to either 1 or 0. Place the command at the beginning of your character window script, right after the layout command, and before the selection button commands. Your final checkBox command should look similar to this:

checkBox –label "Hide Skin" –align left –onCommand
"setAttr Skin.v 0" –offCommand "setAttr Skin.v 1";

An alternative to using a check box for controlling objects is to use radio buttons (see Figure 6.9). Although a check box is still the best control for running two different commands, radio buttons are used when you want to run three or more different commands. This is because radio buttons enable you to have more than just two states. For instance, you can have three radio buttons that toggle the visibility of your character's skin from visible, to a template state, to hidden. Keep in mind that, once initialized, at least one radio button is always checked on. The command used to create radio buttons is the radioButtonGrp command. Using the flags, you set the number of radio buttons, label the group and individual buttons, and set commands for each button when it is checked on. To create radio buttons to control the visibility and template state of your character's skin, for example, you must write a command similar to the following:

radioButtonGrp -numberOfRadioButtons 3 -label "Skin Visibility"
       -labelArray3 "Show" "Template" "Hide" –columnAlign 1 left
       -onCommand1 {"setAttr Skin.v 1; toggle -state off -template Skin"}
       -on2 {"setAttr Skin.v 1; toggle -state on -template Skin"}
       -on3 {"setAttr Skin.v 0; toggle -state off -template Skin"};
6.9. Radio buttons are similar to check boxes, but run multiple commands, and are always turned on.

Notice that there are multiple commands within each -onCommand flag. Each flag is setting the skin's visibility and toggle state. To run multiple commands in a flag, you must place double quotes and curly brackets around all the commands. This keeps Maya from reading the semicolons within each flag command as the end of the radioButtonGrp command. Otherwise, you will receive an error message. Use the -cal or -columnAlign flag to set the control flush left.

In most cases, it is best to assign controls to specific single attributes, such as assigning a slider to the Hips.rz channel or the UpperBody.ty channel. Some controls, however, can be assigned to multiple grouped attributes, called vector attributes. One such control is a field group, which is created by using the attrFieldGrp command. This command creates three fields that are connected to a vector attribute with the -at or -attribute flag. Instead of specifying a particular translate channel to control, for instance, you just specify all the translate channels. Then each field is connected to each translate channel, and the user can control the channels by inputting values into the fields. Right-click the label to set keys on all the translate attributes, or right-click a single field to set a key on only that particular attribute. For example, such a control for the left arm box would be written like this:

attrFieldGrp –label "Translate Left Arm Box"
–columnAlign 1 left –attribute LtArm.translate;

You can create tool buttons in your MEL control window by using the toolCollection and toolButton commands. You must use two flags with the toolButton command: The -t or -tool flag sets the active tool, and the -ti1 or -toolImage1 flag sets the tool icon to display. Another useful flag is the -sl or -select flag to have a particular tool selected when the window opens. You also can use the -iol or -iconOverlayLabel flag to add a text label over the tool icon. Your toolButton commands should look similar to the following:

toolCollection;
toolButton -tool selectSuperContext -select -iol "Select"
      -width 60 -toolImage1 selectSuperContext "aselect.xpm";
toolButton -tool moveSuperContext -iol "Translate"
      -width 60 -toolImage1 moveSuperContext "move_M.xpm";
toolButton -tool scaleSuperContext -iol "Scale"
      -width 60 -toolImage1 scaleSuperContext "scale_M.xpm";
toolButton -tool RotateSuperContext -iol "Rotate"
-width 60 -toolImage1 RotateSuperContext "rotate_M.xpm";

An alternative to creating individual Transform tool buttons in your control window is to make a Move Icons button that activates the Show Manipulator tool. This will ultimately save you time when animating, because the Show Manipulator tool enables the active transform to change automatically when you select each icon. For it to do this, you must first assign a default object manipulator to each of your icons. To do this, select the icon, choose Modify, Transformation Tools, Default Object Manipulator, and choose a manipulator. The manipulator you choose should fit your icon. For instance, the arm boxes should only be assigned a move manipulator, because they are never rotated or scaled. The Head box, on the other hand, should only be assigned a rotate manipulator, because it is never translated or scaled.

Icons that need to be both moved and rotated should only be assigned the move-rotate-scale manipulator. This option, however, is not available in the menu. To assign this manipulator, turn on Echo All Commands in the Script Editor, and assign a default move manipulator. In the History field, notice the code assigning the manipulator uses the setDefaultManip command, with a setting of 1. The rotate manipulator is a setting of 2, and the scale manipulator is a setting of 3. If you input this command with a setting of 4 in the Scripting field, the move-rotate-scale manipulator is assigned. Create a shelf button containing the code for easily assigning the move-rotate-scale manipulator to your icons. Your code should look like this:

setDefaultManip 4;

After you assign default object manipulators to all your icons, make a Move Icons button that activates the Show Manipulator tool. The MEL command to activate a particular tool is the setToolTo command, as follows:

button -l "Move Icons" -c "setToolTo ShowManips";

Using Additional Layouts

If you keep adding controls in your window, eventually you will run out of screen space. Using only column layout will not give you access to controls that are beyond your window's edge. To be able to access those controls, you must add a scrollLayout command. This command creates a scrollbar whenever your controls go beyond the size of your window. Because the scroll layout overrides the adjustable scaling of your controls with the window, you can remove the -adj flags if using scroll layout. To add a scrollbar to your window, just add the command before your columnLayout command like this:

window -t "Character Controls" –wh 400 600;
scrollLayout;
columnLayout;
button -l "Left Arm" –w 200 -c "select -r LtArm";

If you want to place your controls horizontally, rather than vertically, you use the rowLayout command. This layout enables you to specify the number of columns, using the -nc or -numberOfColumns flag, for placing controls in a row. For instance, you would create four columns to place four buttons in a single row. You must use the -cw4 or -number OfColumns4 flag to set the width of each column. The MEL code to do this should look like this:

window;
rowLayout -nc 4 -cw4 60 60 60 60;
button -l "Left Arm" -c "select -r LtArm";
button -l "Right Arm" -c "select -r RtArm";
button -l "Left Leg" -c "select -r LtLeg";
button -l "Right Leg" -c "select -r RtLeg";
showWindow;

To make multiple rows using this command, you must stack the rows with a columnLayout command. For this to work correctly, however, you must also use a setParent command. Whenever you use multiple layouts within a single window, you must assign the layouts in a hierarchy structure. This tells Maya how each layout relates to all the others. The setParent command enables you to assign a layout to a parent layout. This is often done by writing setParent..; after the contents of each child layout, which assigns the child to the next highest layout in the window. If you don't set the parenting correctly, you will get an error message stating there are too many children. To set the parenting for multiple rowLayout commands, for example, your code should be similar to the following:

window;
columnLayout;
rowLayout -nc 4 -cw4 60 60 60 60;
button -l "Left Arm" -w 60 -c "select -r LtArm";
button -l "Right Arm" -w 60 -c "select -r RtArm";
button -l "Left Leg" -w 60 -c "select -r LtLeg";
button -l "Right Leg" -w 60 -c "select -r RtLeg";
setParent..;
rowLayout -nc 4 -cw4 60 60 60 60;
button -l "Left Elbow" -w 60 -c "select -r LtElbow";
button -l "Right Elbow" -w 60 -c "select -r RtElbow";
button -l "Left Knee" -w 60 -c "select -r LtKnee";
button -l "Right Knee" -w 60 -c "select -r RtKnee";
setParent..;
showWindow;

Be aware that another layout command can be used to set your controls into either columns or rows, named rowColumnLayout. This command works in a very similar manner to the columnLayout and rowLayout commands, but contains flags for creating either multiple columns or multiple rows. You must choose one or the other for a single use of the command. For instance, the following code uses the -nr or -numberOfRows flag to create two rows of buttons, and uses the -rh or -rowHeight flag and the -rat or -rowAttach flag to space the rows apart from each other:

window;
rowColumnLayout -numberOfRows 2 -rowHeight 1 50 -rowHeight 2 50
       -rowAttach 1 "top" 10 -rowAttach 2 "top" 10;
button -l "Left Arm" -c "select -r LtArm";
button -l "Right Arm" -c "select -r RtArm";
button -l "Left Leg" -c "select -r LtLeg";
button -l "Right Leg" -c "select -r RtLeg";
button -l "Left Elbow" -c "select -r LtElbow";
button -l "Right Elbow" -c "select -r RtElbow";
button -l "Left Knee" -c "select -r LtKnee";
button -l "Right Knee" -c "select -r RtKnee";
showWindow;

To further conserve space in your MEL window, you can place your controls into collapsible sections using the frameLayout command. This command has two flags, the -cll or -collapsable and the -cl or -collapse flags, which create a drop-down style collapsible section. You can even specify a particular graphic style by using the -bs or -borderStyle flag. Inside the collapsible section, you must also use a layout command to specify how the contents of the collapsible section should be arranged. To use multiple frameLayout commands in a window, you write two setParent.. commands after the contents of each collapsible section. This assigns the contents of each layout to the appropriate collapsable frame layout, and assigns each frame layout to the overall window layout, which should be column layout. Here is an example of using the frameLayout command to create collapsible controls:

window;
columnLayout;
//First collapsable section:
frameLayout -width 400 -label "Select Icons"
       -collapsable true -collapse true -borderStyle "out";
rowColumnLayout -nr 1;
button -l "Left Arm" -w 70 -c "select -r LtArm";
button -l "Right Arm" -w 70 -c "select -r RtArm";
button -l "Left Leg" -w 70 -c "select -r LtLeg";
button -l "Right Leg" -w 70 -c "select -r RtLeg";
setParent..;
setParent..;
//Second collapsable section:
frameLayout -width 400 -label "Torso Sliders"
       -collapsable true -collapse false -borderStyle "etchedOut";
columnLayout;
attrFieldSliderGrp -l "Torso Crouch"-min -10 -max 1 -cal 1 left -at UpperBody.ty;
attrFieldSliderGrp -l "Torso Move Side"-min -7 -max 7 -cal 1 left -at UpperBody.tx;
attrFieldSliderGrp -l "Torso Move Front"-min -7 -max 7 -cal 1 left -at UpperBody.tz;
setParent..;
setParent..;
showWindow;

This MEL code creates a window that contains buttons in a collapsed section, followed by sliders in a section that is not collapsed. Notice that each section is using a different border style. To access or hide controls as needed, just click the drop-down arrows to open or close each section.

Exercise 6.2
Refine Your Basic Character Window

In this exercise, you place your basic MEL controls, created in the preceding exercise, into a more space-efficient layout. You also add new controls, such as check boxes, text, and separators, and add instructional comments for other users. Finally, you create some MEL-based IK-FK switching controls for your character's arms. Here is a finished example to use as a guide for creating your new MEL window:

window -t "Character Controls" -wh 450 800;
scrollLayout;
columnLayout;
//First collapsible section with visibility controls:
frameLayout -w 450 -l "Visibility" -cll true -cl false -bs
  "etchedOut";
columnLayout;
radioButtonGrp -cal 1 left -numberOfRadioButtons 3 -label "Skin
  Visibility"
-labelArray3 "Show" "Template" "Hide"
       -on1 {"setAttr Skin.v 1; toggle -state off -template
  Skin"}
      -on2 {"setAttr Skin.v 1; toggle -state on -template Skin"}
      -on3 {"setAttr Skin.v 0; toggle -state off -template Skin"};
separator -w 450;
text -l "  ";
checkBox -l "Bone Visibility" -al left
       -onc "layerEditorLayerButtonVisibilityChange PolyRefBones"
       -ofc "layerEditorLayerButtonVisibilityChange
  PolyRefBones";
text -l "  ";
setParent..;
setParent..;
//Second collapsible section with visibility controls:
frameLayout -w 450 -l "Select and Move Tools" -cll true -cl
  false -bs "etchedOut";
rowColumnLayout -nc 4;
text -l "Move Tools:" -fn "smallBoldLabelFont" -w 50 -al left;
text -l "  ";
text -l "  ";
text -l "  ";
//Tool buttons:
button -l "Select and Move" -c "setToolTo ShowManips";
toolCollection;
toolButton -tool selectSuperContext -iol "Select"
      -toolImage1 selectSuperContext "aselect.xpm";
toolButton -tool moveSuperContext -iol "Translate"
      -toolImage1 moveSuperContext "move_M.xpm";
toolButton -tool RotateSuperContext -iol "Rotate"
      -toolImage1 RotateSuperContext "rotate_M.xpm";
text -l "Select Buttons:" -fn "smallBoldLabelFont" -w 50 -al
  left;
text -l "  ";
text -l "  ";
text -l "  ";
//Selection buttons:
button -l "Left Arm" -c "select -r LtArm";
button -l "Right Arm" -c "select -r RtArm";
button -l "Left Leg" -c "select -r LtLeg";
button -l "Right Leg" -c "select -r RtLeg";
button -l "Left Elbow" -c "select -r LtElbow";
button -l "Right Elbow" -c "select -r RtElbow";
button -l "Left Knee" -c "select -r LtKnee";
button -l "Right Knee" -c "select -r RtKnee";
text -l "  ";
text -l "  ";
text -l "  ";
text -l "  ";
setParent..;
setParent..;
//Third collapsible section with visibility controls:
frameLayout -w 450 -l "Set Keyframes/IK-FK Switching"
      -cll true -cl true -bs "etchedOut";
columnLayout;
text -l "  ";
text -l "Controls for Animating/Switching the Left Arm:" -fn
  "smallBoldLabelFont" -w 400 -al left;
button -w 200 -l " Key Left Arm IK/FK " -c {"select -r LtArm;
  SetIKFKKeyframe"};
checkBox -l "Left Arm IK Switch"
       -onCommand "setAttr LtArmIK.solverEnable 1"
       -offCommand "setAttr LtArmIK.solverEnable 0";
attrFieldSliderGrp -l "Rotate Left Arm FK Joint - " -min 0 -max
  107 -cal 1 left -at LtArmLow.rz;
button -w 200 -l " Key Left Elbow " -c "setKeyFrame LtElbow.
  translate";
separator -w 450;
text -l "  ";
text -l "Controls for Animating/Switching the Right Arm:" -fn
  "smallBoldLabelFont" -w 400 -al left;
button -w 200 -l " Key Right Arm IK/FK " -c {"select -r RtArm;
  SetIKFKKeyframe"};
checkBox -l "Right Arm IK Switch"
       -onCommand "setAttr RtArmIK.solverEnable 1"
       -offCommand "setAttr RtArmIK.solverEnable 0";
attrFieldSliderGrp -l "Rotate Right Arm FK Joint - " -min 0 -max
  107 -cal 1 left -at RtArmLow.rz;
button -w 200 -l " Key Right Elbow " -c "setKeyFrame RtElbow.
  translate";
text -l "  ";
setParent..;
setParent..;
//Fourth collapsible section with attribute sliders...
frameLayout -w 450 -l "Character Sliders" -cll true -cl false
  -bs "etchedOut";
columnLayout;
text -l "Torso Controls:" -fn "smallBoldLabelFont" -w 400 -al
  left;
attrFieldSliderGrp -l "Torso Crouch"-min -10 -max 1 -cal 1 left
  -adj true -at UpperBody.ty;
attrFieldSliderGrp -l "Torso Move Side"-min -7 -max 7 -cal 1
  left -adj true -at UpperBody.tx;
attrFieldSliderGrp -l "Torso Move Front"-min -7 -max 7 -cal 1
  left -adj true -at UpperBody.tz;
attrFieldSliderGrp -l "Torso Rotate Side"-min -35 -max 35 -cal 1
  left -adj true -at UpperBody.rz;
attrFieldSliderGrp -l "Torso Rotate Front"-min -35 -max 35 -cal
  1 left -adj true -at UpperBody.rx;
text -l "  ";
separator -w 450;
text -l "Shoulder Controls:" -fn "smallBoldLabelFont" -w 400 -al
  left;
attrFieldSliderGrp -l "Shoulders Shrug"-min -2 -max 4 -cal 1
  left -adj true -at Shoulders.ty;
attrFieldSliderGrp -l "Left Shrug"-min -2 -max 10 -cal 1 left
  -adj true -at Shoulders.ltShoulder;
attrFieldSliderGrp -l "Right Shrug"-min -2 -max 10 -cal 1 left
  -adj true -at Shoulders.rtShoulder;
text -l "  ";
separator -w 450;
text -l "Back Controls:" -fn "smallBoldLabelFont" -w 400 -al
  left;
attrFieldSliderGrp -l "Back Bend Side"-min -45 -max 45 -cal 1
  left -adj true -at BackBend.rz;
attrFieldSliderGrp -l "Back Bow"-min -25 -max 55 -cal 1 left
  -adj true -at BackBow.rx;
attrFieldSliderGrp -l "Back Twist"-min -55 -max 55 -cal 1 left
  -adj true -at UpBack.ry;
text -l "  ";
separator -w 450;
text -l "Hips Controls:" -fn "smallBoldLabelFont" -w 400 -al
  left;
attrFieldSliderGrp -l "Hip Swing"-min -45 -max 45 -cal 1 left
  -adj true -at Hips.rz;
attrFieldSliderGrp -l "Hip Twist"-min -55 -max 55 -cal 1 left
  -adj true -at Hips.ry;
attrFieldSliderGrp -l "Hip Thrust"-min -35 -max 35 -cal 1 left
  -adj true -at Hips.rx;
text -l "  ";
separator -w 450;
text -l "Head Controls:" -fn "smallBoldLabelFont" -w 400 -al
  left;
attrFieldSliderGrp -l "Head Nod"-min -50 -max 50 -cal 1 left
  -adj true -at Head.rx;
attrFieldSliderGrp -l "Head Shake"-min -40 -max 40 -cal 1 left
  -adj true -at Head.rz;
attrFieldSliderGrp -l "Head Twist"-min -60 -max 60 -cal 1 left
  -adj true -at Head.ry;
attrFieldSliderGrp -l "Head Shift Front"-min -10 -max 10 -cal 1
  left -adj true -at Head.neckTilt;
attrFieldSliderGrp -l "Head Shift Side"-min -10 -max 10 -cal 1
  left -adj true -at Head.neckBend;
text -l "  ";
setParent..;
setParent..;
showWindow;

  1. Open the script node named MyControls that contains the MEL code for your basic character window you created in Exercise 6.1. Copy the code to the Scripting field of the Script Editor so that you can easily copy and paste from it while you are making your updated character window. Then click the New Script Node button in the Expression Editor, and name your new script node MyNewControls. Type in the window and showWindow commands in the same way you did for your previous window. The basic layout for the overall window should be columnLayout, which should be preceded by a scrollLayout command as well.

    Start placing your controls by writing the code for creating three radio buttons that control the visibility of your character's skin. Place the radio buttons in a collapsible section labeled Visibility. The layout for the first collapsible section's content should be rowLayout. Make the collapsible section open when the window launches by setting the -cl flag of the frameLayout command to false. In addition to the radio buttons, add a check box that toggles on and off the visibility of the polygon reference bones layer. To organize the controls, place separators, add text, and make comments as needed.

    Notice that the -onCommand and offCommand flags for the check box are just changing the visibility state of the layer button. To find the command used to hide your layer objects, turn on Echo All Commands in the Script Editor, and click the layer's visibility button. Add other visibility check boxes as needed. Also notice in the code that you can use empty text commands to create some space around a control. After you have typed all your MEL code into the Expression Editor, click the Create button, and test your new script.

  2. Next, make a second collapsible section that contains tool buttons and selection buttons. Set the frameLayout label for this section to read Select and Move Tools, and set the -collapse flag to false. Place the buttons horizontally within the collapsible section by using the rowColumnLayout command set to 4 columns. Make the first row of buttons standard Select, Translate, and Rotate tool buttons using the toolCollection and toolButton commands. Add a special Move button that turns on the Show Manipulator tool, to use default manipulators assigned to icons, as mentioned previously in this chapter. After the tool-button row, create a couple of rows of icon-selection buttons. Just copy the code for the buttons you made in the preceding exercise into the new window script. Add any comments, text, and separators as needed.

  3. Label the third collapsible section Set Keyframes/IK-FK Switching; it should contain controls for animating the limb controls. Set the -cl flag on the frameLayout command to true, so that the section is collapsed when the window opens. Do this for any sections that contain controls that you won't use all the time. The contents for this section should be key buttons, and IK-FK switching controls.

    Although IK is usually the best choice for animating your character's limbs, sometimes you will want to use FK to produce an unconscious swinging motion on the lower arms or legs. This is often required when the character is walking, throwing something, or kicking. Unfortunately, IK cannot produce this motion, because all the joints controlled by the solver are forced to move together when the IK handle is animated. To produce a swinging motion, the child joint must be able to rotate freely while the parent joint stays still. IK just cannot do this.

    To use FK on an IK-constrained skeleton in Maya 5, the IK solver has to be turned off by keyframing the ikBlend channel from 1 to 0. This is relatively easy to do on a simple skeleton, but as soon as you parent the IK handle under control boxes, switching to FK and keyframing all the channels involved becomes more complicated. To make this easier, you can use some special commands called setting IK/FK switching keys. The commands for doing this are located under the Animate menu. First, you must connect the channels involved in the switching operation. For instance, select your character's left arm box, Shift-select your left arm IK handle, and choose Animate, IK/FK Keys, Connect to IK/FK. Doing this connects in the channels used for animating the left arm by creating ikBlend channels on the arm box as well as the IK handle. Making this connection enables you to set keyframes on all the translate, rotate, and ikBlend channels at once.

    When the objects are connected, you can use the other commands under the IK/FK switching keys menu, such as Enable IK Solver and Set IK/FK Key, to toggle the IK and key all the objects simultaneously. Instead of using the menu commands, however, you can make the process easier by creating some MEL controls that enable you to access and keyframe the arm box, the FK arm joint, and the IK solver. You can use the selection buttons created in the previous section to select and move the left arm box. In addition to this, you need a check box to turn off the IK solver, a slider to rotate the FK arm joints, and a button that sets special IK/FK keyframes on all the objects. Use the History field to find out what kind of MEL command is used to set the IK/FK switching keys, and assign that command to the keyframe button's -c flag. The command should be set IKFKKeyframe, and notice that you must have the arm box selected when you set it, which you can either do manually or in the code. Also remember to use curly brackets to place multiple commands in a flag.

    These character controls don't have to be done using MEL, but locating all the controls in one MEL window makes it much easier to animate. Use your selection buttons, Move tools, and the IK/FK keyframe button to set IK keyframes for a certain number of frames. Use the check boxes to turn off the IK at the last IK keyframe, and set another IK/FK keyframe. Then use the slider to rotate the lower arm joint on another frame, and set another FK keyframe by clicking your button. Notice that the box doesn't follow the skeleton when the IK is turned off. To make sure the box syncs up with the skeleton when IK is turned back on, you must manually move it over the end of your arm skeleton for the first and last FK key you set. Unfortunately, this cannot be done through a constraint, or you will create a cycle, and Maya will give you an error message. To do this manually, hold the V key down to make sure your arm box is on top of the arms end joint, turn the IK back on using the check box, and set another IK/FK keyframe. You can also move the box icon into place by choosing Move IK to FK in the IK/FK Keys menu. Then continue moving the arm box, and set IK keyframes by clicking your button. When you play the animation, the end of the arm skeleton should follow the arm box when IK is turned on, but will move off of it when IK is turned off. Keep in mind that in Maya 5, the transition from IK to FK can occur gradually by keyframing the ikBlend channel from 0 to 1 over a series of frames on the timeline.

  4. Create a fourth collapsible section that contains all the attribute sliders you created in the preceding exercise (see Figure 6.10). Use text and separator commands to place the sliders in labeled groups. Add comments to your MEL code as needed. After placing all your sliders, make sure you click the Edit button, and save your scene. Finally, test all your new controls to make sure they are working correctly.

    6.10. Revise your basic MEL window to place more controls, such as check boxes, tool buttons, instructional text, and separators. Place all the controls within collapsible sections.


Advanced MEL Controls

In this section, you learn how to create more advanced MEL controls and layouts that maximize efficiency and conserve space. Techniques such as naming and referencing MEL controls, using variables, and creating multipanel layouts are covered in detail.

Naming and Referencing Controls

So far in this chapter, you have not been naming any of your MEL controls. A name for a control differs from a label or title. All controls are assigned unique names when you create them so that Maya can keep track of them. If you don't specify a name, Maya names the control for you, and you may not be aware of what that name is. In many cases when using MEL for character controls, this is fine. If you need to reference a control with another command in your script, however, you must know its name. In this case, it is best to assign a name by specifying it at the end of the command that creates the control. Just write a name after all the flags, right before the semicolon. To name your window, for instance, write it like this:

window -t "Character Controls" -wh 450 800 CharacterWin;

By placing the name CharacterWin after the last flag, Maya knows this is the name of your window. When the window is named, you can reference it in other commands. One good application of this is to write a conditional statement at the beginning of your script that updates your window whenever you launch it. Type the following command directly before the window command in your script like this:

if ('window -exists CharacterWin') deleteUI CharacterWin;
window -t "Character Controls" -wh 450 800 CharacterWin;

This conditional statement runs whenever the window is launched. It checks to see whether the window named CharacterWin already exists, and if so, it deletes the window and launches a new one with the same name. If the condition is false, and the window doesn't already exist, it skips the deleteUI command and just opens your window. One thing to note is the single back quotes (`) around the conditional statement are not the same as the single quote found on the double quotes key. You must use the single back quote on the tilde key, or you will get an error message. By placing MEL code in single back quotes, you use the results of running the code, rather than the code itself; you use this technique again later in this chapter when creating variables.

If you are still adding controls to your window, a conditional statement at the beginning of your script keeps you from having to close your current window to update the window with the new controls. Clicking the Test Script button just deletes the old one and launches the new one so quickly that it appears the same window was updated. Keep in mind that you shouldn't name your window if you are not going to use this conditional statement, because it may cause an error message if you try to launch multiple windows with the same name. In addition, if you are going to name your window, specify the name in your showWindow command in this manner:

showWindow CharacterWin;

One important use of naming controls is that you can query and edit them. This is done by using a -query or -edit flag in the command, followed by the flag you want to affect and the name of the control. These flags are used in examples later in this chapter.

Creating More Advanced Controls

One way to further enhance your MEL character window is to add your own custom images as part of the interface. The image command enables you to assign a static image to your window. The main flag that calls the image is a -i or -image flag. The -image flag should specify a text string that points to a custom bitmap image that you created in a paint program such as Photoshop. A good place to put your images is in the Icons folder where Maya stores all its UI and shelf icons. To find this folder, open the Shelf Editor and click the Change Image button. Images used in MEL windows, however, do not have to be a specific size like shelf button images.

There are commands not only for placing static images in your window, but also for assigning images to buttons and check boxes. These commands are the symbolButton and symbolCheckbox commands. Both of these commands have -image flags that can be pointed at an image file. Otherwise, they function in the same way as regular buttons and check boxes, except that they display images rather than text labels. Use your imagination to create custom-looking buttons and check boxes in a paint program such as Photoshop, saving the images as bitmap files. For instance, an image can be used to create a HideRig check box that hides all the NURBS curves, skeletons, IK handles, and locators in your scene. Another application would be to take a screen shot of your character in its default pose, and cut the image into a grid of squares. Then use the symbolButton and rowColumnLayout commands to place the buttons in columns that reconstruct the image of your character. Finally, assign each button to select the controls on your character displayed on each button. Here is an example of placing images, symbol check boxes, and symbol buttons in a window:

if ('window -exists ImagesWin') deleteUI ImagesWin;
window -t "Images Examples Window" ImagesWin;
columnLayout;
image -width 450 -height 50
      -image "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\extras/\icons/\USERWINDOWIMAGE.
  BMP";
text -l "Click the box below to hide/show your rig:" -fn "smallBoldLabelFont" -w 400 -al
  left;
symbolCheckBox
      -offImage "C:/\Program Files/\AliasWavefront/\Maya4.5/\extras/\icons/\USERHIDERIG.
  BMP"
      -onImage "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\extras/\icons/\USERSHOWRIG.BMP"
      -onCommand
{"modelEditor –e -deformers 0 -dimensions 0 -nurbsCurves 0 -ikHandles 0 -joints 0
  -locators 0 modelPanel1;\
modelEditor -e -deformers 0 -dimensions 0 -nurbsCurves 0 -ikHandles 0 -joints 0 -locators
  0 modelPanel2;\
modelEditor -e -deformers 0 -dimensions 0 -nurbsCurves 0 -ikHandles 0 -joints 0 -locators
  0 modelPanel3;\
modelEditor -e -deformers 0 -dimensions 0 -nurbsCurves 0 -ikHandles 0 -joints 0 -locators
  0 modelPanel4;"}
-offCommand
{" modelEditor -e -deformers 1 -dimensions 1 -nurbsCurves 1 -ikHandles 1 -joints 1
  -locators 1 modelPanel1;\
modelEditor -e -deformers 1 -dimensions 1 -nurbsCurves 1 -ikHandles 1 -joints 1 -locators
  1 modelPanel2;\
modelEditor -e -deformers 1 -dimensions 1 -nurbsCurves 1 -ikHandles 1 -joints 1 -locators
  1 modelPanel3;\
modelEditor -e -deformers 1 -dimensions 1 -nurbsCurves 1 -ikHandles 1 -joints 1 -locators
  1 modelPanel4;"};
text -l "Click the parts of the character you want to select:" -fn "smallBoldLabelFont"
  -w 400 -al left;
rowColumnLayout -nc 5 -cw 1 83  -cw 2 73 -cw 3 70 -cw 4 73 -cw 5 101;
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\extras/\icons/\USERA1.BMP"
     -c "select -r Rig";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\extras/\icons/\USERA2.BMP"
     -c "select -r RtElbow";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\extras/\icons/\USERA3.BMP"
     -c "select -r Head";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\extras/\icons/\USERA4.BMP"
     -c "select -r LtElbow";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\extras/\icons/\USERA5.BMP"
     -c "select -r EyesLook";
setParent..;
setParent..;
window -e -wh 450 300 -topLeftCorner 50 50 ImagesWin;
showWindow ImagesWin;

In this example, the first thing to notice is the way the paths to images are being written. As previously mentioned, using two forward slashes in front of a line comments out the code. Placing a single forward slash comments out the next character, rather than the entire line. This is necessary to make Maya read the path as a text string, and not run the backward slashes in the path as part of the command.

The second thing to notice about this script is that the check box commands are using the -ofi or -offImage flag to show one image when the check box is off, and using the -oni or -onImage flag to show another image when the check box is turned on. Also notice that the commands used to hide and show the rig elements are not controlling the visibility attributes of objects. Instead, they are toggling what each window in your Maya interface is showing. This command is using the modelEditor command with the -e or -edit flag to control the settings of the Show menu for each window. To make it work correctly, make sure you specify the name of each window, such as modelPanel4 for the perspective view. The three orthographic windows are named modelPanel1, modelPanel2, and modelPanel3.

Finally, this window places symbol buttons in columns to reconstruct an image of the character that can be clicked to select your icons (see Figure 6.11). It is important to set the width of each column to the exact size of each image, so that there is no space between them. Set the -c flags as you normally would to select an icon. There is also one more new command after the buttons, and before the showWindow command. Notice the window command, which is in edit mode to set the size and placement of the window. Placing this at the end of your window script forces the window to open at the correct size and place in your interface. To find out what numbers to use in the -tlc or -topLeftCorner flag, open a window and place it where you want it to be, and then run the window command on the command line with the same flag preceded by a -q or -query flag.

6.11. Use bitmap images on buttons and check boxes to customize the look of your character window.

You can use a more advanced slider for your MEL controls, which is created by using the floatSliderButtonGrp command. This command is similar in many ways to the attrFieldSliderGrp command, except that it has two buttons associated with it. Here is an example of the code used to create this slider, which should be inserted in your window script to replace the basic sliders:

floatSliderButtonGrp  -label "Crouch" -field true -fieldMinValue -11 -fieldMaxValue 4 -s 1
-minValue -7 -maxValue 1 -buttonLabel "Reset" -buttonCommand "setAttr UpperBody.ty 0"
-symbolButtonCommand "setKeyframe UpperBody.ty" -symbolButtonDisplay true -image
  "SETKEYSMALL.xpm"
-columnAlign 1 left -columnWidth5 60 40 160 50 35 -height 35 NewCrouchSlider;

In this slider the -fmn or -fieldMinValue flag and -fmx or -fieldMaxValue flag are being used to enable the Slider field to be set beyond the regular slider limits by typing values into the field. The two buttons being created with the slider are a regular reset button, and a symbol key button (see Figure 6.12). The reset button's -bc or -buttonCommand flag is using a setAttr command to set the attribute controlled by the slider back to its default value. Make sure you check the object's channels to get the correct value, because the default value may not always be 0. The -sbc or -symbolButtonCommand flag is using the setKeyframe command to set a key on the same attribute. The -i or -image flag is displaying Maya's small keyframe image on the symbol button. When you use any of the native Maya images in the Icons folder, which are special .xpm files, it is not necessary to specify the explicit path to the image. Use the -cal or -columnAlign flag to align the slider flush left, and then set the -cw5 or -columnWidth5 flag so that each piece of the control has a specific width. This makes sure there are no large gaps of space in your slider.

6.12. If you use the floatSlider Button Grp command to create your sliders, you can add reset and keyframe buttons as part of the slider control.

Finally, it is important that you give this slider control a name. Notice that the floatSliderButtonGrp command doesn't have an -at or -attribute flag. If you test the command, you will find that the slider doesn't actually control anything. The reason you have to specify a name for this slider control is that you must use the slider's name in a separate command to make it work. The command is the connectControl command, and should be written directly after the floatSliderButtonGrp command, like this:

connectControl NewCrouchSlider ("UpperBody.ty");

The slider should work fine after you add the connectControl command. Other controls you can make are Key All and Reset All buttons for particular sections of sliders. These can be placed at the beginning or end of each section, and are used to affect multiple attributes. To make the Reset All button work, copy the setAttr commands from each advanced slider reset button to the -c flag of the Reset All button, making sure to separate them by semicolons, and surround them with double quotes and curly brackets. Your MEL code for resetting all the head controls should be similar to this:

button -l "Reset Head All" -c {"setAttr Head.rx 0; setAttr Head.ry 0; setAttr Head.rz 0;\
setAttr Head.neckTilt 0; setAttr Head.neckBend 0; setAttr Head.jawOpen 0;"};

To create a Key All button, use the setKeyFrame command in the -c flag of the button, followed by listing all the attributes you want to set a key on. For instance, the MEL code for your Key All button for the head controls should resemble the following:

button -l "Key Head All" -c "setKeyframe\
     Head.rotate\
     Head.neckTilt\
     Head.neckBend\
     Head.jawOpen";

Another control you can use involves creating a list of keyframes set on an attribute that is controlled by a slider, so you can edit them without having to select the object. The controls include a keyFrameOutliner command, followed by buttons for removing the current keyframe on the timeline, or for removing all keyframes from that attribute. These are not controls that you would use all the time, so it is best to place them in a collapsible section after each slider. To create such controls for the Crouch slider, for instance, your code should look like this:

floatSliderButtonGrp  -l "Crouch" -f true -fmn -11 -fmx 4 -s 1 -min -7 -max 1
       -cal 1 left -cw5 60 40 160 50 35
       -bl "Reset" -bc "setAttr UpperBody.ty 0"
       -sbc "setKeyframe UpperBody.ty" -sbd true -i "SETKEYSMALL.xpm"
NewCrouchSlider;
connectControl NewCrouchSlider ("UpperBody.ty");
//this section contains a collapsible keyframes list:
frameLayout -w 350 -l "Crouch Keys" -cll true -cl true -bs "in";
columnLayout -h 100 -adj true;
//This sets a keyframe at 0 to initialize the control:
currentTime -edit 0sec;
setAttr UpperBody.ty 0;
setKeyframe -time 0sec UpperBody.ty;
//this creates a list of keys:
text -l "UpperBody TranslationY Keys";
keyframeOutliner -display narrow -animCurve UpperBody_translateY;
//buttons for selecting and removing keys...
button -l "Remove Current Key"
      -c {"select -r UpperBody; timeSliderClearKey; select -cl;"};
button -l "Remove All Keys"
      -c {"currentTime -e 0sec; cutKey -clear -time \".05:1000\" -attribute ty UpperBody"};
checkBox -l "Open/Close Graph Editor"
      -onc {"select -r UpperBody; GraphEditor;"}
      -ofc {"select -cl; deleteUI -window graphEditor1Window"};
setParent..;
setParent..;

In this code, notice that the first command after the frameLayout and columnLayout commands is a currentTime command that sets the current frame to 0. Then the next two lines sets the UpperBody icon to its default Y translation value, and uses the setKeyframe command to automatically set a keyframe. Doing this in the code ensures that the key will be there whenever the window is opened. This is necessary to initialize the keyframeOutliner command, which requires at least one keyframe on the object to update the list of keys. The narrow display on this command shows the frame number the key is located on, as well as the attribute's value, and how the interpolation of the animation curve is set. You use this list of keyframes as a guide when using the next two buttons. Each of the buttons removes keyframes in specific ways, and contains multiple commands in the -c flags (see Figure 6.13). The first button selects the UpperBody icon, clears any key on the current timeline frame using the timeSliderClearKey command, and then unselects the icon. This is all done in the code, so you never notice that the UpperBody icon is even selected. The next button removes all the keys from the object except the default position key at frame 0. The commands being executed set the timeline to 0, and then use a cutKey command to clear the keys from .05 to 1000 on the timeline for the UpperBody icon. You want to cut the keys slightly above 0, so that the default key on 0 remains. This keeps the keyframeOutliner control working without you having to relaunch the window. The last control is a check box that opens and closes a Graph Editor that enables you to adjust the animation curves on the object the slider is controlling. This involves selecting the object, opening the Graph Editor, unselecting the object, and deleting the Graph Editor.

6.13. Add a collapsible section to each slider that contains a list of keys set on the slider's attribute, and keyframe editing controls.

Declaring Variables

One technique that is common for programmers to use in their scripts is the declaring and referencing of variables. A variable is a name with a dollar sign at the beginning of it that is used in a script to stand for something else. It can stand for a length of MEL code, the name of an object, a complete list of objects, or the result of running some MEL code. In most MEL scripts, variables are used to make the script more compact, easier to modify, and dynamic because they can contain the results of evaluating the code.

To use a variable, you must first declare it. You declare it at the beginning of your script, being careful to use a unique name for each variable. You can declare several kinds of variables, but the main ones you use in this chapter are a float, integer, and string variable. A float variable contains whole numbers or decimal numbers, an integer variable contains only whole numbers, and a string variable contains any kind of characters on the keyboard. Here are some examples of declaring these three kinds of variables:

float $variable1 = 'getAttr UpperBody.ty';
int $variable2 = 'currentTime -q';
string $variable3 = "setAttr UpperBody.ty 0";

The first two variables differ from the third in that they represent the result of running the code on the right of the equals sign, as opposed to representing a string of code itself. The single back quotes symbol on the tilde key tells Maya to run the code and store the result in the variable. This causes $variable1 to contain the translation Y value of the UpperBody icon, rather than the command string "getAttr UpperBody.ty". The second variable contains the result of running a query to find out the current setting of the timeline, which will be a frame number. The third variable, however, contains the text string "setAttr UpperBody.ty 0". By inserting $variable3 in a MEL script, you place this entire command in the script, to be run when the rest of the script runs.

You will use one other kind of variable when you want to run commands on many things simultaneously. To do this, you must create a list of all the things you want to affect. You do so by declaring a special variable called an array. To create an array, add brackets after the variable name, as follows:

string $variable4[] = 'ls -select';

By using the result of running an ls or list command with a -select _flag, you make the variable contain a list of whatever is selected when the array variable is declared. In an array, each member of the list is assigned a number, starting with 0, so it can be referenced. Select in order a sphere, cube, and locator before declaring this variable, for example, and then type the following on the command line:

print $variable4[1];

The result of this command is "cube", because that is the second object in the $variable4 array. Throughout the rest of this chapter, you frequently use variables to create more complicated MEL controls and tools.

Using Tab Layout

Over the next couple of sections, you finalize the placement of your character controls into two more advanced layouts. First you use the tabLayout command to place groups of sliders into tabs. This helps to maximize your screen space by condensing the attribute slider controls into a reasonably small area. Because this layout is more complicated than the previous ones, the best way to begin using it is to copy the simple example from the MEL Command Reference page on tabLayout to your Script Editor. The following code is the same as the example, except comments have been added to show you what is creating the various parts of the tab controls:

window -widthHeight 200 150;
//This section places the layout parameters in variables to use later:
string $form = 'formLayout';
string $tabs = 'tabLayout -innerMarginWidth 5 -innerMarginHeight 5';
formLayout -edit
       -attachForm $tabs "top"    0
       -attachForm $tabs "left"   0
       -attachForm $tabs "bottom" 0
       -attachForm $tabs "right"  0
       $form;
//This creates the contents of the first tab:
string $child1 = 'rowColumnLayout -numberOfColumns 2';
button; button; button;
setParent ..;
//This creates the contents of the second tab:
string $child2 = 'rowColumnLayout -numberOfColumns 2';
button; button; button;
setParent ..;
//This edits the tabLayout command to label each tab:
tabLayout -edit
       -tabLabel $child1 "One"
       -tabLabel $child2 "Two"
       $tabs;
showWindow;

Highlighting and running the example code creates a window with two tabs that contain some horizontally placed buttons. Notice that the code uses variables to create and label the tabs. Also notice that multiple layout commands are used, so the setParent command is required. The important things for you to understand are where the contents of each tab should be placed, where the labels for each tab are being assigned, and how to add more tabs. To add another tab, copy and paste the contents of a tab, starting at the declaring of the $child variable to the setParent command, and change the name of the new variable to $child3. Then you copy and paste a new -tabLabel flag that labels $child3 to "three". When you understand this process, you can copy your own contents from the scripts you created in previous exercises into the new tab layout to replace the button commands, and give the tabs character control labels. For instance, you can place some advanced slider controls into a tab layout as follows:

if ('window -exists TabsWin') deleteUI TabsWin;
window –t "Tab Character Window" TabsWin;
//This section places the layout parameters in variables to use later:
string $form = 'formLayout';
string $tabs = 'tabLayout -innerMarginWidth 5 -innerMarginHeight 5';
formLayout -edit
      -attachForm $tabs "top"    0
      -attachForm $tabs "left"   0
      -attachForm $tabs "bottom" 0
      -attachForm $tabs "right"  0
      $form;
//This creates the contents of the first tab:
string $tabContent1 = 'columnLayout';
floatSliderButtonGrp  -l "Crouch" -f true -fmn -8 -fmx 4 -s 1 -min -5 -max 1
      -cal 1 left -cw5 65 40 160 50 35
      -bl "Reset" -bc "setAttr UpperBody.ty 0"
      -sbc "setKeyframe UpperBody.ty" -sbd true -i "SETKEYSMALL.xpm"
      CrouchSlider;
connectControl CrouchSlider ("UpperBody.ty");
setParent ..;
//This creates the contents of the second tab:
string $tabContent2 = 'columnLayout';
floatSliderButtonGrp  -l "Bend Back" -f true -fmn -50 -fmx 50 -s 1 -min -30 -max 30
      -cal 1 left -cw5 65 40 160 50 35
      -bl "Reset" -bc "setAttr BackBend.rz 0"
      -sbc "setKeyframe BackBend.rz " -sbd true -i "SETKEYSMALL.xpm"
      BendBackSlider;
connectControl BendBackSlider ("BackBend.rz");
setParent ..;
//This creates the contents of the third tab:
string $tabContent3 = 'columnLayout';
floatSliderButtonGrp  -l "Hip Swing" -f true -fmn -60 -fmx 60 -s 1 -min -45 -max 45
      -cal 1 left -cw5 65 40 160 50 35
      -bl "Reset" -bc "setAttr Hips.rz 0"
      -sbc "setKeyframe Hips.rz" -sbd true -i "SETKEYSMALL.xpm"
      HipSwingSlider;
connectControl HipSwingSlider ("Hips.rz");
setParent ..;
//This edits the tabLayout command to label each tab:
tabLayout -edit
      -tabLabel $tabContent1 "Torso"
      -tabLabel $tabContent2 "Back"
      -tabLabel $tabContent3 "Hips"
      $tabs;
window -e -wh 450 300 -topLeftCorner 50 50 TabsWin;
showWindow TabsWin;

This code creates a window with three tabs: Torso, Back, and Hips (see Figure 6.14). When you click each tab, an advanced slider displays, enabling you to control each of these areas. It is then just a simple matter to add more sliders to each tab.

6.14. Begin placing your advanced slider controls in a tab layout to conserve space in your window.

Creating a Multipanel Window

One of the most powerful layout commands you can use is paneLayout. This layout creates multiple panels in a floating window. The panels can contain anything you can create in MEL, such as custom controls or even view windows. Actually, the four-panel layout you use when working in the Maya interface is a "quad" pane layout. Each panel is completely separate from the others, and can contain a variety of controls and sublayouts. The advantage of using the paneLayout command is that you don't have to worry about layout commands in separate panels clashing with each other. Within the command, there are flags for specifying the number of panels, how the panels are arranged, and the size of each panel.

Other than the "quad" configuration, you can specify many other arrangements for the panels when using paneLayout. This parameter is set using the -cn or -configuration flag, and includes "single", "horizontal2", "vertical2", "horizontal3", "vertical3", "top3", "left3", "bottom3", "right3", "horizontal4", "vertical4", "top4", "left4", "bottom4", and "right4". The horizontal configurations stack a specific number of panel rows, whereas the vertical configurations create a specific number of panel columns. The top, bottom, left, and right configurations create three panels with the placement of the largest one being opposite the name. For instance, the "top" configuration creates one large panel on the bottom half of the window, and two small panels on the top half of the window.

As with the tabLayout command, the best way to understand the paneLayout command is to copy the MEL Command Reference example into your Script Editor and test different configurations. Here is the example code with some comments and setParent command additions:

window;
paneLayout -configuration "quad" MyPanels;
//This is the first panel:
button;
setParent MyPanels;
//This is the second panel:
textScrollList -append "one" -append "two" -append "three";
setParent MyPanels;
//This is the third panel:
scrollField;
setParent MyPanels;
//This is the fourth panel:
scrollLayout;
columnLayout;
button; button; button;
setParent MyPanels;
showWindow;

Notice that this command doesn't have any flags that specify the controls that come up in each of the panels. Instead, which controls come up in each of the panels is determined by the order in which the controls come up in the code. Be aware that in a "quad" configuration, the order goes clockwise from the top-left panel. Therefore, the example code creates a button in the top-left panel, a text list in the top-right panel, a Scroll field in the bottom-right panel, and three buttons in a scroll layout in the bottom-left panel (see Figure 6.15). Other configurations, such as "right3", also go clockwise, whereas a horizontal configuration goes from top to bottom, and a vertical goes from left to right. If you set a configuration that specifies fewer panels than controls—for instance, you change the example code to an "right3" configuration—the last control listed in the script will not display in the resulting window. In the example script, this would result in the three buttons not appearing in any of the three windows.

6.15. Copy from the MEL Command Reference to the Script Editor the paneLayout example to use as a template for creating your own multipanel windows. This example places controls in a "quad" configuration of panels.

When you start putting your character controls within a pane layout in the next exercise, make sure the right controls come up in the correct window by using setParent commands to signal the end of each panel. Notice that a setParent command has been added after each control in the preceding example code, and that the command specifies the name of the paneLayout control. This is not necessary in this simple example, but is useful when adding additional sublayouts later. You then need to use setParent.. commands to use multiple sublayouts within each panel, and the setParent MyPanels; command to set the contents for each panel into the overall pane layout.

Kinds of Interface Design

As mentioned previously, the goal of a character setup artist is to make character controls that are easy and intuitive for an animator to use. On advantage of MEL controls is that each control can contain clear labels. In addition, there can be automatic limits on how far a control can be animated. Keep this in mind as you develop your character window. In most animation facilities, animators are considered talent, and do not necessarily have a deep technical understanding of Maya. Their main job is to make the character come to life through their acting abilities. It is the role of the character setup artist to create character controls that may be extremely complex "under the hood," but are much easier for the animator to use than more primitive controls.

You can set up your pane layout window in two main ways. The most basic way is to create a multipanel window that contains only character controls, which are then used in conjunction with the regular Maya interface. An example is a "horizontal4" pane layout that consists of selection, visibility, and some interface controls in several small panels, with a larger panel at the bottom of the window that contains sliders in a tab layout (see Figure 6.16). This kind of window is usually pretty small, and is just used as a floating window on top of the regular Maya views.

6.16. This "horizontal4" configuration stacks four differently sized panels that contain only character controls. This kind of window would be used in conjunction with the regular Maya interface and views.

The other way to set up your pane layout is to create a multipanel window that contains all the controls and view windows that the animator will use to pose the character. Such a layout should be designed so that it can replace the regular Maya interface. For instance, such a layout could have a large panel of controls, and also contain panels that display perspective and hypergraph views. The controls should also include access to the timeline, Graph Editor, and other animation tools. There is a procedure you can go through to make your custom control window replace the regular Maya interface when your character scene is opened. Do this by setting the script node Execute On option in the Expression Editor from Demand to Open/Close. Make sure Before is checked on for the Script option. Then add a couple of commands to your window script. First, add an -mw or -mainWindow flag to your window command. Then add a deleteUI command after the showWindow command in your script. Set this command to delete Maya's main window. To find the name of Maya's main window, run an lsUI command with a -wnd or -windows flag. This shows you that the name for the main window containing the Maya interface is MayaWindow. The code for doing this should look like the following example:

window –mainWindow MyInterface;
columnLayout;
text –l "Your multi-panel character controls go here...";
showWindow MyInterface;
deleteUI –window MayaWindow;

Click Edit in the Script Editor and save your scene with a name such as WindowOpenTest. Then when you next open that file, your custom window will automatically open, and the regular Maya interface will be deleted. Be careful to use this technique only if you have added all the controls to your custom window that the animator will need to work, such as ways to animate, save the scene, open views, and so on. Ultimately, how you decide to set up your character controls is really just a matter of personal preference. Keep in mind, however, that the controls-only method gives the animator full access to the rest of the Maya interface, whereas the all-inclusive method limits the animator to using only what you include in the window.

Exercise 6.3
Build an Advanced Character Window

In this exercise, you refine your window to include reset buttons, keyframe buttons, IK/FK switching controls, and you customize your interface using controls that contain -image flags. In addition, you arrange all the controls using a variety of layout commands that are nested within a multipanel window. Your goal is to create an intuitive character control interface that will be easy for a nontechnical animator to use.

  1. Begin by creating the multipanel layout that will contain all your controls. Copy the paneLayout example in the MEL Command Reference into your Script Editor, and modify the -cn or -configuration flag to a simple "horizontal2" layout. Set the -paneSize flag to make panel 1 100 percent wide and 95 percent high. Panel size is not based on pixels, but on what percentage of the window each panel should take. If you have only two panels and make one cover 95 percent of the window, you automatically set the other panel to 5 percent. This creates a large top window, and a small bottom window. Remove the last two controls from the code; they are not needed. Also add all other necessary window commands and comments. Your simple code should look like this:

if ('window -exists CharacterWinAdv') deleteUI CharacterWinAdv;
window -t "Character Controls" -wh 450 800 CharacterWinAdv;
paneLayout -configuration "horizontal2" -paneSize 1 100 95
  TopPanels;
//This is the first panel:
button -l "Large Top Panel";
setParent TopPanels;
//This is the second panel:
button -l "Small Bottom Panel";
setParent TopPanels;
window -e -wh 800 600 -topLeftCorner 50 50 CharacterWinAdv;
showWindow CharacterWinAdv;

    Copy the code over into your Expression Editor and create a script node called AdvancedWindow. Testing the script should create a window with a large top panel, and a small bottom panel. You then nest a second paneLayout command inside the first pane layout to divide the large top panel into three smaller panels. Do this by using a "left3" configuration flag, which creates a large panel on the right and two stacked small panels on the left. Your MEL code should look like this:

if ('window -exists CharacterWinAdv') deleteUI CharacterWinAdv;
window -t "Character Controls" -wh 450 800 CharacterWinAdv;
//This creates a large top panel, and a small bottom panel:
paneLayout -configuration "horizontal2" -paneSize 1 100 95
  TopPanels;
//This creates three sub-panels in the large top panel:
paneLayout -configuration "left3" SubPanels;
//This creates the small top left sub-panel:
button -l "Top Left Sub-Panel";
setParent SubPanels;
//This creates the large top right sub-panel:
button -l "Top Right Sub-Panel";
setParent SubPanels;
//This creates the small bottom left sub-panel:
button -l "Bottom Left Sub-Panel";
setParent SubPanels;
setParent TopPanels;
//This creates the small bottom panel:
button -l "Bottom Panel";
setParent TopPanels;
window -e -wh 800 600 -topLeftCorner 50 50 CharacterWinAdv;
showWindow CharacterWinAdv;

    This code creates a window with four panels. Going clockwise, you should see a small top-left panel, a tall right panel, a small bottom panel that covers the entire width of the window, and a small lower-left panel (see Figure 6.17). You will use this layout to organize all your character controls.

    6.17. You can nest multiple paneLayout commands to create a variety of configurations. This example shows a "left3" configuration inside the top panel of a "horizontal2" configuration

  2. The four panels you created are going to contain all your character controls, plus a view window. First, in the panel that runs along the bottom of your window, place a timeline control. To create this control, use the timePort command. This command enables you to scrub the timeline in your window. Also create buttons that play and stop the timeline. Do this by using the play command, and add the -forward and -state flags.

    Again going clockwise in the top section of your window, place all your selection, visibility, and interface controls in the small top-left panel. Convert some of your basic controls to the more advanced versions detailed in this section, such as images, symbol buttons and symbol check boxes, Key All Buttons, and Reset All buttons. Remember to add enough setParent commands when using multiple layouts; otherwise, you will get an error message from Maya that there are too many children.

    The tall panel on the right should contain a perspective view for posing your character. Use the modelPanel command to create this, and make sure you name the panel something like AdvPanelView, because you will need to reference that name in your visibility commands. You also need to add a conditional if statement at the beginning of your script to delete the panel if it already exists when the script is run.

    Finally, make the small lower-left panel contain all your floatSliderButtonGrp sliders within tabs. Just copy into the last panel the entire tabLayout script you created in the preceding section, leaving out only the window and showWindow commands. Make sure you add a scrollbar to both left control panels by adding a scrollLayout command as the first command in each panel section of your script. Your advanced character window script should look similar to the following:

if ('window -exists CharacterWinAdv2') deleteUI CharacterWinAdv2;
if ('panel -exists AdvPanelView') deleteUI -panel AdvPanelView;
window -t "Character Controls" -wh 450 800 CharacterWinAdv2;
//This creates a large top panel, and a small bottom panel:
paneLayout -configuration "horizontal2" -paneSize 1 100 95
  TopPanels;
//This creates three sub-panels in the large top panel:
paneLayout -configuration "left3" SubPanels;
//This creates the small top left sub-pamel:
scrollLayout;
columnLayout;
image -w 450 -h 50 -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/
  \extras/\icons/\USERWINDOWIMAGE.BMP";
frameLayout -w 450 -h 100 -l "Visibility" -cll true -cl false
  -bs "out";
columnLayout;
symbolCheckBox
      -ofi "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\extras/\
  icons/\USERHIDERIG.BMP"
      -oni "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\extras/\
  icons/\USERSHOWRIG.BMP"
-onCommand "modelEditor -e -deformers 0 -dimensions 0
  -nurbsCurves 0 -ikHandles 0 -joints 0 -locators 0 AdvPanelView"
-offCommand "modelEditor -e -deformers 1 -dimensions 1
  -nurbsCurves 1 -ikHandles 1 -joints 1 -locators 1 AdvPanelView";
radioButtonGrp -cal 1 left -numberOfRadioButtons 3 -label "Skin
  Visibility"
      -labelArray3 "Show" "Template" "Hide"
      -on1 {"setAttr Skin.v 1; toggle -state off -template Skin"}
      -on2 {"setAttr Skin.v 1; toggle -state on -template Skin"}
      -on3 {"setAttr Skin.v 0; toggle -state off -template Skin"};
setParent..;
setParent..;
frameLayout -w 450 -l "Selection" -cll true -cl false -bs "out";
columnLayout;
rowColumnLayout -nc 4;
text -l "Move Tools:" -fn "smallBoldLabelFont" -w 50 -al left;
text -l "  ";
text -l "  ";
text -l "  ";
//Tool buttons...
button -l "Select and Move" -c "setToolTo ShowManips";
toolCollection;
toolButton -tool selectSuperContext -iol "Select"
      -toolImage1 selectSuperContext "aselect.xpm"";
toolButton -tool moveSuperContext -iol "Translate"
      -toolImage1 moveSuperContext "move_M.xpm";
toolButton -tool RotateSuperContext -iol "Rotate"
      -toolImage1 RotateSuperContext "rotate_M.xpm";
setParent..;
text -l "Click the parts of the character you want to select:"
  -fn "smallBoldLabelFont" -w 400 -al left;
rowColumnLayout -nc 5 -cw 1 83  -cw 2 73 -cw 3 70 -cw 4 73 -cw 5
  101;
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA1.BMP"
      -c "select -r Rig";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA2.BMP"
      -c "select -r RtElbow";
symbolButton -i "C:/\Program Files/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA3.BMP"
      -c "select -r Head";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA4.BMP"
      -c "select -r LtElbow";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA5.BMP"
      -c "select -r EyesLook";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA6.BMP"
      -c "select -r RtArm";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA7.BMP"
      -c "select -r RtElbow";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA8.BMP"
      -c "select -r UpperBack";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA9.BMP"
      -c "select -r LtElbow";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA10.BMP"
      -c "select -r LtArm";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA11.BMP"
      -c "select -r Shoulders";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA12.BMP"
      -c "select -r Shoulders";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA13.BMP"
      -c "select -r MidBack";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA14.BMP"
      -c "select -r UpperBody";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA15.BMP"
      -c "select -r UpperBody";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA16.BMP"
      -c "select -cl";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA17.BMP"
      -c "select -r BackBend";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA18.BMP"
      -c "select -r Hips";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA19.BMP"
      -c "select -r BackBow";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA20.BMP"
      -c "select -cl";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA21.BMP"
      -c "select -cl";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA22.BMP"
      -c "select -cl";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA23.BMP"
      -c "select -cl";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA24.BMP"
      -c "select -cl";
symbolButton -i "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\
  extras/\icons/\USERA25.BMP"
      -c "select -cl";
setParent..;
setParent..;
setParent SubPanels;
//This creates the large top right sub-panel:
modelPanel AdvPanelView;
setParent SubPanels;
//This creates the small bottom left sub-panel:
scrollLayout;
string $form = 'formLayout';
string $tabs = 'tabLayout -innerMarginWidth 5 -innerMarginHeight
  5';
formLayout -edit
      -attachForm $tabs "top"    0
      -attachForm $tabs "left"   0
      -attachForm $tabs "bottom" 0
      -attachForm $tabs "right"  0
$form;
//This creates the contents of the first tab:
string $tabContent1 = 'columnLayout';
floatSliderButtonGrp  -l "Crouch" -f true -fmn -8 -fmx 4 -s 1
  -min -5 -max 1
      -cal 1 left -cw5 85 40 160 50 35
      -bl "Reset" -bc "setAttr UpperBody.ty 0"
      -sbc "setKeyframe UpperBody.ty" -sbd true -i "SETKEYSMALL.
  xpm"
CrouchSlider;
connectControl CrouchSlider ("UpperBody.ty");
//Creates collapsible key editing section:
frameLayout -w 370 -l "Crouch Keys" -cll true -cl true -bs "in";
columnLayout -h 60 -adj true;
//This sets a keyframe at 0 to initialize the control:
currentTime -edit 0sec;
setAttr UpperBody.ty 0;
setKeyframe -time 0sec UpperBody.ty;
//This creates a list of keys:
text -l "UpperBody TranslationY Keys";
keyframeOutliner -display narrow -animCurve UpperBody_translateY;
//Buttons for selecting and removing keys:
button -l "Remove Current Key"
      -c {"select -r UpperBody; timeSliderClearKey; select -cl;"};
button -l "Remove All Keys"
      -c {"currentTime -e 0sec; cutKey -clear -time \".05:1000\"
  -attribute ty UpperBody"};
checkBox -l "Open/Close Graph Editor"
      -onc {"select -r UpperBody; GraphEditor;"}
      -ofc {"select -cl; deleteUI -window graphEditor1Window"};
setParent..;
setParent..;
floatSliderButtonGrp  -l "Side Shift" -f true -fmn -6 -fmx 6 -s
  1 -min -4 -max 4
      -cal 1 left -cw5 85 40 160 50 35
      -bl "Reset" -bc "setAttr UpperBody.tx 0"
      -sbc "setKeyframe UpperBody.tx" -sbd true -i "SETKEYSMALL.
  xpm"
TorsoSideSlider;
connectControl TorsoSideSlider ("UpperBody.tx");
frameLayout -w 370 -l "Side Shift Keys" -cll true -cl true -bs
  "in";
columnLayout -h 60 -adj true;
//This sets a keyframe at 0 to initialize the control:
setAttr UpperBody.tx 0;
setKeyframe -time 0sec UpperBody.tx;
//This creates a list of keys:
text -l "UpperBody TranslationX Keys";
keyframeOutliner -display narrow -animCurve UpperBody_translateX;
//Buttons for selecting and removing keys:
button -l "Remove Current Key"
      -c {"select -r UpperBody; timeSliderClearKey; select -cl;"};
button -l "Remove All Keys"
      -c {"currentTime -e 0sec; cutKey -clear -time \".05:1000\"
  -attribute tx UpperBody"};
checkBox -l "Open/Close Graph Editor"
      -onc {"select -r UpperBody; GraphEditor;"}
      -ofc {"select -cl; deleteUI -window graphEditor1Window"};
setParent..;
setParent..;
floatSliderButtonGrp  -l "Forward Shift" -f true -fmn -7 -fmx 7
  -s 1 -min -4 -max 4
      -cal 1 left -cw5 85 40 160 50 35
      -bl "Reset" -bc "setAttr UpperBody.tz 0"
      -sbc "setKeyframe UpperBody.tz" -sbd true -i "SETKEYSMALL.
  xpm"
TorsoForwardSlider;
connectControl TorsoForwardSlider ("UpperBody.tz");
frameLayout -w 370 -l "Forward Shift Keys" -cll true -cl true
  -bs "in";
columnLayout -h 60 -adj true;
//This sets a keyframe at 0 to initialize the control:
setAttr UpperBody.tz 0;
setKeyframe -time 0sec UpperBody.tz;
//This creates a list of keys:
text -l "UpperBody TranslationZ Keys";
keyframeOutliner -display narrow -animCurve UpperBody_translateZ;
//Buttons for selecting and removing keys:
button -l "Remove Current Key"
      -c {"select -r UpperBody; timeSliderClearKey; select -cl;"};
button -l "Remove All Keys"
      -c {"currentTime -e 0sec; cutKey -clear -time \".05:1000\"
  -attribute tz UpperBody"};
checkBox -l "Open/Close Graph Editor"
      -onc {"select -r UpperBody; GraphEditor;"}
      -ofc {"select -cl; deleteUI -window graphEditor1Window"};
setParent..;
setParent..;
floatSliderButtonGrp  -l "Rotate Side" -f true -fmn -50 -fmx 50
  -s 1 -min -35 -max 35
      -cal 1 left -cw5 85 40 160 50 35
      -bl "Reset" -bc "setAttr UpperBody.rz 0"
      -sbc "setKeyframe UpperBody.rz" -sbd true -i "SETKEYSMALL.
  xpm"
TorsoRotZSlider;
connectControl TorsoRotZSlider ("UpperBody.rz");
frameLayout -w 370 -l "Rotate Side Keys" -cll true -cl true -bs
  "in";
columnLayout -h 60 -adj true;
//This sets a keyframe at 0 to initialize the control:
setAttr UpperBody.rz 0;
setKeyframe -time 0sec UpperBody.rz;
//This creates a list of keys:
text -l "UpperBody RotateZ Keys";
keyframeOutliner -display narrow -animCurve UpperBody_rotateZ;
//Buttons for selecting and removing keys:
button -l "Remove Current Key"
      -c {"select -r UpperBody; timeSliderClearKey; select -cl;"};
button -l "Remove All Keys"
      -c {"currentTime -e 0sec; cutKey -clear -time \".05:1000\"
  -attribute rz UpperBody"};
checkBox -l "Open/Close Graph Editor"
      -onc {"select -r UpperBody; GraphEditor;"}
      -ofc {"select -cl; deleteUI -window graphEditor1Window"};
setParent..;
setParent..;
setParent..;
//This creates the contents of the second tab:
string $tabContent2 = 'columnLayout';
floatSliderButtonGrp  -l "Bend Back" -f true -fmn -50 -fmx 50 -s
  1 -min -30 -max 30
      -cal 1 left -cw5 65 40 160 50 35
      -bl "Reset" -bc "setAttr BackBend.rz 0"
      -sbc "setKeyframe BackBend.rz " -sbd true -i "SETKEYSMALL.
  xpm"
BendBackSlider;
connectControl BendBackSlider ("BackBend.rz");
setParent ..;
//This creates the contents of the third tab:
string $tabContent3 = 'columnLayout';
floatSliderButtonGrp  -l "Hip Swing" -f true -fmn -60 -fmx 60 -s
  1 -min -45 -max 45
      -cal 1 left -cw5 65 40 160 50 35
      -bl "Reset" -bc "setAttr Hips.rz 0"
      -sbc "setKeyframe Hips.rz" -sbd true -i "SETKEYSMALL.xpm"
HipSwingSlider;
connectControl HipSwingSlider ("Hips.rz");
setParent ..;
//This creates the contents of the fourth tab:
string $tabContent4 = 'columnLayout';
floatSliderButtonGrp  -l "Head Tilt" -f true -fmn -60 -fmx 60 -s
  1 -min -45 -max 45
      -cal 1 left -cw5 65 40 160 50 35
      -bl "Reset" -bc "setAttr Head.rx 0"
      -sbc "setKeyframe Head.rx" -sbd true -i "SETKEYSMALL.xpm"
HeadTiltSlider;
connectControl HeadTiltSlider ("Head.rx");
setParent ..;
//This edits the tabLayout command to label each tab:
tabLayout -edit
      -tabLabel $tabContent1 "Torso"
      -tabLabel $tabContent2 "Back"
      -tabLabel $tabContent3 "Hips"
      -tabLabel $tabContent4 "Head"
$tabs;
setParent SubPanels;
setParent TopPanels;
//This creates the small bottom panel:
rowLayout -nc 2 -ad2 2 -cw2 50 600 -cat 2 "left" 55;
symbolCheckBox
      -ofi "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\extras/\
  icons/\USERPLAYANIM.BMP"
      -oni "C:/\ProgramFiles/\AliasWavefront/\Maya4.5/\extras/\
  icons/\USERSTOPANIM.BMP"
      -onCommand "play -forward true" -offCommand "play -state
  off";
//button -l "PLAY" -w 40 -c "play -forward true";
//button -l "STOP" -w 40 -c "play -state off";
timePort;
setParent..;
setParent TopPanels;
window -e -wh 800 600 -topLeftCorner 50 50 CharacterWinAdv2;
showWindow CharacterWinAdv2;

    This code creates a multipanel character window that contains many of the controls you will need to animate your character (see Figure 6.18). Create additional controls that you think may be useful by doing the action in the regular Maya interface, and then copying the command into the flags of an appropriate MEL control. Keep building your character window until you think it is sufficient for your animation purposes.

    6.18. Your advanced character window should contain all the controls you have been creating, plus view windows and timeline controls, in the new pane layout configuration.


Going Further with MEL

Although the main focus of this chapter is to show you how to use MEL scripting to create character controls, you can do many other useful things with MEL. This section introduces you to some more advanced MEL scripting concepts that you can use to enhance your character controls and use to create custom tools that will enhance your Maya working environment.

Using Expressions with MEL

You can create expressions in your MEL scripts by using the expression command. Expressions can prove useful if you are trying to automate some of the character setup process. The -o or -object flag is useful if you are constraining multiple attributes on an object, because this flag enables you to state the object name only once, whereas the -s or -string flag is used to specify the actual expression connections. If you have multiple lines in your expression, make sure to place double quotes and curly brackets around all of them. Use the -n or -name flag to give your expression a name, which will then show up in the Expression Editor under the By Expression Name filter. To create the average expressions used in Chapter 4, "Character Skeleton Setup," to constrain the torso to stay between the feet, for instance, you would run the following MEL code in the Script Editor:

expression -object "UpBodAuto1" -name "Averages"
-string {"tx = (LtLeg.tx + RtLeg.tx) / 2; tz = (LtLeg.tz + RtLeg.tz) / 2; ry = (LtLeg.ry
  + RtLeg.ry) / 2;"};

Because MEL and expressions are evaluated in different ways, usually you want to avoid using MEL commands in your expressions. Alias Wavefront recommends not using MEL commands that connect attributes, create objects, or delete objects in expressions. Sometimes, however, it is necessary to use some MEL commands to create specific effects. For instance, there is no delay expression function in Maya, but you can use some MEL commands to create a delay effect. This can prove useful for creating a whipping tail effect.

If you have a character with a tail, it is best to model the tail with no pose on it, so it comes straight out of the back of the character. It should have enough isoparms or edges on it to bend smoothly. To animate such a tail, you create several joints starting in the pelvis area, going straight back to end at the tip of the tail. The joints should be named TailRoot, Tail2, Tail3, and so on. The tail should move with the hips, so make the TailRoot joint child of the H3 joint, with two group nodes in between. Bind the tail model to the tail joints in the same way as you bound all your other skins. After you have done this, open the Expression Editor, and in the Expression Name filter, create a new tail whip expression that contains the following code:

int $time = 'currentTime –query';
int $delay1 = 'getAttr –time ($time – 10) Hips.ry';
int $delay2 = 'getAttr –time ($time – 20) Hips.ry';
int $delay3 = 'getAttr –time ($time – 30) Hips.ry';
int $delay4 = 'getAttr –time ($time – 40) Hips.ry';
//TailRoot is just parented to move exactly with the Hips box:
Tail2.rz = 0 + Hips.rz;
Tail3.rz = 0 + $delay1;
Tail4.rz = 0 + $delay2;
Tail5.rz = 0 + $delay3;
Tail6.rz = 0 + $delay4;

Click Create to connect the tail joints to the Hips box with a delay effect. Because this expression references the timeline, however, you won't see the effect until you set Y rotation keyframes on the Hips box, and play the timeline. The expression creates the whipping effect by first querying the timeline to see what is the current frame, and puts the result in a $time variable. Then it creates $delay variables that contain the value of the Hips box's rotation in Y at previous frames. It is using the -time flag on the getAttr MEL command in conjunction with the $time variable to do this. Finally, it is assigning each delay variable to the tail joint's Z rotation, starting with the second joint.

Global Procedures and Scripts

Similar to using expression functions, the useful thing about using MEL commands is that they do a lot of complex operations for you (without you having to write the explicit code). It simplifies and shortens your script writing by grouping several tasks under a single named command that is held in Maya's memory and called whenever you need it. You can do a similar thing by creating your own named commands, which are called procedures. Procedures enable you to group many MEL commands and operations into a single named command that you load into Maya's memory so that you can use them in all of your scripts. A regular procedure is a command that is declared and used in the same script, whereas global procedures are more like MEL commands, in that they go into Maya's memory and are available to use in all your MEL scripts.

You declare a regular procedure with the following syntax:

proc Name ()
{
All your MEL commands go here;
}

You declare a global procedure with the following syntax:

global proc cmName ()
{
All your MEL commands go here;
}

If the procedure is something that you think you will need to access in more than one script, it should be a global procedure. Notice that the name in the example global procedure is written differently than the name of a regular procedure. The general convention is to add your initials to the beginning of the name on a global procedure. The reason for this is that a global procedure goes into Maya's memory and can overwrite one of Maya's procedures if they have the same name. If you create a global procedure named setAttr, for instance, it will overwrite Maya's setAttr command until you clear out memory by relaunching the program. To avoid this problem, your global procedure must have a unique name.

When you declare a procedure, it doesn't run the code within the curly brackets. It places the code in memory to be called whenever the name of the procedure is entered on the command line or referenced in a script. A procedure can contain a single MEL command, or multiple lines of complicated MEL code. Procedures in your character window scripts enable you to make your scripts more compact and modular—for example, by using procedures for the contents of each of your panels. For instance, running the following simple procedure in the Script Editor places the procedure named Test in memory:

proc Test ()
{
print "My test procedure is working!";
}

If you enter the name of your Test procedure on the command line or in the Script Editor, a result in the History field will state "My test procedure is working!" The empty parenthesis after the name tells Maya that the user only needs to type in the name of the procedure to run the code. If you declare empty variables within the parenthesis, Maya expects the user to input some information that will be used in the procedure. To create a basic slider, for instance, you need to tell Maya what should be placed in the flags of the attrFieldSliderGrp command. Here is how you write a simple procedure that creates a slider with the label, limits, and attributes set by the user:

proc slider1 (string $label, int $min, int $max, string $attr)
{
attrFieldSliderGrp -l $label -min $min -max $max -at $attr;
}

In this procedure, several empty variables are being declared; the user of the procedure inputs these. The procedure name and variable information can then be used in a window script that creates multiple sliders, like this:

if ('window -exists SliderWin') deleteUI SliderWin;
window -t "Make Sliders" SliderWin;
columnLayout;
slider1 "Crouch" -7 1 UpperBody.ty;
slider1 "BackBend" -45 45 BackBend.rz;
slider1 "Head Nod" -30 30 Head.rx;
showWindow SliderWin;

Procedures can certainly compact your window script by using the same process to create advanced sliders, like this:

global proc cmSlider (string $label, int $min, int $max, string $attr, string $name)
{
floatSliderButtonGrp  -l $label -f true -s 1 -min $min -max $max
      -cal 1 left -cw5 65 40 160 50 35
      -bl "Reset" -bc ("setAttr " + $attr + " 0")
      -sbc ("setKeyframe " + $attr) -sbd true -i "SETKEYSMALL.xpm"
      $name;
connectControl $name ($attr);
}
if ('window -exists SliderWin') deleteUI SliderWin;
window -t "Make Sliders" SliderWin;
columnLayout;
cmSlider "Crouch" -7 1 UpperBody.ty SL1;
cmSlider "BackBend" -45 45 BackBend.rz SL2;
cmSlider "Head Nod" -30 30 Head.rx SL3;
showWindow SliderWin;

As you can see from this example, creating a global procedure for the advanced slider condenses the code for each individual slider to a single line in your window script. Notice that it is sometimes necessary to adjust the placement of double quotes so they don't contain variables, because this will cause Maya to recognize them only as a text string. Use the addition symbol to add variables to text strings. Also use spaces within the text strings to make sure the command is read correctly.

A procedure must be run to place it in memory. Often, you are using multiple procedures, so they must all be put into memory to use them in your scripts. The easiest way to do this is to place the procedures in script files, which are just text files that are saved with an .mel extension. You can create a Maya script file in two ways. You can place many regular procedures in the script, making sure the last procedure is a global procedure with the same name as the script file. This file is read into memory when the global procedure name is called.

The other way to create a script file is to save multiple global procedures into one script, and load all the global procedures into memory by using the source command followed by the name of the script. Either way, your script files need to be placed in the right directory for Maya to find them. To find the location of this directory, open your Script Editor and choose File, Open. A window opens in which you can choose a script file from your Scripts folder, which should be located within your user login Maya directory. To easily source all the procedures you need to reference in a character window script, for instance, you can put a source command at the beginning of your window code, like this:

source SliderScript;
if ('window -exists SliderWin') deleteUI SliderWin;
window -t "Make Sliders" SliderWin;
columnLayout;
cmSlider "Crouch" -7 1 UpperBody.ty SL1;
cmSlider "BackBend" -45 45 BackBend.rz SL2;
cmSlider "Head Nod" -30 30 Head.rx SL3;
showWindow SliderWin;

It is not necessary to add the .mel extension when sourcing a script; just specify the name. In the preceding example, the source command is loading a script called SliderScript that contains the cmSlider global procedure, and any other procedures that are needed in the window code.

Writing Conditional and Looping Statements

You write conditional statements in your MEL scripts in the same way you wrote them in your expressions. The standard conditional statement uses an if command followed by an else command, and is used to do two different operations depending on whether the condition in the if command is true or false. In addition to this, you can use an else if command, which enables you to do a third operation based on the result of a second condition. Instead of just executing commands, you can have the conditional statement execute procedures to run several different MEL scripts. The general syntax for doing this is as follows:

if (Condition1) Procedure1;
else if (Condition2) Procedure2;
else Procedure3;

This kind of conditional statement results in Procedure1 running if Condition1 is true. If Condition1 evaluates as false, the second condition is evaluated, and if true, Procedure2 runs. If Condition2 evaluates as false, however, Procedure3 runs. You might use a conditional statement in a character window as a button command that queries the state of controls such as check boxes to see whether they are on or off, and run procedures based on the result.

Another technique used with more advanced scripting is loop creation, often accomplished with a for command. The for command is followed by parenthesis that contain specifications for how the loop should start, end, and increment. Again, you can use procedures in the loop to run multiple operations. The general syntax should look like this:

int $loop;
for ($loop = 1 ;$loop <= 5; $loop++)
{
procedure1;
procedure2;
procedure3;
}

The variable $loop is being declared, and then is being affected by the for command to set the limits on the loop. This loop is set to start at 1, run 5 times, and increment one at a time. Each time it loops, it runs the three procedures in the curly brackets. Loops are used to perform basic tasks over and over again. The one thing you have to be careful of when writing loops is that you avoid writing an endless loop. To avoid this, you must set loop parameters that eventually give a false result. If you run a loop that doesn't have a definite stopping point, you will be forced to terminate Maya.

Creating Script Jobs

One of the main differences between MEL scripting and expressions is that MEL normally evaluates once, whereas expressions are continuously being evaluated. Sometimes, however, you will need your MEL commands to run more often, based on conditions occurring in your scene. Do this by using procedures in conjunction with the scriptJob command. A script job is loaded into memory and runs a procedure when a named condition or event occurs. Some conditions and events available to the command are "SelectionChanged", "SomethingSelected", "ToolChanged", "timeChanged", and "playingBack". For a complete list, type one of the following into the command line:

scriptJob -listConditions;
scriptJob -listEvents;

Use the named condition in the -ct or -conditionTrue flag, and with the -cc or -conditionChanged flag. Use the named event with the -e or -event flag. You can also use the -ac or -attributeChanged flag to make the script job run when a named attribute changes, or use the -tc or -timeChange flag to run it whenever the current time changes. To create a script job that runs a procedure whenever you select something new, type the following:

ScriptJob –e "SelectionChanged" procedure1;

Because a script job is constantly running, you may want to remove it from Maya's memory when you don't need it anymore. You can add a -kws or -killWithScene flag to end the job when you load a new scene. Alternatively, if you place the job in a variable, you can reference it with a -kill flag in a separate scriptJob command to end it. You can place a script job in a variable as follows:

int $scriptJob1 = 'ScriptJob –e "SelectionChanged" procedure1';

The single back quotes place the script job number in the variable $scriptJob1, which enables you to use the -kill flag on it by typing it on the command line, or by placing it in a button command. The kill command should look like this:

scriptJob -kill $scriptJob1;

Exercise 6.4
Finish Your Character Window

In this exercise, you add some controls to your character window that employ advanced techniques such as procedures and script jobs.

  1. Create a control that gives user feedback whenever a control icon is selected on your character rig. When the user selects your character's Head box, for instance, text is written back to the command line saying "Head: rotate X, Y, Z, and use custom channels." The text feedback can be read by the user in the Command Feedback field located at the bottom of the Maya interface. You can also add a command-line control to your character window by using the commandLine command, which creates an Input and Feedback field.

    To create the icon feedback, you must create a procedure that registers what you have selected and places the selected object in an array variable. Then it runs a series of if commands to determine whether the selected object is one of your icons. If the result is true, the procedure prints feedback on the selected icon. Here is an example of how to create this procedure:

global proc cmIconFeedback()
{
string $currentSelection[] = 'ls -sl';
if($currentSelection[0] == "Hips") print ("Hip Control.\n");
if($currentSelection[0] == "UpperBody") print ("Torso Control.\
  n");
if($currentSelection[0] == "LtArm") print ("Left Arm, Forearm,
  Hand, and Fingers Control.\n");
if($currentSelection[0] == "RtArm") print ("Right Arm, Forearm,
  Hand, and Fingers Control.\n");
if($currentSelection[0] == "LtLeg") print ("Left Leg, Foot, and
  Roll Control.\n");
if($currentSelection[0] == "RtLeg") print ("Right Leg, Foot, and
  Roll Control.\n");
if($currentSelection[0] == "Head") print ("Head, Neck, and Jaw
  Control.\n");
if($currentSelection[0] == "Shoulders") print ("Shoulders
  Control.\n");
if($currentSelection[0] == "LtElbow") print ("Left Elbow Control:
   Translate Only.\n");
if($currentSelection[0] == "RtElbow") print ("Right Elbow
  Control: Translate Only.\n");
if($currentSelection[0] == "BackBend") print ("Back Bend Side
  Control: Rotate Only.\n");
if($currentSelection[0] == "BackBow") print ("Back Bow Front
  Control: Rotate Only.\n");
if($currentSelection[0] == "UpBack") print ("Upper Back Posing
  and Twisting Control.\n");
if($currentSelection[0] == "MidBack") print ("Middle Back Posing
  Control.\n");
}

    The procedure is run by a script job that is activated whenever you select something new. You can create a check box control that turns this script job on and uses a kill command to turn it off, as follows:

checkBox -l "Icon Feedback" -al left
      -onc " $feedbackJob = 'scriptJob -e \"SelectionChanged\"
  cmIconFeedback' "
      -ofc "scriptJob -kill $feedbackJob;";
commandLine -w 450 -h 30;

    If you run this code in a window script, you create a check box and command line. With the check box turned off, you should not see any feedback when you select an icon. With the check box turned on, however, you should see some text feedback about the selected icon.

  2. You can use a similar selection-based script to make your character window open automatically when you select a window icon. Place this in a script node, making sure you set Execute On to Open/Close, and the Script option to Before. This causes the script to run as soon as you open your scene. Also add a new window icon to your character rig by creating a W text curve, move it out to the side of your character where it's easy to select, and parent it under the UpperBody icon. Name the W curve OpenWindow. To make a control that automatically opens your window when you select the OpenWindow icon, enter the following MEL script in your script node:

//Place your window in a procedure:
global proc cmMyWin ()
{
if ('window -exists OpenWinTest') deleteUI OpenWinTest;
window -t "Open Window Test" OpenWinTest;
columnLayout;
text -l "My Window Test";
button -l "Close Window" -c "deleteUI OpenWinTest";
showWindow OpenWinTest;
}
//Create a procedure for opening your window when icon is
  selected:
global proc cmOpenWin()
{
string $currentSelection[] = 'ls -sl';
if($currentSelection[0] == "OpenWindow") cmMyWin;
}
//Create a script job that runs whenever selection changes:
scriptJob -e "SelectionChanged" cmOpenWin;

    This example creates a test window whenever you select the OpenWindow icon. Of course, you would want to place your character window in the procedure so that it opens whenever the icon is selected. The test window only contains some text, and a close button that deletes the window through a deleteUI command. The cmOpenWin global procedure checks to see whether the OpenWindow icon is being selected, and runs the window procedure if the result is true.

6.19. Add a window icon to your character that uses a procedure and script job to open your character window automatically when you select the icon.

Creating MEL Custom Tool Windows

In addition to creating character controls, you can use MEL scripting to create custom tool windows to enhance your daily work in Maya. You can create a character setup tool window that contains simple buttons that access your favorite setup commands and tools. For instance, you can create buttons that make different kinds of curve icons. This is more useful than creating a multitude of shelf buttons for each command, because it organizes and labels them in a more user-friendly manner. Then you just create a single shelf button to open your custom tool window.

In addition to creating simple buttons that access tools and commands, you can create more complex procedures that are also accessed in your custom tool window. When doing character setup, for example, you may want to create some procedures that do tedious tasks such as renaming joints, or creating clusters on curve points. As an example, the following script shows how to create procedures for renaming multiple joints:

//This creates a procedure for using in the cmJointNamer procedure:
global proc cmNameJoints (string $newJointName2)
{
string $selJoint[] = 'ls -sl';
string $current;
for ($current in $selJoint)
{
rename $current ($newJointName2 + "#");
}
rename ($newJointName2 + "1") ($newJointName2 + "Root");
}
//This creates a procedure for checking if a name already exists,
//if the name exists, it gives a warning, or it runs the cmNameJoints procedure:
global proc cmJointNamer (string $newJointName)
{
if('objExists ($newJointName + "Root")')
warning("Name Already Used!");
else if('objExists ($newJointName + "2")')
warning("Name Already Used!");
else
cmNameJoints $newJointName;
}

After entering both procedures into memory, you can use the second procedure named cmJointNamer to rename all the joints in a skeleton. Starting with the root joint, Shift-select all the joints you want to rename in the hypergraph view. Then enter on the command line cmJointNamer followed by a new name for the joints. If the name already exists, you get a warning message, and the joints are not renamed. If no warning message occurs, the command should rename the selected joints to the new name followed by Root on the first joint, and by increasing numbers on the rest of the joints. The renaming code generates a selection list, and renames each object in the list by using a for-in loop. A variation of the for loop, the for-in loop is used to repeat actions on each object in an array variable.

The next example is a procedure named cmCurveCluster that creates clusters on each point of a curve. This can prove useful for setting up spline-IK curves, as used on your character's backbone, and for setting up influence object curves on your character's face. This procedure uses a standard for loop to create each cluster based on the number of points on the curve. It is not necessary to select anything to run this procedure; just type in the name of the curve after the name of the procedure. Type in the following MEL code to create the procedure:

//This procedure creates a cluster on each point of a curve:
global proc cmCurveCluster (string $curveName)
{
//This renames the curve temporarily to fix any shape node problems:
string $TempCurveName = "TempCurveName";
rename $curveName $TempCurveName;
//This uses the shape node to find number of points:
string $curve =($TempCurveName) + "Shape";
int $numberSpans = 'getAttr ( $curve + ".spans" )';
int $curveDegree = 'getAttr ( $curve + ".degree" )';
int $numberPoints = $numberSpans + $curveDegree;
//This loop selects the points and creates the clusters:
for ($i = 0; $i < $numberPoints; $i++)
{
select -r (($TempCurveName) + ".cv" + "[" + ($i) + "]") ;
newCluster " -envelope 1";
}
//This sets the curve name back to the original name:
rename $TempCurveName $curveName;
}

Save these example procedures in a MEL script named ToolProcedures.mel, and place them in your login Maya scripts folder. Then you can create a shelf button that sources the ToolProcedures file to load all the procedures into memory.

If you have a lot of procedures, it is difficult to remember how to use them all (the names and whether they require user input, for example). It is much easier to create a window interface to access your procedures. This interface can include directions for how to use each procedure, fields for user input, and buttons for running commands. The following code sources the ToolProcedures file, for instance, and creates a user interface for using the cmJointNamer and cmCurveCluster procedures:

//Declare variables to use in script:
string $windowName = "MyProceedures";
string $nameFieldName = "nameField";
string $curveFieldName = "curveField";
//Source your script with below procedures...
source ToolProcedures;
//Create window:
if(`window -ex $windowName`) deleteUI $windowName;
window -t "Tool Window" $windowName;
columnLayout;
//This creates GUI for the cmJointNamer proceedure:
text "cmJointNamer: Select joints to rename,";
text "then type a new name and click the button below...";
textField -w 300 $nameFieldName;
button -w 300
-l "Click to change joint name to name in field"
-c ("$name = `textField -q -text " + $nameFieldName + "`; cmJointNamer  $name");
text " ";
separator -width 300;
//This creates GUI for the cmCurveCluster proceedure:
text "cmCurveCluster: No need to select anything,";
text "just type the curve name, and click the button below...";
textField -w 300 $curveFieldName;
button -w 300
-l "Click to create clusters on curve in field"
-c ("$curve = `textField -q -text " + $curveFieldName  + "`; cmCurveCluster  $curve");
text " ";
separator -width 300;
showWindow $windowName;

You can place this code in a shelf button or hotkey for easy access. Notice that variables for names of the window and fields are being declared at the beginning of the script, where they are easy to see. This can keep you from accidentally repeating names in different variables when creating more lengthy scripts. The fields are created by a textField command. The buttons are querying the textField commands to place the user input in a variable, which is then used in your procedure variables (see Figure 6.20).

6.20. You can also use MEL scripting to create a tool window that makes it easier for you to run your custom procedures.


Wrapping It Up

This chapter covered creating character controls using MEL scripting. As you use MEL more extensively, you should explore other useful commands that were not covered here. Some of these include aliasAttr, scriptedPanelLayout, formLayout, gridLayout, confirmDialogue, promptDialogue, dagPose, eval, switch, blendTwoAttr, and choice. Use the MEL coding examples in the MEL Command Reference, in the MEL section of the online documentation, and in scripts you find online to explore more uses for MEL. You will really earn your stripes when you try to modify an existing script to do something new. Then you will have to troubleshoot error messages and use all the tools in your arsenal to fix the problems. It is, however, a very satisfying feeling to finally get the right combination to make your script work correctly.

Finally, you can take MEL scripting to the point where you automate the entire character setup process. Because everything you do in the setup process involves MEL commands, you can create procedures out of each step, and then create a user interface that facilitates user input through a series of controls.


Chapter 7. Finishing Your Character for Animation

This final chapter shows you how to finish your character controls by cleaning up and optimizing all the icon channels. You then learn how to consolidate all those channels into a character node that will make it easier to animate your rig. In addition, you are introduced to two animation methods: setting key poses, and using the autokey to animate in a straightforward manner. You also learn how to combine both methods through the use of animation passes. Finally, you learn to simplify and streamline the animation by separating your character controls into multiple rigs of varying complexity.


Preparing to Animate Your Rig

This section shows you how to remove any unnecessary channels on your icons so that they will not get accidentally keyframed during animation. In addition, you check the limits on visible channels, and learn how to lock channels that need to be seen but not manipulated. Finally, you learn how to place all your control channels into a character node, which you can then use to set keys for posing your character, and use to store animation clips.

Cleaning Up Channels

Now that you are finishing up your rig, go back over your character controls and make sure they are optimized for animation. Begin by removing any channels that the animator should not keyframe. In most cases, this includes the scaling channels on all your icons. For instance, select the Head box to remove some channels, and on the top menu bar choose Window, General Editors, Channel Control. In the Channel Control box, a list of Keyable channels appears on the left, and a list of Non Keyable channels appears on the right (see Figure 7.1). Use the Shift key to select all the scaling channels, and click the Move button to remove them from the channel bar. Continue to remove any channels that are not supposed to be animated, such as the constrained translation channels and the visibility channel.

7.1. Use the Channel Control box to remove channels that shouldn't be keyframed on your character rig icons.

Keep in mind that removing channels from the channel bar doesn't necessarily lock or limit them. With the Head box still selected, for instance, you can still resize it with the Scale tool. To lock the scaling channels in the Channel Control box, switch to the Locked tab, and move the scaling channels from the Non Locked list on the right to the Locked list on the left. Only do this on scaling, translation, or rotation channels that you don't want the animator to be able to access through the Tool menu. However, it is not necessary to lock any channels controlled through constraints, expressions, or driven keys. In addition, it is a good idea to add limits to the keyable channels on all your icons. All your custom channels should have the limits already set (from when you created them), but the translation and rotation channels have no limits. For instance, the only channels that require limits to be set on them for your character's Head box are the rotation channels. Do this by opening the Attribute Editor, and on the Transform tab open the Limit Information section to set the rotation limits as needed.

After you have cleaned up and set limits on the Head box, continue the same process through the rest of your character controls. For instance, your character's arm boxes should only contain translation and custom channels for the forearms, hands, and fingers. Some controls, such as your arm and leg boxes, do not need limits to be set on them, because the warnings controls created in Chapter 3, "Character Skeleton Setup," are sufficient.

Making Your Rig into a Maya Character

One thing you can do to make animating easier and more efficient is to create a character node for your rig controls. Doing this consolidates all your icon channels into one node, which you can then use to set keys easily. For instance, such a node prevents you from having to list all your icon channels in a MEL-scripted Key All button. You can instead use a setKeyframe command that only specifies the name of the character node in your MEL button. In addition, you can use a character node to set keys for posing your character, and then use the Trax Editor to easily store and assign the key poses as animation clips. Called nonlinear editing, this is one of the most flexible ways to rough out your animation, but requires you to first create a character node.

Exercise 7.1
Create a Character Node and Pose Clips

In this exercise, you assign all the animation channels in your rig to a character node. Then you create poses for your character as single-frame clips in the Trax Editor.

  1. To create a character node, use the Shift key to select all your icon controls, and choose Character, Create Character Set [image]. In the resulting options box, choose the All Keyable Except option, and turn on the No Scale, No Visibility, and No Dynamic check boxes. These settings will assign only the rotation and translation channels of your icons to the character set. Type in the name MyCharSet for your character node, and click the Create Character Set button.

    Make sure the current character is set to MyCharSet under Character, Set Current Character Set, and select the character node to view its channels by choosing its name under Character, Select Character Set Node (see Figure 7.2). Notice in the channel box that only the translation and rotation channels of your icon controls have been placed in the character set. You need to add your other custom channels manually to the MyCharSet node. For instance, select an arm box, use the Shift key to select the armTurn, handWave, handShake, and all the finger channels, and choose Character, Add to Character Set. This adds the channels to the current character set. You must do this for all the icons on your character that contain custom channels. Also remove from the character set any translation or rotation channels that are not needed for animation. If there are any rotation channels for either arm box in your character node, for instance, Shift-select them all in the channel box, and choose Character, Remove from Character Set.

    7.2. After creating a character node, select it to view and edit its channels to make sure it contains all the correct attributes for animating your character rig.

  2. When your character node contains all the attributes you need for animating your character, you can then create some poses for your character and store them as clips. Before creating any poses, make sure you have a MEL button or a shelf button that contains a command for keyframing your character node. The MEL button should contain the following command:

    button –l "Key All" –c "setKeyframe MyCharSet";

    There is also a function in the Trax Editor for storing poses, but I recommend setting keys for poses and storing them as single-frame clips instead. The difference between creating a pose and creating a clip in the Trax Editor is that a pose has no keys associated with it, whereas a clip does. Normally clips are made from multiple frames of animation. However, you can also create a single-frame clip that acts like a pose, but can later be merged with other single-frame clips to create a multiframe clip that contains your entire animation. Poses do not work in the same way, and are not as reliable.

    Choose Window, Animation Editors, Trax Editor to view your new character in the Trax Editor. Begin by creating a single-frame clip for your character's default pose. Do this by setting a key on your character set at frame 1, and then on the top menu bar of the Trax Editor choose Create, Clip [image]. Name the clip Default, and set the other options to Put Clip in Visor Only, and specify a Start Time of 1 and an End Time of 2 (see Figure 7.3). Do not include subcharacters for this clip or turn on the Hierarchy option. This removes the keys you set for the default pose, and places them in a single-frame clip in the visor. To view the new clip, in the Trax Editor choose File, Visor. Under the Character Clips tab in the visor, you should see a Default clip node. Repeat the process by moving your character controls to make your character crouch, set another key, and then create a single-frame clip named Crouch.

    7.3. When creating a clip from a single pose, set the start and end time options for the clip to have a duration of only one frame.

    Because you are creating another single-frame clip, all you need to do is translate the UpperBody icon down to create a crouch pose, click your Key All button, and create a clip with the same settings as the Default clip. Keep in mind that all your single-frame clips should have only one keyframe in them. You also can create multiframe clips in the Trax Editor by specifying a series of frames in the Create Clip options box, but you would normally not do so when roughing out an animation with key poses.

  3. When you have finished creating clips, it is easy to assign them back to your character. Just select one in the visor, and use the middle mouse button to drag it onto the track to the right of your character node in the Trax Editor. Place the Default clip on frame 1, and the Crouch clip on frame 60. Make sure you set the timeline in the visor correctly by choosing View, Frame Timeline Range. Also change the options to Large Track Height, and use the Alt key to zoom in on the keys if needed when positioning. You can use the left mouse button to drag the poses to the correct frames. If you then scrub the timeline at the bottom of the Trax Editor, you should see your character abruptly change from its default pose to your crouch pose on frame 60 (see Figure 7.4). You can use this technique to block out your animation using the pose-to-pose method as described in the next section.

    7.4. Place your single-frame clips in the Trax Editor to rough out your animation with static poses, and then play the timeline to evaluate the result.


Animation Methods

In this section, two main approaches to keyframing your rig are described. These involve setting keys on full poses at specific frames to rough out your animation, or setting keys on individual controls as needed while progressing through your animation. The combination of both methods in different stages of your animation is shown as a commonly used procedure for animating a 3D character.

The Pose-To-Pose Animation Method

One character animation technique you can use is the pose-to-pose method. This involves setting keys on all your controls at particular frames to create the main poses for the action in your animation. In-between poses are ignored in the beginning to sketch out the overall timing for the scene. It is very easy to determine how long a scene should be when using this method. If your scene needs to be 60 seconds, for instance, you can set a beginning pose at 0 seconds, an end pose at 60 seconds, and a middle pose at 30 seconds. Then you can refine the animation by adding in-between poses at 15 and 45 seconds, and continue refining the animation by adding more in-between poses.

As shown in the preceding section, one way to set poses is to create a character node, and key it manually to store a library of poses as single-frame clips that can then be assigned in the Trax Editor. This method enables you to easily rough out your animation and adjust the timing. You can drag all your clips onto a track, and position them as needed. Playing or scrubbing the timeline shows each clip as a still pose for a period of frames. When the rough animation is looking pretty good as static poses, add smooth transitions between each pose by creating blends between the poses. Just select the first clip, Shift-select the second clip, and choose Create Blend [image]. Set the Initial Weight Curve option to Ease In Out to create a smooth transition curve, and click Create Blend. This creates a transition from one pose to the next with a variation on the timing so that the animation slows down going into and out of a pose (see Figure 7.5). You can still adjust the position of the clips on the track with blends attached, or add more in-between clips to continue refining your animation.

7.5. Creating a blend produces a smooth transition curve between poses in the Trax Editor.

The Straightforward Animation Method

The straightforward method of animating is when you build your animation gradually from start to finish. Traditionally, animators would draw each cell, one at a time, until the intended action was done. This produced a very flowing, intuitive, and sometimes unexpected result. Stop-motion animators also use this method. In the computer, you usually aren't required to set keys on every frame, but you can still keyframe your controls as you progress through your animation. Starting at frame 1, you begin setting individual keys as you move each control, and continue in this manner until you finish animating the scene. If using MEL-scripted character controls, for example, you click the key buttons to the right of each advanced slider after moving it. An even easier way to use this method is to turn on Autokey. First, you make sure there is a keyframe on all your controls at frame 0 with your character in its default position. Then you toggle on Autokey by using a MEL check box, or by clicking the key button in the lower-right of the Maya interface, and start adjusting your controls at frame 1. With Autokey turned on, continue moving controls as you slowly move the timeline forward. Having Autokey turned on automatically sets keyframes whenever you change an animation control, enabling you to build your animation gradually without setting overall poses.

One drawback of using the straightforward method is that you never know exactly how long a particular scene will be, because it unfolds gradually. To be successful when animating in this way, you must have a good sense of timing. Some animators have an intuitive sense of timing; whereas others need to act out their scene, and use a stopwatch to find out how long each action should take. Either way, this method requires that you continuously scrutinize the timing by playing the animation in real time after you set a few keys.

Layering Animation

Most 3D animators don't exclusively use one or the other of the previously mentioned animation methods. Instead, they use a combination of both methods to take advantage of the benefits of each. Do this by creating your animation in stages, called animation passes. The first pass should involve creating key poses for the main body motion through 3D space, so the timing of the entire animation can be sketched out. Achieve this by creating poses and setting keys on the main icons for the legs, arms, and upper body, while not animating other icons on your character rig. The idea is to focus on timing the large body movements, and not waste time on subtle details. In-between poses are added until the entire animation is roughed out. When the overall body motion is blocked out with the correct timing, more passes are keyframed on additional controls to refine the movement of all the parts of the body. For instance, a second pass involves setting keys on controls for the backbone, shoulders, head, hands, and feet. Additional passes are done to animate the face, fingers, toes, hair, muscles, and clothing. Generally speaking, you begin by using the pose-to-pose method; in later passes, however, you increasingly use the straightforward method as you layer on details. This enables you to get the overall timing correct when the animation is simple, and then create more complex variations that are not necessarily on any particular key pose to make the movement more believable.

Exercise 7.2
Creating Subcharacter Nodes

In this exercise, you create subcharacter nodes for groups of controls on your rig. This enables you to keyframe animation passes more easily.

  1. Setting key poses on specific groups of controls requires that you create several subcharacter nodes. You must first have a character node created, and make sure it is selected under Set Current Character Set. Select the character node so that you can see its channels in the channel bar, and then use the Shift and Ctrl keys to select the channels that you want to group for a particular animation pass. For instance, select the transform channels for the arm boxes, leg boxes, elbow arrows, knee arrows, and UpperBody icon for a rough animation group. When selected, choose Character, Create Subcharacter Set [image]. Name such a set RoughSet, and set the Subcharacter Set Attributes option to From Channel Box. Click the Create Subcharacter Set button to remove the selected channels from the main character node, and place them in a subcharacter node named RoughSet. This enables you to create a MEL button that just sets keys on the channels in RoughSet by making the –c flag point at the subcharacter like this:

    button –l "Key Rough Pose" -c "setKeyframe RoughSet";

  2. Make additional subcharacter sets to easily set keys on each group of controls. You can still have a Key All button, because the subcharacter nodes are actually children of the main character node, and will receive keys whenever the main character is keyframed. Your subcharacter set nodes can be selected and be assigned as the current character in the Character menu. Be aware that if you make a subcharacter the current character set, and then add another subcharacter, the new subcharacter is made the child of the current subcharacter.


Streamlining the Animation Process

So far, you have been creating all your character controls on one big rig in a single scene. This section presents an alternative way to animate your character: separating your controls into multiple rigs in separate scenes. This keeps your scenes less complex in the early stages of your animation, which can simplify and speed up the animation process.

Separating Controls into Multiple Rigs

The reason for using separate rigs in separate scenes is much the same as for animating in multiple passes, as described in the preceding section. You can start with a simple rig that only has arm, leg, head, and torso controls for the main skeletal joints, with no deforming skin even in the scene. Use this rig to rough out the overall character motion in your scene. Then export and import clips of the animation from the scene containing the basic rig to another scene that contains a more complex rig with controls for the joints of the hands, feet, head, individual shoulders, and so on. The second rig still has no muscle controls or deform able skin, however, only skeletal joints and polygon reference bones. The timing for the animation is taken to completion using this second rig. In addition, you can have a separate scene containing an animated face rig, which you merge with the scene that contains the completed body animation. Connect the face animation to the main body skin through a blend shape as described in Chapter 4, "Deforming the Skin." Then, you import the final skeletal and face animation to a rig that contains all the previous controls, plus muscle controls and deformable skin. The finished animation is then tweaked and enhanced using muscle and skin deformers, as well as skin shaders, and is rendered for final compositing.

Exercise 7.3
Using Multiple Rigs

This exercise introduces you to using separate rigs. You animate a simpler version of your character rig, and then export the animation out as a clip that can be assigned to your finished skeletal rig in the Trax Editor.

  1. Create a simpler rig by either opening an early version of your advanced rig, or by removing some of the advanced channels and controls on your current rig. Ideally, you want a rig that only has controls for animating the arm boxes, leg boxes, elbow icons, knee icons, Hips box, shoulders icon, Backbone circles, and UpperBody icon. You do not need controls for the hands, feet, fingers, individual shoulders, advanced backbone, head, hair, muscles, or face. It is important that the basic rig controls have the same channel values as the advanced rig controls. It is also important that you include automatic expressions that you are using on the advanced rig, such as the averages on the UpBodAuto node. If these are not the same on both rigs, the animation will not transfer correctly. Also make sure the names for the controls are exactly the same on both rigs. Save the basic rig in a scene called LowResRig, and save your advanced rig in a scene called HighResRig.

    When you have your basic rig finished, use the process described earlier in this chapter to create a character node named LowResChar that contains all your basic control channels. Then create poses from single-frame clips, and use the Trax Editor to block out a basic animation. After you have several poses placed on a track, create blends between them to create smooth transitions. Continue refining the animation until you are happy with the result.

  2. To refine your animation by creating in-between poses from the animation blends, you must first merge all your single-frame clips into one large multiframe clip. Do this by Shift-selecting all the single-frame clips in the Trax Editor, and choose Edit, Merge [image]. In the options box, name the clip appropriately, and make sure the Add to Trax option is turned on. Click the Merge Clip button to create one large clip for your animation (see Figure 7.6).

    7.6. Merge all your single-frame clips and blends into one large clip.

    To create in-between poses, select the merged clip and split it one frame before and one frame after where you want to place the pose. To create an in-between pose at frame 25, for example, set the timeline to 24, and choose Edit, Split [image]. In the options box, set the Source Clip option to Keep Original Source, set the Split Time option to Current Time, and click the Split Clip button. This splits the clip, creating two new clips. Use the same process to split the second clip at frame 26. Delete the small clip in the middle, and proceed to pose your character as needed (see Figure 7.7). Create another single-frame clip for the new in-between pose, and place it in the empty space. To smooth out the transition, split the clips on either side of the in-between clip to create a 5- to 15-frame gap, and create a blend between each of the clips. You can also size the clips a little to improve timing by putting your cursor over the ends of the clips and dragging with the left mouse button. Finally, when everything looks good, merge all the clips together again into one large clip. You can delete clips that were created during the splitting process from the visor when they are no longer needed.

    7.7. You can split a clip to insert a new pose into your basic animation.

  3. Keep in mind that using single-frame clips to create poses is just one way to rough out your animation. You can also just use your Key All button to set key poses and in-between poses, and adjust the keyframes in the dope sheet and Graph Editor as needed. This has some advantages if you choose to use the straightforward method when layering animation on top of your rough pose-to-pose animation. Setting random keys on top of animation clips in the Trax Editor can cause unpredictable results. If you plan to layer animation, it is better to build your animation in the traditional way, and then create a clip out of the entire animation after you have finished. You can use this method to create your entire animation, or create specific actions that you can add together in the Trax Editor to produce your final animation. After your animation clip is stored in the visor, you can use the Trax Editor to adjust it, or blend it with other clips. Keep in mind that if you need to access the source animation curves for a clip, you can do so in the Trax Editor by choosing View, Graph Anim Curves.

  4. You can move animation between scenes in Maya in several ways, including importing animation curves, importing clips, and referencing scenes. In this exercise, you use the Trax Editor to export the final merged clip you stored for the LowResRig file, and import it into the HighResRig file to assign it to the advanced character rig.

    First, create an empty scene file named ClipsScene that you will use to hold the clips you want to move between scenes. In the LowResRig scene, export your final merged clip by selecting it in the Trax Editor and choosing File, Export Clip. In the Export options box, select the ClipsScene file, and overwrite it. If you open this file to check it, you should find your exported clip in the visor under the Unused Clips tab. Then open your advanced rig scene file, and make sure you create a character node for your advanced character rig that contains all the channels used in the basic rig, plus all the additional channels required for animating details in the hands, feet, torso, and head areas. Name your advanced rig character node HighResChar, and make sure it is set as the current character. Then in the Trax Editor, choose File, Import Clips to Character [image]. In the resulting options box, turn on the Put Clip in Trax Editor and Visor option, and click the Import Clip button. You should see your animation clip in the Trax Editor. Scrub the timeline to see whether the animation was assigned correctly.

  5. If you were careful in setting up your character nodes, your basic animation should import to the channels with the same names on your advanced rig controls. If the animation isn't being assigned correctly, delete the clip and try importing the clip directly from the LowResRig scene file. Choose the Import Clip option, and select the LowResRig file that contains your final clip. This actually imports the entire basic rig and LowResChar character node. You can then export out a character map file by selecting both characters in the Trax Editor and choosing File, Export Character Map [image]. Choose the By Node Name option to export according to the object and attribute names in your character nodes. Name the file HighLowMap, and save it in your local login scripts directory. This creates a .mel file with your other script files that can be edited. Open the file in the Script Editor or with Notepad, and notice that it contains a list of all the channels in each character. Edit the file so that the correct names match up in the left and right columns. Channels in the HighResChar node that have no equivalents in the LowResChar node have UNMAPPED_ATTR written beside them, like this:

DoNotMove|Rig|Feet|LtLeg.footRoll     UNMAPPED_ATTR    \
UpBack.translateX                    UNMAPPED_ATTR    \
UpBack.translateY                    UNMAPPED_ATTR    \
UpBack.translateZ                    UNMAPPED_ATTR    \
DoNotMove|Rig|Feet|RtLeg.rotateZ         |Rig|Feet|RtLeg.rotateZ
      \
DoNotMove|Rig|Feet|RtLeg.rotateY         |Rig|Feet|RtLeg.rotateY
      \
DoNotMove|Rig|Feet|RtLeg.rotateX         |Rig|Feet|RtLeg.rotateX
      \
DoNotMove|Rig|Feet|RtLeg.translateZ      |Rig|Feet|RtLeg.
  translateZ  \
DoNotMove|Rig|Feet|RtLeg.translateY      |Rig|Feet|RtLeg.
  translateY  \
DoNotMove|Rig|Feet|RtLeg.translateX      |Rig|Feet|RtLeg.
  translateX  \

    When the file is correct, save it over the old one, and run it by typing the following commands in the Script Editor:

    source HighLowMap;

HighLowMap;

    Open the visor and drag the final merged basic animation clip from the Character Clips tab onto the HighResChar track. You should see the advanced rig moving in the same way as the basic rig. When the low-resolution animation is working on the advanced rig, open a hypergraph view and delete the basic rig from the HighResRig scene file.


Wrapping It Up

At this point, you should have a pretty good understanding of how to begin animating the character you have been developing throughout this book. Animation is an important topic that can require an entire book to cover in detail. Fortunately, many resources are available at your local bookstore for you to explore. From this book, I hope you have learned skills that make you better prepared to tackle the tasks involved in modeling and setting up animation controls for 3D characters. These skills are just as important as animation skills in creating a believable character, and can lead to an equally rewarding career choice. I wish you the best of luck on your journey as a 3D character artist.


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

* (asterisks)
-ac flags
-adj flag
-adjustableColumn flags
-al flags
-align flags
-at flag
-at flags
-attribute flags
-attributeChanged flags
-bc flags
-borderStyle flags
-bs flags
-buttonCommand flags
-cal flags
-cll flags
-cn flags
-collapsable flags
-columnAlign flags
-conditionTrue flags
-configuration flags
-ct flags
-e flags
-event flags
-fieldMaxValue flags
-fieldMinValue flags
-fmn flags
-fmx flags
-fn flags
-font flags
-horizontal flags
-hr flags
-i flags
-iconOverlayLabel flags
-image flags
-iol flags
-killWithScene flags
-kws flags
-l flag
-l flags
-label flag
-lable flags
-mainWindow flags
-mw flags
-nc flags
-nr flags
-numberOfColumns flags
-numberOfRows flags
-o flags
-object flags
-ofc flags
-offCommand flags
-offImage flags
-ofi flags
-onc flags
-onCommand flags 2nd
-q flags
-query flags
-rat flags
-rowAttach flags
-s flags
-sbc flags
-select flags 2nd
-sl flags
-st flags
-string flags
-style flags
-symbolButtonCommand flags
-t flags
-tc flags
-timeChange flags
-tlc flags
-tool flags
-topLeftCorner flags
-w flags 2nd
-width flags 2nd
-windows flags
-wnd flags
/ (forward slash)
// (forward slashes)
3D characters
designing 2nd 3rd 4th
preproduction designs 2nd 3rd 4th 5th


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

Adam's apples
creating
adding
blend shapes
to faces 2nd 3rd
buttons
to windows 2nd 3rd 4th 5th
comments
to code 2nd
controls
to lower arms and hands 2nd 3rd 4th 5th 6th 7th 8th 9th
face influences to the head 2nd 3rd 4th 5th 6th 7th 8th 9th
rebinding head and face skeletons
faces
to heads
foot controls 2nd 3rd 4th
images
to character character windows 2nd 3rd 4th 5th
joints
multiple branches to single joints
muscle influences 2nd
scrollbars
sliders
to controls 2nd 3rd 4th
to windows 2nd 3rd 4th 5th
springs
adjusting
weights
on characters 2nd
advanced character windows
building 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th
anatomy
of skeletons 2nd
angles
preferred angles
editing skeletons
animating
blend shape sliders 2nd
tails
animation
layering 2nd 3rd 4th
pose-to-pose animation method 2nd
separating controls into multiple rigs 2nd 3rd 4th 5th 6th 7th
straightforward animation method 2nd
animation passes
appending
polygons
arms
forearms
adding controls 2nd 3rd 4th 5th 6th 7th 8th 9th
NURBS arms
creating
arrays
assigning
blend shapes
to skin 2nd 3rd
controls
to attributes
default object manipulators
lattices to skin 2nd 3rd
rigid skin binds
asterisks (*)
attaching
NURBS spheres
attrFieldGrp command
attrFieldSliderGrp command
Attribute Editor
attributes
assigning to controls
avoiding
overlapping geometry


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

backbones
controlling
with math expressions 2nd 3rd 4th 5th 6th 7th 8th 9th 10th
creating flexible backbones 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th
ball joints
binding
head and face skeletons
skin
rigid skin binding 2nd 3rd 4th 5th 6th 7th 8th
binding the skin
bindn pose
blend shapes 2nd
adding to faces 2nd 3rd
assigning to skin 2nd 3rd
deformers
reordering 2nd
editing 2nd 3rd 4th
sliders
mixing and animating 2nd
target shapes
tips for making 2nd 3rd 4th
tweaking skin deformations 2nd 3rd 4th 5th
bodies
creating NURBS character's body 2nd 3rd 4th 5th 6th 7th
body part
feet. [See feet]
body parts
Adam's apples
creating
arms
creating
arms. [See arms]
avoiding overlapping geometry
backbones
ears
creating
creating with NURBS surfaces
eyeballs
creating 2nd 3rd
eyeballs creating
eyelids
creating
radial NURB eye patches 2nd 3rd
eyes. [See eyes]
faces
completing on NURBS heads 2nd 3rd 4th 5th 6th 7th
faces. [See faces]
feet
creating
feet. [See feet]
hands
creating 2nd
hands. [See hands]
heads
creating from NURBS surfaces
heads. [See heads]2nd [See heads]
jaws
contouring
jaws. [See jaws]
joints. [See joings]
legs
creating 2nd 3rd
limbs
connecting to torsos with fillets 2nd 3rd 4th 5th
connecting with patch modeling 2nd
lofting from torso surfaces 2nd 3rd 4th 5th
shoulders. [See shoulders]2nd [See shoulders]3rd [See shoulders]4th [See shoulders]5th [See shoulders]6th [See shoulders]7th [See shoulders]
skin
creating NURBS multipatch skin 2nd 3rd 4th 5th 6th 7th
toes
torsos
NURBS torsos. [See NURBS torsos]
torsos. [See torsos]
bones
polygon reference bones
placing 2nd
skin sliding over 2nd 3rd 4th 5th
breathing expressions
bump maps
creating wrinkles in skin 2nd 3rd 4th
button command 2nd
buttons
adding to windows 2nd 3rd 4th 5th
Intersect
Move Icons button
Save All Shelves
tool buttons
creating
By Expression Name filter 2nd


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

changeToolIcon command
changing
amount that channels constrain other channels
channels
changing amount that channels constrain other channels
cleaning up 2nd 3rd
connecting 2nd 3rd 4th 5th 6th 7th 8th 9th
with Connection Editor 2nd
with Expression Editor
with set driiven keys 2nd 3rd 4th 5th 6th 7th
removing 2nd 3rd
scaling channels
locking
character animation
digital 3D character animation
in films 2nd 3rd 4th 5th
character controls. [See also controls]
character modelers 2nd
role of 2nd 3rd 4th
character nodes
creating 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th
for rig controls 2nd 3rd 4th 5th
character rigs
backbones
creating flexible backbones 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th
conditional expressions
writing 2nd 3rd 4th 5th 6th
constraining
torsos to feet 2nd 3rd 4th 5th 6th 7th
creating 2nd 3rd 4th 5th 6th 7th 8th
feet
creating a rolling foot 2nd 3rd 4th 5th
functions
creating additional controls 2nd 3rd 4th 5th 6th
warning signs
creating 2nd 3rd 4th 5th 6th
character rigs. [See also skeletons]
character setup artists
roles of 2nd 3rd 4th 5th
character setups
character windows
adding
images 2nd 3rd 4th 5th
building advanced character windows 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th
creating 2nd 3rd 4th
finishing 2nd 3rd 4th 5th
multipanel windows 2nd 3rd 4th
refining 2nd 3rd 4th 5th 6th 7th 8th 9th
characters
3D characters
designing 2nd 3rd 4th
preproduction designs 2nd 3rd 4th 5th
controlling faces
with dummy heads 2nd
converting
polygon characters to subdivision characters
creating NURBS character's body 2nd 3rd 4th 5th 6th 7th
deforming
with isoparms
forearms
placing lattices around 2nd
photorealistic characters
smooth skin binding 2nd 3rd 4th 5th 6th
weights
adjusting 2nd
Check Topology option
checkBox command
checkboxes
controlling objects
Chicken Run
cleaning up
channels 2nd 3rd
clips
single-frame clips
creating poses
Closest Distance option
Closest Joint option 2nd
code
comments
adding 2nd
MEL code
saving 2nd 3rd 4th 5th
storing 2nd 3rd 4th 5th
writing
to History field
collapsible controls
Color Joints option
columnLayout command 2nd
command flags
commands
attrFieldGrp
attrFieldSliderGrp
button 2nd
changeToolIcon
columnLayout 2nd
connectControl
currentTime
cutKey
else
Export Weights
floatSliderButtonGrp 2nd
for 2nd
frameLayout
if
image
keyframerOutliner
layout
MEL commands
flags
researching in History field
setAttr 2nd
sphere
MEL commands. [See MEL commands]
modelEditor
paneLayout
radioButtonGRP
rowColumnLayout
rowLayout 2nd
scriptJob 2nd 3rd
scrollLayout
select
setKeyFrame
setParent 2nd
sphere
stitch surface points
symbolButton
symbolCheckbox
tabLayout
timeSliderClearKey
toolButton
toolCollection
window 2nd
comments
adding 2nd
Complete Skeleton option
completing
NURBS heads 2nd 3rd 4th 5th 6th 7th
Component Editor 2nd
conditional expressions
writing
for character rigs 2nd 3rd 4th 5th 6th
conditional statements 2nd 3rd
writing 2nd 3rd
connectControl command
connecting
channels 2nd 3rd 4th 5th 6th 7th 8th 9th
Connection Editor 2nd
Expression Editor
with set driven keys 2nd 3rd 4th 5th 6th 7th
limbs
to torsos with fillets 2nd 3rd 4th 5th
with patch modeling 2nd
Connection Editor
connecting channels 2nd
opening
constraining
channels
changing amount that channels constrain other channels
torsos
to feet 2nd 3rd 4th 5th 6th 7th
contol icons
placing 2nd 3rd 4th 5th 6th
contouring
jaws
control icons
creating 2nd 3rd 4th 5th 6th 7th
parenting 2nd 3rd 4th 5th 6th
control vertices (CVs)
control windows
displaying text
scripting 2nd
controlling
backbones
with math expressions 2nd 3rd 4th 5th 6th 7th 8th 9th 10th
faces
high-level and low-level face controls 2nd
with dummy heads 2nd
objects
with checkboxes
with radio buttons
controls
assigning
to attributes
checkBox command
collapsible controls
creating face controls 2nd
creating with math functions 2nd 3rd 4th 5th 6th
foot controls
adding 2nd 3rd 4th
for set driven keys 2nd 3rd 4th 5th 6th
naming 2nd 3rd 4th
separating
into multiple rigs 2nd 3rd 4th 5th 6th 7th
sliders 2nd 3rd 4th
converting
NURBS patches
to polygon skin 2nd 3rd 4th 5th
NURBS skin
to pollygon skin 2nd 3rd 4th
polygon characters
to subdivision characters
radial heads
to patch heads 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th
spheres
to polygons
creases
partial creases
creating
Create and Append Polygon tool
creating
polygon skin
creating edge loops
currentTime command
Curvature Tolerance
curves
creating
on heads
on surfaces
influence curves
projected curves
moving points on
projecting
custom tool windows
creating 2nd 3rd 4th 5th 6th
cutKey command
CVs (control vertices)


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

declaring
procedures
variables 2nd 3rd 4th
deformers
reordering 2nd
sculpt deformers 2nd 3rd 4th
deforming
characters
isoparms
skin
jiggling skin 2nd 3rd 4th 5th 6th
muscle skeletons 2nd 3rd
skin sliding over bones 2nd 3rd 4th 5th
wrinkles 2nd 3rd 4th 5th 6th 7th
deforms
wrap deforms
deleting
history
before binding skin
joints
designing
3D characters 2nd 3rd 4th
preproduction designs 2nd 3rd 4th 5th
designs
of interfaces 2nd 3rd 4th
digital 3D character animation
in films 2nd 3rd 4th 5th
displaying
joints
center of
Surface Origins
text
in control windows
drawing
skeletons 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th
adding multiple branches to single joints
Drop-off Rate option
dummy heads
controlling faces 2nd


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

ears
creating
NURBS surfaces
creating
Echo All Commands
edges
stitching
Edit Membership tool
edit points (EPs)
editing
blend shapes 2nd 3rd 4th
MEL code
skeletons 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th
preferred angles
editors
Attribute Editor
Component Editor 2nd
Connection Editor. [See Connection Editor]
Expression Editor 2nd
Expression Editor. [See Expression Editor]
Graph Editor
Hotkey Editor 2nd
Script Editor 2nd
opening
Shelf Editor 2nd
Trax Editor
else command
EPs (edit points)
exercises
2.1\: Creating Your NURBS Character Head 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st
2.2\: Create Your NURBS Character's Body 2nd 3rd 4th 5th 6th 7th
2.3\: Create a NURBS Multipatch Skin 2nd 3rd 4th 5th 6th 7th
2.4\: Convert Your NURBS Skin to a Polygon Skin 2nd 3rd 4th
3.1\: Placing Polygon Reference Bones 2nd
3.10\: Setting Driven Keys on Other Parts of the Body 2nd 3rd 4th 5th
3.11\: Using Constraints to Create a Hands Follow Switch 2nd 3rd
3.12\: Creating Torso Averages and Dips 2nd 3rd 4th 5th
3.13\: Using Conditional Expressions on Your Rig 2nd 3rd 4th
3.14 Using Functions to Create Additional Controls 2nd 3rd 4th 5th 6th
3.15\: Adding Foot Controls 2nd 3rd 4th
3.16 Creating a Spline IK-based Backbone 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th
3.17\: Making Text and Color Warnings 2nd 3rd 4th 5th
3.2\: Drawing and Editing Your Skeletons 2nd 3rd 4th 5th 6th 7th 8th 9th 10th
3.3\: Creating and Placing Control Icons 2nd 3rd 4th 5th 6th
3.4\: Parenting Skeletons and Control Icons into a Character Rig 2nd 3rd 4th 5th 6th
3.5\: Creating Eye Controls 2nd 3rd
3.6\: Adding Forearm, Hand, and Finger Controls 2nd 3rd 4th 5th 6th 7th 8th
3.7\: Creating Basic Channel Connections 2nd 3rd 4th 5th 6th 7th 8th
3.8\: Making Basic Backbone Controls 2nd 3rd 4th 5th 6th 7th 8th 9th
3.9\: Setting Driven Keys on the Shoulder 2nd 3rd 4th
4.1\: Smooth Skin Binding Your Character 2nd 3rd 4th 5th 6th
4.2\: Adjusting Skin Weights on Your Character 2nd
4.3\: Adding Muscle Influences 2nd
4.4\: Using Sculpt Deformers 2nd 3rd
4.5\: Using a Bump Map to Create Wrinkles 2nd 3rd 4th
4.6\: Placing a Lattice Around Your Character's Forearm 2nd
5.1\: Adding Face Influences to your Bind 2nd 3rd
5.2\: Adding Face Blend Shapes 2nd 3rd
5.3\: Create High-Level and Low-Level Face Controls 2nd
6.1\: Create a Basic Character Window 2nd 3rd 4th
6.2 Refine Your Basic Character Window 2nd 3rd 4th 5th 6th 7th 8th 9th
6.3\: Build an Advanced Character Window 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th
6.4\: Finish Your Character Window 2nd 3rd 4th 5th
7.1\: Create a Character Node and Pose Clips 2nd 3rd 4th 5th 6th
7.2\: Creating Subcharacter Nodes 2nd
7.3\: Using Multiple Rigs 2nd 3rd 4th 5th 6th
Export Weights command
Expression Editor 2nd
connecting channels
Edit button
expression functions
Expression Name selection filter
expressions
with MEL 2nd 3rd 4th
extruding
polygons 2nd
eye lids
radial NURB eye patches 2nd 3rd
eye-jitter controls
eyeballs
creating 2nd 3rd 4th
eyelids
creating
eyes
creating eye controls 2nd 3rd 4th


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

faces
adding face influences to the head 2nd 3rd 4th 5th 6th 7th 8th 9th
rebinding head and face skeletons
adding to heads
blend shape sliders
mixing and animating 2nd
blend shapes
adding 2nd 3rd
assigning to skin 2nd 3rd
editing 2nd 3rd 4th
reordering deformers 2nd
tweaking skin deformations 2nd 3rd 4th 5th
completing on NURBS heads 2nd 3rd 4th 5th 6th 7th
controlling
with dummy heads 2nd
creating controls 2nd
eyes. [See eyes]
facial expressions
creating with blend shapes. [See blend shapes]
facial expressions. [See facial expressions]
high-level and low-level face controls
creating 2nd
jaws
contouring
muscles 2nd 3rd 4th
skeletons
creating skeletons that lock down facial features 2nd 3rd
target shapes 2nd 3rd 4th
facial expressions
blend shapes. [See blend shapes]
target shapes 2nd 3rd 4th
feet
constraining
to torsos 2nd 3rd 4th 5th 6th 7th
controls
adding 2nd 3rd 4th
creating
a rolling foot 2nd 3rd 4th 5th
NURBS feet
creating
toes
fillets
films
Chicken Run
digital 3D character animation 2nd 3rd 4th 5th
Gerry's Game
Harry Potter films
Hollow Man
Lord of the Rings
Mummy, The
filters
By Expression Name filter
Expression Name selection filter
fingers
adding controls 2nd 3rd 4th 5th 6th 7th 8th 9th
FK
skeletons
FK (Forward Kinematics)
flags
-adj
-adjustableColumn
-align
-at
-attribute
-attributeChanged
-borderStyle
-buttonCommand
-cll
-columnAlign
-conditionTrue
-configuration
-event
-fieldMaxValue
-fieldMinValue
-font
-horizontal
-iconOverlayLabel
-image
-killWithScene
-l
-label 2nd
-mainWindow
-numberOfColumns
-numberOfRows
-object
-offCommand
-offImage
-onCommand 2nd
-query
-rowAttach
-select 2nd
-string
-style
-symbolButtonCommand
-timeChange
-tool
-topLeftCorner
-w
-width 2nd
-windows
sphere command
flexible backbones
creating 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th
flexors
rigid skin binding
lattice flexoors
Flip Mode option
floatSliderButtonGrp command 2nd
for command 2nd
for-in loop
Forward Kinematics. [See FK]
forward slash (/)
forward slashes (//)
frameLayout commands
freedom nodes


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

geometry-constraining influences
Gerry's Game
getAttr commands
Gibal lock
global procedures
MEL 2nd 3rd 4th 5th 6th 7th
global stitch
global stitches
goal objects
Graph Editor


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

hands
adding controls 2nd 3rd 4th 5th 6th 7th 8th 9th
fingers
adding controls 2nd 3rd 4th 5th 6th 7th 8th 9th
hands-follow switches
creating 2nd 3rd 4th
NURBS hands
creating 2nd
hands-follow switches
creating 2nd 3rd 4th
Harry Potter films
heads
adding face influences to 2nd 3rd 4th 5th 6th 7th 8th 9th
rebinding head and face skeletons
creating
from NURBS surfaces
faces. [See faces]
modeling
with NURBS surfaces 2nd
NURBS surfaces
completing 2nd 3rd 4th 5th 6th 7th
creating 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st
NURBS surfaces. [See NURBS heads]
hinge joints
history
deleting
before binding skin
History field 2nd
writing code to
Hollow Man
Hotkey Editor 2nd
hotkeys


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

icons
control icons. [See control icons]
moving
if command
IK
joints
limitations of
skeletons
adding automatically
spline IK-based backbones
creating 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th
IK (Inverse Kinematics)
IK/FK Switching Keys
ILM (Industrial Light + Magic)
image command
images
adding
to character windows 2nd 3rd 4th 5th
to paths
writing
in-between poses 2nd
increasing
tangency
Industrial Light + Magic (ILM)
influence curves
influence objects
creating muscle deformation 2nd 3rd 4th 5th 6th 7th 8th 9th
influences
geometry-constraining influences
Insert Joint tool
Inside Mode option
interfaces
designs 2nd 3rd 4th
MEL-scripted interfaces. [See MEL-scripted interfaces]
Intersect button
interviews
with Naylor, Tim 2nd 3rd 4th
with Perdomo, Maricela 2nd 3rd
Inverse Kinematics. [See IK]
isoparms
deforming characters
NURBS heads
modeling
NURBS surfaces
radial heads


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

jaws
contouring
jiggling
skin
creating 2nd 3rd 4th 5th 6th
joint clursters
joints 2nd
adding
adding multiple branches to single joints
ball joints
deleting
displaying
center of
hinge joints
IK
rotating
smooth skin binding 2nd
normalized weights
weights 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th
translating


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

Key All buttons
creating 2nd 3rd 4th
keyframeOutliner command
keyframes
lists of keyframe sets
keys
IK/FK Switching Keys


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

lattice flexors
creating
layering
animation 2nd 3rd 4th
layout command
layouts 2nd 3rd 4th 5th 6th
multipanel windows 2nd 3rd 4th
panes
tTab layout 2nd 3rd 4th 5th
legs
NURBS legs
creating 2nd 3rd
lighting technical directors
limbs
connecting
to torsos with fillets 2nd 3rd 4th 5th
with patch modeling 2nd
lofting
from torso surfaces 2nd 3rd 4th 5th
limitations
of IK
limits
on rotation
locators
creating
sculpt locators
locking
scaling channels
lofting
limbs
from torso surfaces 2nd 3rd 4th 5th
loop
for-in
looping statements
writing 2nd 3rd
Lord of the Rings


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

manipulators
assigning default object manipulators
move-rotate-scale manipulators
rotate
maps
bump maps
creating wrinkles in skin 2nd 3rd 4th
marking menus
math expressions
controlling
backbones 2nd 3rd 4th 5th 6th 7th 8th 9th 10th
math functions
breathing expressions
creating controls 2nd 3rd 4th 5th 6th
eye-jitter expressions
whipping tail expressions
Max Influences option
Maya characters
creating from rigs 2nd 3rd 4th 5th
Maya Embedded Language (MEL)
Maya Embedded Language. [See MEL]
MEL
controls. [See controls]
custom tool windows 2nd 3rd 4th 5th 6th
expressions 2nd 3rd 4th
global procedures 2nd 3rd 4th 5th 6th 7th
procedures 2nd 3rd 4th 5th 6th 7th
MEL (Maya Embedded Language) 2nd
MEL code
editing
storing 2nd 3rd 4th 5th
MEL commands
checkBox
getAttr
researching
in History field
setAttr 2nd
showWindow
text
whatIs
MEL scripting 2nd 3rd 4th 5th 6th 7th 8th 9th
adding
buttons to windows 2nd 3rd 4th 5th
adding sliders to 2nd 3rd 4th 5th
control windows 2nd
History field
layouts 2nd 3rd 4th 5th 6th
Script Editor
storing code
Expression Editor
Hotkey Editor
marking menus
Shelf Editor
MEL-scripted character windows
MEL-scripted interfaces 2nd 3rd
menus
marking menus
methods
of animation
pose-to-pose method 2nd
straightforward method 2nd
Mirror Joint tool
mirroring
weights
smooth skin binding
mixing
blend shape sliders 2nd
modelEditor command
modeling
heads
NURBS surfaces 2nd
NURBS heads 2nd 3rd 4th
isoparms
multipatch heads 2nd
radial heads
vertical heads
NURBS multipatch modeling. [See NURBS multipatch modeling]
patch modeling
connecting limbs 2nd
models
preparing for binding
motions
swinging motions
Move Icons button
move-rotate-scale manipulators
movement
creating with set driven keys
shoulders 2nd 3rd 4th 5th 6th 7th
moving
icons
points
on projected curves
multipatch heads
converting from radial heads 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th
NURBS surfaces 2nd
multipatch modeling. [See NURBS multipatch modeling]
Mummy, The
muscle skeletons
creating 2nd 3rd
muscles
face muscles 2nd 3rd 4th
using influence objects for muscle deformation 2nd 3rd 4th 5th 6th 7th 8th 9th


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

naming
controls 2nd 3rd 4th
objects
sliders
Naylor, Tim
interview with 2nd 3rd 4th
nodes
character nodes. [See character nodes]
subcharacter nodes
creating 2nd
normalized weights
smooth skin binding
NURBS
creating character's body 2nd 3rd 4th 5th 6th 7th
primitive NURBS planes
NURBS arms
creating
NURBS ears
creating
NURBS feet
creating
NURBS hands
creating 2nd
NURBS heads
completing 2nd 3rd 4th 5th 6th 7th
converting radial heads to patch heads 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th
creating 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st
modeling 2nd 3rd 4th
isoparms
multipatch heads 2nd
radial heads
vertical heads
refining
radial heads without manipulating CVs 2nd 3rd 4th 5th
roughing
radial heads 2nd 3rd 4th
NURBS legs
creating 2nd 3rd
NURBS multipatch modeling 2nd
converting radial heads to patch heads 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th
NURBS multipatch modoeling
connecting limbs 2nd
NURBS multipatch skin
creating 2nd 3rd 4th 5th 6th 7th
NURBS patches
covnerting to polygon skin 2nd 3rd 4th 5th
weighting
smooth skin binding
NURBS skin
converting to polygon skin 2nd 3rd 4th
texturing considerations 2nd 3rd 4th 5th 6th 7th 8th
UV file texture
NURBS spheres
attaching
creating
NURBS surfaces
blend shapes
heads
creating
modeling 2nd
isoparms
vertical heads
NURBS torsos
connecting limbs
with fillets 2nd 3rd 4th 5th
lofting limbs from 2nd 3rd 4th 5th
roughing out 2nd 3rd 4th 5th 6th


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

object manipulators
assigning default
objects
controlling
with checkboxes
with radio buttons
goal objects
influence objects
creating muscle deformation 2nd 3rd 4th 5th 6th 7th 8th 9th
influence objects. [See influence objects]
naming
rotating
on more than one axis
open edges
opening
Connection Editor
Script Editor
Shelf Editor
options
Check Topology
Flip Mode
Inside Mode
Project Mode
Stretch
ordering
deformers 2nd
organizing
control windows
overlapping geometry
avoiding
overlapping vertices


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

Paint Skin Weights tool 2nd
painting
weights 2nd
pane layout
paneLayout command
parenting
control icons 2nd 3rd 4th 5th 6th
skeletons 2nd 3rd 4th 5th 6th
partial creases
creating
patch modeling
connecting limbs 2nd
patches
NURBS patches
paths
to images
writing
Perdomo, Maricela
interview with 2nd 3rd
photorealistic characters
pickwalking
placing
control icons 2nd 3rd 4th 5th 6th
polygon reference bones 2nd
points
moving on projected curves
polygon proxy mode
subdivision surfaces
polygon reference bones
placing 2nd
polygon skin
converting from NURBS skin 2nd 3rd 4th
Create and Append Polygon tool
creating
creating from NURBS patches 2nd 3rd 4th 5th
extruding 2nd
smoothing
with subdivision surfaces 2nd 3rd 4th 5th 6th 7th
Split Polygon tool 2nd 3rd 4th
texturing considerations 2nd
polygons
appending
converting from spheres
extruding 2nd
splitting 2nd 3rd 4th
pose clips
creating 2nd 3rd 4th 5th 6th
pose-to-pose animation method 2nd
poses
creating
with single-frame clips
in-between poses
creating 2nd
storing
preferred angles
editing skeletons
preparing
models
for binding
primitive NURBS planes
procedures
declaring
MEL 2nd 3rd 4th 5th 6th 7th
Project Mode option
projected textures
projecting
curves


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

radial heads
converting to patch heads 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th
isoparms
NURBS surfaces
refining without manipulating CVs 2nd 3rd 4th 5th
roughing 2nd 3rd 4th
radial NURB eye patches 2nd 3rd
radial patches
ears
creating
radio buttons
controlling objects
radioButtonGrp command
reducing
Gimbal lock
referencing
controls 2nd 3rd 4th
refining
character windows 2nd 3rd 4th 5th 6th 7th 8th 9th
radial heads
without manipulating CVs 2nd 3rd 4th 5th
Remove Joint Colors option
removing
channels 2nd 3rd
reordering
deformers 2nd
researching
MEL commands
in History field
resizing
windows
rib skeletons
smooth skin binding
rigid skin binding 2nd 3rd 4th 5th 6th 7th 8th
flexors
lattice flexors
rigs
character nodes
creating 2nd 3rd 4th 5th
separating controls into multiple rigs 2nd 3rd 4th 5th 6th 7th
turning into Maya characters 2nd 3rd 4th 5th
rigs. [See character rigs]
roles
of character modelers 2nd 3rd 4th
of character setup artists 2nd 3rd 4th 5th
rolling
feet 2nd 3rd 4th 5th
rotate manipulators
Rotate Plane (RP)
rotating
joints
objects
rotation
Gibal lock
setting limits on
rotation order
roughing
NURBS heads
radial heads 2nd 3rd 4th
NURBS torso 2nd 3rd 4th 5th 6th
rowColumnLayout command
rowLayout command
rowLayout commands
RP (Rotate Plane)


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

Save All Shelves button
saving
MEL code 2nd 3rd 4th 5th
skin weights
SC (Single Chaing
scaling channels
locking
Schleifer, Jason
Script Editor 2nd
opening
script jobs
creating 2nd 3rd
scripting
control windows 2nd
MEL scripting. [See MEL scripting]
scriptJob command 2nd 3rd
scrollbars
adding
scrollLayout command
sculpt deformers 2nd 3rd 4th
sculpt locators
select command
separating
controls
into multiple rigs 2nd 3rd 4th 5th 6th 7th
separators
set driven keys
connecting
channels 2nd 3rd 4th 5th 6th 7th
creating controls 2nd 3rd 4th 5th 6th
creating shoulder motion 2nd 3rd 4th 5th 6th 7th
setAttr command
setAttr MEL command
setKeyFrame command
setParent command 2nd
setting IK/FK switching keys
shapes
blend shapes. [See blend shapes]
target shapes
tips for making 2nd 3rd 4th
Shelf Editor 2nd
shoulders
creating movement with set driven keys 2nd 3rd 4th 5th 6th 7th
Show Line Numbers
showWindow command
signs
warning signs
creating 2nd 3rd 4th 5th 6th
Single Chain (SC)
single-frame clips
creating poses
sizing
windows
skeletons
anatomy of 2nd
character rigs. [See character rigs]
creating skeletons that lock down facial features 2nd 3rd
drawing 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th
adding multiple branches to single joints
editing 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th
preferred angles
face skeletons
binding
FK 2nd
head skeletons
binding
IK 2nd 3rd
adding automatically
joints. [See joings]
muscle skeletons
creating 2nd 3rd
parenting 2nd 3rd 4th 5th 6th
polygon reference boens
placing 2nd
rib skeletons
smooth skin binding
smooth skin binding
creating extra skeletons for a better bind 2nd
skeletons. [See also body parts]2nd [See also character rigs]
skin
assigning blend shapes to 2nd 3rd
assigning lattices to 2nd 3rd
binding
converting NURBS skin to polygon skin 2nd 3rd 4th
deforming
creating jiggling skin 2nd 3rd 4th 5th 6th
creating wrinkles 2nd 3rd 4th 5th 6th 7th
muscle skeletons 2nd 3rd
skin sliding over bones 2nd 3rd 4th 5th
deleting
history before binding
jiggling skin
creating 2nd 3rd 4th 5th 6th
muscles
using influence objects for muscle deformation 2nd 3rd 4th 5th 6th 7th 8th 9th
NURBS multipatch skin
creating 2nd 3rd 4th 5th 6th 7th
NURBS skin
texturing considerations 2nd 3rd 4th 5th 6th 7th 8th
polygon skin
creating from NURBS patches 2nd 3rd 4th 5th
smoothing with subdivision surfaces 2nd 3rd 4th 5th 6th 7th
texturing considerations 2nd
rigid skin binding. [See rigid skin binding]
sliding over bones 2nd 3rd 4th 5th
smooth skin binding. [See smooth skin binding]2nd [See smooth skin binding]
tweaking deformations with blend shapes 2nd 3rd 4th 5th
wrinkles
creating 2nd 3rd 4th 5th 6th 7th
skin weights
sliders 2nd 3rd 4th
adding to windows 2nd 3rd 4th 5th
blend shapes
mixing and animating 2nd
naming
swapping slider order
sliding
skin over bones 2nd 3rd 4th 5th
smooth skin binding 2nd 3rd 4th 5th
assigning
lattices to skin 2nd 3rd
characters 2nd 3rd 4th 5th 6th
Complete Skeleton option
creating extra skeletons for a better bind 2nd
joints 2nd
skeletons
rib skeletons
subdivision surfaces 2nd 3rd 4th
weights 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th
mirroring
normalized weights
NURBS patches
smoothing
polygon skin
with subdivision surfaces 2nd 3rd 4th 5th 6th 7th
sphere command 2nd
flags
spheres
converting to polygons
NURBS spheres
attaching
creating
Split Polygon tool 2nd 3rd 4th
splitting
polygons 2nd 3rd 4th
springs
adding
Square tool
standard moode
subdivision surfaces
star junction
stitch surface points command
stitches
global stitches
stitching
edges
surfaces
storing
MEL code 2nd 3rd 4th 5th
poses
straightforward animation method 2nd
Stretch option
subcharacter nodes
creating 2nd
subdivision surfaces
smooth skin binding 2nd 3rd 4th
smoothing polygon skin 2nd 3rd 4th 5th 6th 7th
Surface Editing tool
Surface Origins
displaying
surfaces
creating curves on
stitching
swapping
slider order
swinging motions
creating
switches
hands-follow switches
creating 2nd 3rd 4th
symbolButton command
symbolCheckbox commands


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

Tab Layout 2nd 3rd 4th 5th
tabLayout command
taget shapes
tips for making 2nd 3rd 4th
tails
tangency
increasing
star junction
text
displaying
in control windows
text command
texture artists
textures
projected textures
UV file texture
texturing
NURBS skin 2nd 3rd 4th 5th 6th 7th 8th
polygon skin 2nd
timeSliderClearKey command
toes
tool buttons
creating
toolButton commands
toolCollection command
tools
Create and Append Polygon tool
Edit Membership
Insert Joint
Mirror Joint
Paint Skin Weights 2nd
Split Polygon tool 2nd 3rd 4th
Square
Surface Editing tool
torsos
constraining
to feet 2nd 3rd 4th 5th 6th 7th
lofting limbs from 2nd 3rd 4th 5th
NURBS torsos
roughing out 2nd 3rd 4th 5th 6th
translating
joints
Trax Editor
storing poses
tweaking
skin deformations with blend shapes 2nd 3rd 4th 5th


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

Uniform parameterization 2nd
Use Geometry option 2nd
UV file texture
NURBS skin
UV texture 2nd


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

variables
declaring 2nd 3rd 4th
vertical heads
NURBS surfaces
vertices
overlapping vertices


[ Team LiB ]

[SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W]

warning signs
creating 2nd 3rd 4th 5th 6th
weights
painting 2nd
saving skin weights
smooth skin binding 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th
mirroring
normalized weights
NURBS patches
whatIs command
whipping tail controls
window command 2nd
windows
adding
buttons to 2nd 3rd 4th 5th
sliders to 2nd 3rd 4th 5th
character windows
creating 2nd 3rd 4th
custom tool windows 2nd 3rd 4th 5th 6th
MEL-scripted character windows
multipanel windows 2nd 3rd 4th
organizing
refining 2nd 3rd 4th 5th 6th 7th 8th 9th
resizing
wrap deforms
binding subdivision surfaces indirectly
wrinkles
in skin
creating 2nd 3rd 4th 5th 6th 7th
writing
code
to History field
conditional expressions
character rigs 2nd 3rd 4th 5th 6th
conditional statements 2nd 3rd
looping statements 2nd 3rd
paths
to images


Team LiB

Brought to You by

Like the book? Buy it!