Download as pdf or txt
Download as pdf or txt
You are on page 1of 45

3DTOTAL.

COM eBooks Series


Chapter 1
Page 04 | Planning your Rig

Chapter 2
Page 10 | Knowing Your Tools

Chapter 3
Page 16 | Rig Creation Part 1

Chapter 4
Page 20 | Rig Creation Part 2

Chapter 5
Page 28 | Facial Rigging

Chapter 6: Scripting
Page 34 | Scripting
You can get the free resources in the
You can see the base images
resources and free
folder that accompanies
brushes in the resources folder
this ebook. that
accompanies this ebook.
- Free Model
This Resource includes
The Model Used Within This
Tutorial
Chapter 1: Planning Your Rig

Introduction to
Rigging: 1 - Planning
your Rig
Software Used: Maya

Chapter Overview
Welcome to the Introduction to Rigging
tutorial series for Maya. Throughout these
lessons for beginners, you will discover some
basic technical concepts that will get you started
in the fun and crazy world of rigging! And at the
end, we will rig a complete biped character and
leave with a short introduction on scripting, to
automate simple tasks.

In this first chapter we almost won’t be using


the software itself – first things first! Anyone
can follow a tutorial and get things working, but
you can’t rely on tutorials forever, right? You’ve
got to understand what you are doing! So we’re
going to explain a little about how character
riggers think, and how to optimize your work everything that’s in your mind, like some Please, try to rename all objects, geometries,
from the very start of the process in just about crazy, hungry monkey, before planning your curve controls, nodes, etc. To sum up:
any kind of job. rig! everything you create and may have to use
later.
Are you ready? – Let’s do this! Like with almost everything in life, if you don’t
plan before taking action you will most likely Good practice in Maya is to use Groups (Any
Planning have a hard time trying to get things working! Mode > Edit > Group). Your rig must be as
Before taking any action, here is something you The process of building a character rig can be simple as possible. It doesn’t matter whether
should always remember: Do not try to create really complex, so it’s a good idea to write a task you’re working on a simple cartoon character or
list to avoid skipping important steps (Fig.01). on a badass realistic creature: keep thinking in
terms of solutions! They will come to you more
Pro Tip: First, let’s play a little with our easily when your rig and workflow are organized
character and try to imagine how we can get (Fig.03).
good deformations. Good practice is to take
screenshots from your model and draw over Naming
them. Try to figure out the ideal location of the There are lots of object types in the 3D
skeleton, controls and pivots based in your world, so it’s easy to mix them up or delete
character’s proportions. Don’t worry about this what you shouldn’t when you’re on a tight
now; we will help you throughout this chapter schedule or working on really large scenes. Be
(Fig.02). careful to always name all of your objects,
whilst keeping the names as clean and
Organization understandable as possible.
In the rigging world, being organized is
essential! Organization helps you to create A simple pipeline only uses prefixes and suffixes
easy-to-understand and up-to-date setups. for all nodes (objects in your Maya scene).

www.3dtotal.com page 5 Chapter 1


Chapter 1: Planning Your Rig
The main idea here is team integration. When
another person opens up your scene, they
should be able to edit it easily if everything is
correctly organized. Remember: please work
with care in order to avoid unnecessary work for
others and for yourself!

A simple yet efficient approach is to use three


letters from the name of the character as a
prefix, and also three letters from the node
type as a suffix. And a good idea is to use
underscores to make the names more readable.
If applicable, indicate the node side using just
one letter (“L” for left and “R” for right). Try
to use underscores only when prefixing and
suffixing, make the object name cleaner by
separating words using capital letters between
them (“l_greenColoredEyeball_jnt”, for example)
(Fig.04). for anatomy references in books and on the at the real world, as well as movie and image
internet. Having knowledge about anatomy references. By doing this, you will most certainly
References is a very important basis for creating good have a clearer idea of what objectives to meet
Whenever rigging creatures, be they humanoid, skeletons and muscle deformations. and how to achieve them (Fig.05).
alien, animal, robotic, or whatever, always look Before you start your rig, take some time to look

www.3dtotal.com page 6 Chapter 1


Chapter 1: Planning Your Rig

Basic Anatomy
Let’s now discuss a little about some of the
basic aspects of anatomy so we can position
our joints in the best way we possibly can – this
always ensures good rigging results!
We will quickly cover some deformation
facts and limits, establishing those imaginary
“mass blocks” to better understand how the
deformation works in each area. Try to compare
it to your own body to better understand how the
rig should work.

Spine
The center of gravity (or center of mass) of a
character is located in the spine, near the navel
(we’d usually consider the waist joint as the
root joint of all the hierarchy). When building
the chest, be aware that it’s the body part that
deforms the least, while the abdomen is the
most flexible region of the spine (Fig.06).

Head & Neck


We can divide the head and the neck into two
main rotation points: one for the neck located in
the base of the cervical vertebrae region, and
the other for the head located at the base of the
skull (Fig.07).

www.3dtotal.com page 7 Chapter 1


Chapter 1: Planning Your Rig
Arms & Clavicles rotation, but the elbow can only rotate on one Hands
The clavicle is very important in order to get axis (using the biceps and triceps muscles). Basically, we can consider that there are three
good arm movements, because the shoulder The wrist bone also cannot rotate on its axis phalanx bones for each of the five fingers in the
doesn’t rotate more than on a horizontal line. point. The relationship between the elbow and human hand. None of these bones rotate on
With the clavicle, this limit can be surpassed, the wrist is very interesting because of the their axis point. The starting base of a phalanx
but remember that the clavicle bone doesn’t radius and ulna bones; they cross when the can rotate on two axes, but the middle and last
rotate on its own axis (the one pointing to the forearm rotates so that the wrist region rotates, phalanges cannot (Fig.09).
shoulder). There is no limit on the shoulder’s keeping the elbow fixed (Fig.08).

www.3dtotal.com page 8 Chapter 1


Chapter 1: Planning Your Rig

Legs In Closing… Richard Kazuo &


The leg joint can rotate in all directions, and That’s it for this lesson! Be sure to draw and Danilo Pinheiro
it’s possible to rotate the ankle with it together, study a lot of anatomy and deformations! In For more from these artists visit
as if in a group. The knee just rotates in one the next chapter we will dive into Maya – our http://riggerman.animationblogspot.com/
direction, whilst the toes on the feet are similar 3D software of choice – to put our knowledge http://nilouco.blogspot.com
to the fingers on the hand (with three phalanx into practice! That’s right, in the next part we or contact
bones for each), except that the toes only have will test our planning on the real thing! A brief richardyzo@gmail.com
two phalanges each (Fig.10). overview will show you how the software works nilouco@gmail.com
and explain some of its main tools that are used
Pro Tip: Remember to base your rigging on for the rigging process, and we will also discover
good anatomy whenever you can, but don’t let some tips and tricks on general rigging so you
it imprison your creativity! Sometimes we need can speed up your workflow.
to create mechanics that are different to realistic
and natural anatomy in order to achieve the
desired effects and deformations. Feel free to
diversify using your creativity to get the best
solutions for your needs.

www.3dtotal.com page 9 Chapter 1


- Free Model
This resource includes
The Model Used Within This
Tutorial
Chapter 2: Knowing Your Tools

Introduction to
Rigging: 2 - Knowing
your Tools
Software Used: Maya

Chapter Overview
In this chapter we will explain a little about
Maya’s architecture and take a look at some
useful tools for the rigging process in order to
get the best out of them.
You will also see some tips and tricks on
general rigging that will help you speed-up your
rigging process a lot.

Concepts
When we work with rigging we need to think:
“what can we do to bring this character to life,
whilst keeping it simple and clean?” Rigging is a
technical process that stands between modeling and Python scripting. But don’t worry about all of an empty group. The visual representation of
and animation and our responsibility is to create these topics right now! We will see all of them in the object you are moving is called Shape. To
simple and easily understandable controls for the tutorials. see this clearly open up a new scene, take a
the animators, while keeping the pipeline clean look into your Outliner and check (Display >
and straightforward as possible to achieve what Transformation and Shapes). Click on the plus sign on the left of
we need. That is why it is very important to look Deformation the top camera object and you will see it has
for references in real-life or other CG sources. A Ok, the first thing we should be aware of is how a transform (the white box) and a shape (the
good knowledge about anatomy and movement the things you see in Maya’s viewport work. We camera icon) (Fig.01).
is essential! We need to understand a little won’t go too technical here. For starters, this is
about programming too, some processes can what you need to be aware of - Every object in Please note you cannot move the shape without
be very repetitive and scripting these tiring parts Maya that you can move around in the viewport the transform, it’s Maya’s way to keep track of
will make your work a lot quicker and fun. If you has a Transform Node. These nodes are there where your object is in your scene.
use Maya, you should learn a little about MEL even when you cannot see them, for example:
Now, I just said we can’t move the shape
without the transform, but that is not entirely true
to meshes. You can move around geometry
vertices without moving its transform, we will
call this kind of movement deformation of
components. Note that you cannot deform
a camera, because its shape doesn’t have
components. Only edit shapes if you know
what you are doing! That can lead to undesired
deformations and weird pivots.

So, summing it up, Transformation is when we


edit (translate, rotate or scale) entire objects.
Deformation is when we edit (translate, rotate or
scale) components of a mesh (Fig.02).

www.3dtotal.com page 11 Chapter 2


Chapter 2: Knowing Your Tools

In a practical example, you would use * Aim Constraint: constrains only the rotation of riggers! The main goal of working with joints is
transformation to move around an entire ball the object to make it always aim to the target’s; to put them on the right position of the character
and deformation to squash and stretch the in order to get the best deformations when the
components of this ball. * Scale Constraint: constrains only the scaling of joint is transformed... that is how joints work;
the object (Fig.03); they are used to drive components of meshes.
Constraints: Simply put, you move a joint and it moves
Sometimes in Maya we need to make an object Joints components of a mesh that are bound to this
follow another in translation, rotation, scale, for Joints are hierarchical deformers that makes the joint. Do not worry if you do not understand, we
example making it always face the target, etc... skeletal structure for our models possible. They will talk about skinning in a moment (Fig.04).
These can be done using constraints. To create are very flexible and we can use them for lots
a constraint, first select the target object (the of different characters, animals and creatures Tip: (Joints) = When creating a linear joint
one who will lead), then select the constrained as we like. By far the most used object for us hierarchy using Joint Tool (Animation >>
object (the one who will follow the lead) and
click on the desired type of constraint from the
menu (Animation >> Constrain). By default,
constraints override your object’s transform
values to match the target values but you
can also create an offset in your constraint by
checking the Maintain Offset checkbox in any
constraint option box.

* Point Constraint: constrains only the


translation of the object using its own pivot point;

* Orient Constraint: constrains only the rotation


of the object using its own pivot point;

* Parent Constraint: constrains only the


translation and rotation of the object using the
target’s pivot point;

www.3dtotal.com page 12 Chapter 2


Chapter 2: Knowing Your Tools
Skeleton > Joint Tool) snap on the grid
(pressing X), move joints in only one direction
(using move manipulator option “Along rotation
axis”) and rotate it to put in the desired angle.
This way you create joint chains in only one axis
and avoid future orientation problems (Fig.05).

Skinning
Smooth Bind Skin (Animation >> Skin > Bind
Skin > Smooth Bind) is used to drive your
geometry using joints. It creates a skin Cluster
deformer in the input history of the geometry
making it possible for our joints to be used as
deformers of our character model (Fig.06).

We will take a look at the skinning process in


detail in the next chapter.

Deformers
There are a lot of deformers in Maya. Each
deformer has an attribute named Envelope that

we can use to weigh the deformation applied.


We will list some of the main ones that are used
in rigging, but do not be satisfied with only these
below, go ahead to try others too:

Cluster
It is a center point to modify geometries or
selected vertices from a geometry. Create
it by selecting a mesh or points of a mesh
and going to (Animation > Create Deformers
> Cluster), it will create a little “C” letter, our
cluster Handle manipulator. This works almost
the same as joints with the advantage of having
a localized and easily adjustable effect. We can
optimize this effect by painting its weight using
(Animation >> Edit Deformers > Paint Cluster
Weights Tool) (Fig.07).

www.3dtotal.com page 13 Chapter 2


Chapter 2: Knowing Your Tools

Blend Shapes selecting entire objects or components of them we have seen until now work? They need a start
This allows us to model our own deformations and going to (Animation >> Create Deformers > and an end position to points and simply send
anyway we want and toggle them as needed. Lattice). Change the lattice S/T/U divisions for them from one point to another, in a straight
We will see this topic in detail in chapter 5 more resolution in X/Y/Z in order to get more line. Non-linear deformers do not calculate the
(Fig.08). precise deformations. The deformer also creates deformation this way. You’ll notice each of them
a lattice Base object (look at Outliner Panel) has a unique method of editing your meshes’
Lattice to define a starting location to calculate the points.
This deformer creates a box shape with deformations (Fig.09).
points around geometries or selected points Main Nonlinear Deformers, very useful for
of geometries. Edit these points to deform the There are also the non-linear deformers. Why cartoon rigging projects: Bend
associated model. Create a lattice deformer by non-linear? Remember how all the deformers + The bend deformer literally bend’s your

www.3dtotal.com page 14 Chapter 2


Chapter 2: Knowing Your Tools

points in an arc. You can define its position and the deformation. Create a bend deformer by Squash
orientation by transforming the bend Handle selecting meshes or points of meshes and then + The squash deformer will squash (or stretch)
manipulator. The Curvature attribute is used to clicking on (Animation >> Create Deformers > your geometry vertices while maintaining its
measure the bending power and Low and High Nonlinear > Bend) (Fig.10). volume. A squash Handle manipulator will be
Bounds are used to change the boundaries of applied to selected meshes or points by going
to (Animation >> Create Deformers > Nonlinear
> Squash). You can move this handle around
to the position where you get the best squash
deformation for your needs. Edit its Factor
attribute value in order to squash or stretch your
geometry amongst other editable attributes
(Fig.11).

Now that you know some tricks, you are ready


to get busy! In the next chapter we will start
rigging our ET character by creating its skeleton
hierarchy, go deeper into the skinning process
and see a little more about blend shapes. Until
then, practice a lot and get yourself comfortable
with Maya!

Richard Kazuo &


Danilo Pinheiro
For more from these artists visit
http://riggerman.animationblogspot.com/
http://nilouco.blogspot.com
or contact
richardyzo@gmail.com
nilouco@gmail.com

www.3dtotal.com page 15 Chapter 2


- Free Models
This Resource includes
The Models Used Within This
Tutorial
Chapter 3: Rig Creation Part 1

Introduction to
Rigging: 3 - Rig
Creation - Part 1
Software Used: Maya

Chapter Overview
This time we are finally getting down to
business! We will start to create the skeleton
hierarchy of our character while giving a deeper
explanation to the skinning process. At the very
end, we will take a peek on some blendshape
targets for our ET character. Enough said, let’s
rig!

Joint Outlining
Now it is time to use our planned material from
previous lessons to create the character’s
skeleton. Use the side, front, top and persp
viewports to create these structures:
the last joint in the hierarchy and for helping
Spine: the root joint of a biped character must Maya calculate the starting skin weights.
be the first lower spine, the waist. From then on
you will need to create up to three joints until the Leg: now we can start with another separated
chest area. Name them as spineA_jnt, spineB_ joint hierarchy from top to bottom, but this time TIP (knee/elbow) = We use two joints as knee
jnt and spineC_jnt. After that build another five we will concentrate only on the left side because (or elbow) in order to get better deformations.
joints for the neck_jnt, head_jnt, jaw_jnt, chin_jnt we will mirror the limbs from left to right later on. These parts are very complex in real-life, so we
and chin_end. (Fig.01) So, create six joints named as following: l_leg_ need two joints to reach almost 180 degrees of
jnt, l_upKnee_jnt, l_lowKnee_jnt, l_ankle_jnt, rotation while minimizing volume loss. (Fig.02)
TIP (joint Ends) = We do not use the joints l_foot_jnt, l_foot_end. Note the “l_” prefix, that
suffixed “_end” as skinned influences. We only means left side. We will replace that for “r_” Arm: for the arms we will use five joints that can
create them to help us visualize the rotation of when we mirror these and other limbs. be: the l_clavicle_jnt, l_shoulder_jnt, l_upElbow_
jnt, l_lowElbow_jnt and l_wrist_jnt. (Fig.03)

TIP (Forearm Twist) = This technique is for a


simple forearm twist: duplicate the wrist joint
(Any Mode >> Edit > Duplicate) and move it
along the chain (in our case, the X direction)
until it is 1/3 of the distance of the low Elbow.
Rename it as forearm_jnt and delete its child
wrist joint.

This is a simple yet very useful way to mimic the


forearm twisting, when we rotate our hands. For
now we won’t actually be setting the forearm rig,
we will take a look into its expression in the next
chapter! (Fig.04)

www.3dtotal.com page 17 Chapter 3


Chapter 3: Rig Creation Part 1

Hand: let’s create four joints for each finger, the command (Any Mode >> Modify > Freeze vertices with the command and value currently
such as: l_thumbA_jnt, l_thumbB_jnt, l_ Transformations). This way you will be able to set for the selected joint.
thumbC_jnt, l_thumb_end. Parent finger joints to return to the default joint positions (bind pose)
the l_wrist_jnt. (Fig.05) when you paint skin weights. A technique that we use is to repaint all of the
character model again. It may seem hard to
Mirroring Skinning in Action do sometimes, but this way you can get better
Now, we can parent the clavicle joint to Now let’s put these joints into action! Freeze the results instead of trying to repair the original skin
the spineC and then do the mirroring using joints transformations, select your model and weights generated by the software.
(Animation >> Skeleton > Mirror Joint) . Look at all of your joints except those named “_end”
the options for this command, we should search and apply the Smooth Bind Skin by going to Let’s do this by activating “Replace” paint mode
for “l_” (left side) and replace for “r_” (right side) (Animation >> Skin > Bind Skin > Smooth Bind). with the Value of 1 for the waist! After you block
while mirroring in YZ mirror across. Do the same Go to the option box and mark these options: it, also paint value 1 for spineA to all faces of the
for the l_leg_jnt parented to the waist. (Fig.06) Bind to Selected joints, Max influences 3, mesh that are above this joint. When you have
Maintain Max Influences off. the two white blocks, hold the weights of all
Skinning Theory Maya will then create a default skinCluster with other joints except spineA and waist.
Ok, in a moment we will start the skinning point weight values that we can refine using the
process to actually drive our mesh using our artisan brush (Animation >> Skin > Edit Smooth Now press 3 or 4 times the Flood button with
created joints - but before that we need to Skin > Paint Skin Weights Tool). the “Smooth” option selected. Look at what you
understand what this is all about. We will be should have: a nice smooth blending between
using the smooth bind command, it allows you When you look the mesh with this tool activated, these two joints while the other joints do not
to deform a mesh using one or more joints by you will see that it is painted black, white and influence this area - they were held. Continue
creating a skinCluster deformer in your mesh. gray. Do not worry, it is all right. These colors by holding the waist joint and unholding spineB,
“Smooth” means that you can have more than are showing you the weights values for joints then block influences between spineA and
one joint driving the position of a single point of (black = 0, white = 1 and gray = values between spineB areas, lock and smooth. Repeat this
your mesh. So the skin Cluster lets joints drive 0 and 1). This means that: the whiter the region process for all adjacent joints. (Fig.07)
points in a mesh and for each point the rules for is, the more the currently selected joint will affect
which the joint is to follow is completely open for your mesh. TIP (skinning) = You can rotate joints when
us to edit (either by numeric values or painting painting to see if your weights are good. When
the values directly in the mesh). With this tool, we can replace, add, scale or you are finished, just reset their rotations to
smooth influences for each deformer joint. zero!
TIP (Skinning) = Reset joint rotations before The button “Toggle Hold Weights on Selected”
applying the skin Cluster. To do this preserving can be used to lock the selected joint for Concentrate in painting the skin values for
your joint hierarchy, select all joints and use modifications and the button “Flood” paints all only one side of the character, as we can

www.3dtotal.com page 18 Chapter 3


Chapter 3: Rig Creation Part 1
mirror weights from one side to another using
(Animation >> Skin > Edit Smooth Skin > Mirror
Skin Weights).

Secondary
Deformations
If you want to get better deformations while
animating your character, you should create
secondary deformations as corrective
blendshape targets to simulate muscles and
interactive anatomy that will be automatically
controlled.

This technique is simple: just duplicate the


original model and deform it to what you
need, when you use it as a target then link its
blendshape slider to a controller. We usually
connect the rotation of a specific joint to values
of the blend shape slider using Set Driven Keys
(Animation >> Set Driven Key > Set...).

Let us see an example. Look at the picture to


get the idea: (Fig.08)

Here we created an inflated biceps blendshape.


This target is controlled by the lowElbow joint’s
rotation Y value. We then use SDK to tell Maya:
when the rotation Y of the joint is 0, the value
of the slider of the blendshape is also 0. When
the rotation Y of the joint is -30, the value of the
blendshape will be 1. Simple, isn’t it?

TIP (secondary deformation) = Always think in


volume preservation. You can use secondary
deformations in any part of the character that
you need. So try to do it for the main muscles of That is it for this lesson! Try to skin the joints twist and create the actual controllers that the
your character like elbows, knees, belly volume, in different positions to better understand how animators will use. See you then!
etc. the smooth skinning works in order to get the
best deformations possible! Also model and
test a lot of targets for your character to learn Richard Kazuo &
this properly! These are valuable assets in any Danilo Pinheiro
rigger’s workflow, remember that! :) For more from these artists visit
http://riggerman.animationblogspot.com/
Now that the entire joint hierarchy is created and http://nilouco.blogspot.com
the skin weights are nicely adjusted, in the next or contact
chapter we will see some rigging tricks to create richardyzo@gmail.com
IK/FK blending, reverse foot controls, forearm nilouco@gmail.com

www.3dtotal.com page 19 Chapter 3


- Free Models
This resource includes
The Models Used Within This
Tutorial
Chapter 4: Rig Creation Part 2

Introduction to
Rigging: 4 - Rig
Creation - Part 2
Software used: Maya

Chapter Overview
In this chapter we will build the rig setups using
the joints we created in our last lesson and add
control curves for the animators to use (after all,
no one likes to have to select the actual joints
when animating - sometimes this will not even
work and break the rig).

Controls
Now it’s time to set up controls to move the
skeleton. We usually create CV curves as Transformations). But notice that when you
controls and modify the shapes by editing freeze a control curve, it’s orientations will jump
components to make them more intuitive for the back to the world’s axis. That’s a problem. Most
animators (Fig.01). of the time we don’t want to lose the control’s
orientation. That’s where we use the zeroOut
We should also add attributes to them in the process.
ChannelBox panel (ChannelBox > Edit > Add
Attribute) to get powerful results as we will see To zeroOut an object you just have to:
next (Fig.02).
- Create an empty group.
zeroOut - Translate and rotate the group to the same parent the object to the group.
When creating our controls we must make them position and rotation of your object (you can - Voilá, your object now has zero values without
clean and simple, which means all controls do this by creating a parentConstraint to snap freezing and without losing its orientation.
by default cannot have any transform value. the group to the object and then delete the
We can nullify these values by freezing the constraint). TIP (zeroOut): Notice this is not the same as
transformations (Any Mode > Modify > Freeze - When they are both on top of each other, freezing the transform (that aligns the object
to the world). Keep the zeroOut process in
mind, as it is the key to easily creating correctly
oriented controls and we will be using it a lot in
this chapter.

Master Control
This will be our global control for the character
rig. You can use the default circle or create a
CV curve shaped like a character, it is up to
you. Name this curve “Master_ctrl” and add
one attribute named “EXTRAS” as the only
displayable label for our attributes. All the curve
controls we will be creating must be in a group
inside of the “Master_ctrl” so the entire rig will
behave properly (Fig.03).

www.3dtotal.com page 21 Chapter 4


Chapter 4: Rig Creation Part 2

The Spine Rig


To create the spine rig we will build curve
controllers for each joint to be driven with
parentConstraints. Starting from the “root_jnt”
up to the “spineC_jnt”, name them as “hips_ctrl”,
“spineA_ctrl”, “spineB_ctrl” and “spineC_ctrl”
and align them to the joints and zeroOut.

Now parent the spine curves so they form a


hierarchy (spineA > spineB > spineC) and finish
by parenting the “spineA_ctrl” and the “hips_ctrl”
under another curve called “cog_ctrl”. This will
be our Center Of Gravity control, so we can
move the entire spine using only one curve
(Fig.04).

To finish, create a group with these curves hierarchy by parenting the chin’s zeroOut group the arms, but the same technique can also be
named “controls_grp” and parent it to the to the jaw curve, the jaw’s zeroOut group to the used for the legs.
“Master_ctrl”. head curve, the head’s zeroOut group to the
neck curve and finally the neck’s zeroOut group Start by duplicating the shoulder joint and
Neck, Head and Jaw to the “spineC_ctrl” created earlier (Fig.05). renaming its “_jnt” suffix to “_fk”. Do the same
Now let’s create curves to control the neck, for all its children joints. Repeat the process but
head, jaw and chin. To make it easier for the IK/FK Blend limbs now rename the suffixes as “_ik”. Delete the
animators to see and select the controls, edit Sometimes animators need to use Forward forearm and finger joints from the newly created
the components (control vertices) of the curves. Kinematics (FK) and Inverse Kinematics (IK) in “_ik” and “_fk” hierarchies. (You should end up
We usually start with circles and first align them the same scene. Luckily, we can blend these with a four joint chain, starting on the shoulder
to their respective joints before remodeling two techniques in our rig - bringing lots of and ending on the wrist)
to the desired shape. When you are done advantages. At the first contact it can be a little
shaping, zeroOut each one of the curves, create complex, but do not worry, it gets easy when we NOTE: The joints are separated for your better
parentConstraints to make the curves drive understand the simple idea behind the concepts. understanding - the chains must be exactly on
their respective joints and then put them in a We will only explain how to set up a blend for top of each other.

www.3dtotal.com page 22 Chapter 4


Chapter 4: Rig Creation Part 2

TIP (duplicate_IK/FK): Renaming is simple using Remember to do this only once for each joint Go to the Hypergraph panel (Any Mode >
the Search and Replace Names command… in the “_jnt” chain; this will make our “_jnt” Window > Hypergraph), create a reverseNode
(Any Mode > Modify > Search and Replace chain follow both the “_ik” and the “_fk” chains (in Hypergraph > Rendering > Create Render
Names...). Try to use it (Fig.06)! though the orientConstraint. If you move the Node… > Utilities tab > Reverse) and connect
joints around you will see that they follow both the blend attribute from the “Master_ctrl” curve
Now let’s constrain all the joints on these three chains equally. We will now create an attribute on its inputX. Now, connect the outputX attribute
hierarchies. Follow these steps for each joint of to control these influences. of the reverseNode on all of the (IK-W1) of the
the chain we want to blend: orientConstraints. Look at the image sequence
For all limbs we will add a float attribute called for a better comprehension (Fig.07).
- First select a “_fk” joint. “(limb)_ikFkBlend” (for example: “l_arm_
- Add its corresponding “_ik” joint to the ikFkBlend” for the left arm), with min value 0 TIP (direct connections): Directly connecting
selection. and max value 1 to the “Master_ctrl” curve. attributes can be a cleaner alternative to driven
- Finish by adding the corresponding “_jnt” joint Connect this attribute on every (FK-W0) of the keys or expressions, as they evaluate real-time
and applying an orientConstraint (Animation > orientConstraints we just created (the constraint and do not create animation curves.
Constrain > Orient). nodes should be right under the “_jnt” joints).

www.3dtotal.com page 23 Chapter 4


Chapter 4: Rig Creation Part 2
Do the same for the leg joints too, but do not do
anything with the feet joints as we will take care
of them further on.

IK handles creation
This is an important step. If you skip this, your
IK chains will be useless! Now that we have
created the chains we can create our ikHandles
(Animation > Skeleton > IK Handle Tool) to get
the inverse kinematics behaviour from our joints.

- For the arms, create a rotate plane (ikRPsolver


as the current solver) for both sides starting Clavicle Control and driving the correspondent joint with a
parentConstraint. There will be three controls
in the “l_shoulder_ik” joint and ending on the Since the clavicle doesn’t need to have an Ik to
(shoulder, elbow and wrist) that must be
“l_wrist_ik” joint. Fk blending, just create a simple curve oriented
parented to the clavicle controller.
- For the legs, create the rotate plane ikHandles like the joint, zeroOut and parentConstraint the
starting in the “l_leg_ik” joint and ending on the “clavicle_jnt” to your control on both sides like
As for the IK chain, create only a control for the
“l_ankle_ik” joint. so (Fig.08). To finish, just parent the zeroOut
wrist (aligned and oriented to the wrist joint)
- For the feet, create two single chain solvers groups of both clavicles to the “spineC_ctrl”.
that will orientConstraint it; also pointContraint
(ikSCsolver). One starting in the “l_ankle_jnt”
and ending on the “l_foot_jnt” and the other Arms Controls the corresponding ikHandle of the limb to the
controller. ZeroOut the curve and parent it to the
one starting at the “l_foot_jnt” and ending at the To drive these two newly created chains, create
“controls_grp” (Fig.09).
“l_foot_end”. Name them as “l_foot_ikh” and controls as you wish - use the same process
“l_toe_ikh”. as the head/neck controls using zeroOuts to
TIP (ik/FK_visibility): You can set drivenKeys
- Do this on the left and right sides of the limbs pseudo-freeze your controls. For the FK chain,
on joints and control visibilities when switching
and feet. create a control for each joint (except for the
between IK and FK mode.
- Group all the ikHandles in a single group elbow, that will have only one control as we
named “ikHandles_grp”. skip the second joint), parented hierarchically

www.3dtotal.com page 24 Chapter 4


Chapter 4: Rig Creation Part 2

Forearm Twist
To simulate our radius and ulna bones in the
arms, we will use the “l_forearm_jnt”. Start by
creating a curve to control the forearm twisting
named as “l_forearmTwist_ctrl” and position it
on top of the “l_forearm_jnt”. ParentConstraint
the control to the lowElbow joint and lock and
hide all of its attributes (ChannelBox > Channels
> Lock and Hide Selected). We won’t be
animating it’s position; to keep our rig organized,
put this control on the “controls_grp”.

Ok, now let’s do an expression to connect


the forearm control’s rotation X to drive
the rotation X of the wrist joint. Add an
r_forearmTwist_ctrl.autoRotateIntensity; If we need to control multiple fingers at the same
attribute to the forearm control curve named
(Fig.10). time, we can create more groups above them
“autoRotateIntensity” as float with min value 0,
and set driven keys.
max value 1 and default value 0.5. Do this for
TIP (forearm_expression): Notice we are
the right arm joint too.
creating only one expression to control both For each finger you should:
forearm twists, so create the other side control
Now, go to the Channel Box menu Edit and
before applying the expression to avoid errors! - Create a curve and snap its position and
choose Expression. Another way to do this is by
rotation as the same as the finger joint.
going to (Any Mode > Window > General Editor
> Expression Editor). In this panel, write the
Fingers - ZeroOut the curve to nullify transform values
The simplest way to rig fingers is to create a while still maintaining its orientated as the joint.
expression below:
curve for each one of the joints. Align and orient, - Now just constrain the respective joint to its
zeroOut them in a hierarchy (like the spine curve and parent the base curves (that control
l_forearm_jnt.rotateX = l_wrist_jnt.rotateX *
controls) and then parentConstraint the joint to the first joint of the finger) to the “controls_grp”;
l_forearmTwist_ctrl.autoRotateIntensity;
the corresponding curve.
r_forearm_jnt.rotateX = r_wrist_jnt.rotateX *
To make the finger curves follow the rig, when
you have created the controls for one hand,
group all of them and parentConstraint to the
“wrist_jnt” so it is always following the hand, no
matter the IK/FK blending (Fig.11).

TIP (rig_Fingers): This process is easier to


do using a MELscript, which we will cover in
Chapter 6 of this tutorial.

Legs Controls
Ok, now that the arms are complete, let’s quickly
create the legs controls. It’s the same process
except for the IK control - you might want to
orient it to the world (with just a little bit offset on
the Y axis to follow the foot angle) so that the
translate Y of the controller is facing upwards.
(Fig.12)

www.3dtotal.com page 25 Chapter 4


Chapter 4: Rig Creation Part 2
The FK controls go parented in the “hips_ctrl”
and the IK controls in the “controls_grp”. Also do
not forget to pointConstraint the leg’s ikHandles
to the IK controllers, but do not create the
orientConstraint to the ankle joint because the
foot does not work like the hand.

Reverse Foot
Sometimes we must think beyond the real
anatomy because movements in real world are
very complex and difficult to reproduce in 3D.
That is why we must fake some processes: let’s
take a look at the “Reverse Foot” setup that is
used to get good foot control.

Create a hierarchy of four joints, then rename


and dispose them on top of the original foot
chain, as in Fig.13 (start by the Base joint and
end with the Ankle joint). IK/FK modes named “l_toe_ctrl”. Create and ParentConstraint it to both the FK and IK foot
align it to the toe joint then zeroOut. Parent the controls, do not forget to also make the blending
The idea is to create an inverted chain that group to the “controls_grp” and parentConstraint connections to switch who is driving the group
will drive the bones in the reverse order. To it to the “l_footReverseTip_jxt” so it is always accordingly. While you’re at it, notice that the
make our foot joints follow this new chain; just following the foot. ParentConstraint the foot FK motion is still not completely right. To fix
pointConstraint the “l_foot_ikh” we created “l_toe_ikh” to this control and now both our feet it, just follow these two steps for both feet:
earlier to the “l_footReverseHeel_jxt”. ikHandles are being controled.
- Connect the reversed blending attribute
Before going on, let’s create a control to move Group the reverse joints we just created as (“reverse_l_leg.outputX”) to the feet ikHandles’
the toe independently, only one curve for both “l_footReverse_grp” - this will act as our ‘hand’. ikBlend attributes (“l_foot_ikh.ikBlend” only!

www.3dtotal.com page 26 Chapter 4


Chapter 4: Rig Creation Part 2

Leave “l_toe_ikh.ikBlend” always as 1). IK Twisting Controls lesson! For now, you can group these and
- Now remember the “ikHandles_grp”? Group Now that we have created all of our IK controls, parentConstraint to the head joint.
the scattered “l_foot_ikh”, “l_toe_ikh” and let’s add an attribute to control the limbs
“l_leg_ikh” ikHandles into a group called “l_foot_ orientations: the “twist” attribute. This little Phew! We have come to the end of this
ikh_grp” and parentConstraint it to follow its fellow will play the part of our polevector. As an extensive lesson and now you can almost say
corresponding reverse foot group - in this case, attribute, there are less controls floating around your character is fully rigged and ready to be
“l_footReverse_grp”. and since it works in angles, not in translation animated! Now, how about giving him more
aiming like the polevector,, it is much more emotion through facial expressions? That’s
If you followed these steps correctly, when you intuitive and clean to animate. what we are going to study in our next lesson.
rotate the reversed chain, the heel now raises Until then, practice what you have learned in
without losing ground contact! Ok, so create a float attribute on each arm and this lesson - how about trying to come up with
leg IK control, and make a direct connection to a solution for an automatic clavicle setup using
Reverse Foot Attributes the “twist” attribute of their respective ikHandles. Constraints, Expressions and Set Driven Keys!
Let’s add float attributes without min and max To finish, select those four ikHandles and in
values to the foot IK controller, which will drive the channelBox, set their polevector X, Y and Richard Kazuo &
the rotation of the respective reverse foot joints Z values to zero - this will “free” the movement, Danilo Pinheiro
for the animators to use. Let’s name them: reducing the flipping effect to almost none. For more from these artists visit:
“Raise Tip”, “Swivel Tip”, “Raise Heel”, “Swivel http://riggerman.animationblogspot.com/
Heel”, “Raise Foot” and “Swivel Foot”. Wrapping Up http://nilouco.blogspot.com
To finish our entire rig, group the “root_jnt”, Or contact:
The connections are always the same. Connect “l_footReverse_grp” and “r_footReverse_grp” richardyzo@gmail.com
the attribute to the corresponding joint using the as “joints_grp” and parent this group and the nilouco@gmail.com
Connection Editor panel (Any Mode > Window “ikHandles_grp” to the “Master_ctrl”.
> General Editors > Connection Editor). For
example (Fig.14): You can hide these two groups, leaving only the
geometry and the controls visible - and now our
• Raise Tip > footReverseTip_jxt.rotateZ setup is also scalable!
- Free Models
• Swivel Tip > footReverseTip_jxt.rotateY This resource includes
• Raise Heel > footReverseHeel_jxt.rotateZ You will notice the eyes and teeth are still not The Models Used Within This
• Swivel Heel > footReverseHeel_jxt.rotateY following the rig. We will see this is the next Tutorial

www.3dtotal.com page 27 Chapter 4


- Free Models
This resource includes
The Models Used Within This
Tutorial
Chapter 5: Facial Rigging

Introduction to be difficult to achieve some facial expressions

Rigging: 5 - Facial using any other deformer.

Rigging
TIP (blendShape target editing) = Remember to
Software used: Maya
never freeze the transformations of your copies,

Chapter Overview otherwise they will offset the overall position of


the mesh when deformed.
In this chapter, we will learn how to build a
simple yet powerful facial rig. We will explain
how to do facial expressions using blending
Facial Blend Shapes
Please try to make your rig as simple as
shapes and get more advanced results using
possible as we can get pretty good results
joints for local deformations of the face. It is
for facial animation using only basic blend model to create your blend shape targets, so
easy and fun (Fig.01).
shapes and combining some of them (hence, feel free to use the Deformation tools you want

Blendshape theory the “blending”). To help you build a good blend because there is not only one way to do this.
shape system look at the images in this chapter. These are the main targets for a simple facial
Sometimes deforming meshes by just painting
There are a lot of ways to modify your original rigging (Fig.02).
influences can be tiring and time consuming.
Instead we can model the desired deformation
and then apply it to our mesh using the
blendShape deformer. By duplicating our model
and deforming it using any modeling tool, we
have the ability to make these deformations
show up whenever we want by applying them as
blendShape targets.

To create a blendShape deformer, select


two meshes that have the same topology
(same number and order of points - do this
by duplicating the geometry), edit the copy as
desired and then select it and the original model
(in this order) and go to (Animation > Create
Deformers > Blend Shape). You will get a
blendShape deformer with an attribute that does
the transition from one geometry to another;
you decide how much influence to use in the
channelBox.

This works pretty much the same as joint


skinning. Each point has a starting position
(the default mesh) and an end position that is
weighted by an envelope multiplier. You can
even create exaggerated deformations or input
negative values if you need, just take care not to
overuse this feature and get ugly deformations.

The blendShape technique is widely used for


facial rigging for it’s speed and for when it would

www.3dtotal.com page 29 Chapter 5


Chapter 5: Facial Rigging
TIP (get blendShapes) = Use deformers like
clusters and lattices or simply move, rotate
and scale vertices, edges or faces to get the
blend shapes. You can also select the model
and press the “3” keyboard key to make it
smoother and easy to see the final result of your
blendShapes. Try it (Fig.03).

Modeling the targets


We usually model the blendShape targets
using the Move tool with the Soft Selection and
Reflection options turned on to edit vertices.
Hold the “B” button and drag on the viewport to
change the radius of this manipulator (Fig.04).

TIP (model blendShapes) = You can also model


the targets using another modeling software
other than Maya; just make sure you export and
import the mesh correctly without changing its
position and point order. will not be affected by the deformer. TIP (inputOrder) = Now, it is really very
• Duplicate the “tempToBS” and rename it as important to know what sequential order of input
Breaking the symmetry “mouth_LSmile”, if you painted the right side deformers are been applied in the character
Usually we create perfect symmetrical of the smile target as zero, for example. model. Depending on how the order is input
deformations, and sometimes we need to • Flood paint the entire mesh as value 1 again we can have problems, so verify this with care.
have them separated by left and right sides to and then paint the other side off; We can change this order by right-clicking and
break this symmetric feeling. To do this easily, • Duplicate the mesh as “mouth_RSmile”; holding the right mouse button over the model
duplicate the original model and rename it as • Repeat this process for all sliders you may and selecting Inputs > All Inputs...
a temporary copy like “tempToBS”. Apply all think useful.
blend shapes created on this new temporary The List of Input Operations window will be
copy by selecting all of them first and then the Do not forget to delete the “tempToBS” copy opened. To edit that order click and drag
“tempToBS” geometry. Finish by creating the after getting all the sided targets (Fig.05). the middle mouse button in the name of the
blendShape deformer. Look at the Blend Shape deformer and release the button below another
Editor (Any Mode > Window > Animation Editors Wrapping up node. The Blend Shape node must be below the
> Blend Shape) to see sliders that you can use The process of creating blendShapes can Skin Cluster node!
to control the intensity of each blend shape be made parallel with the body rigging and
respectively. then brought together at this point. Our next Do this process if you forget to turn the Front
step is to associate the modeled targets to of Chain on while creating your blendShape
Now, when you select the “tempToBS” copy the rigged model. Let’s do this by selecting all deformer (Fig.06).
and use the Paint Blend Shape Weight tool blend shape targets and lastly select the rigged
(Animation > Edit Deformers > Paint Blend model geometry (ett_body_geo) and apply
Shape Weights tool) you are able to choose the blendShape deformer using the command
what regions of the mesh will receive the (Animation > Create Deformers > Blend Shape),
deformation from the blend shape. This is what we usually use it with Check Topology turned
we are going to do to separate the sides: off and in the Advanced configuration tab of the
deformer, use Front of Chain as the Deformation
• Set value 0 for the desired blend shape Order.
slider and paint one side off - the side that

www.3dtotal.com page 30 Chapter 5


Chapter 5: Facial Rigging

Creating controls for


the targets
Finally we can create sliders as controls for your
blend shapes. These sliders can control single
or multiple channels and have horizontal (X)
and/or vertical (Y) freedom to be used. Create
a nurbs circle (Any Mode > Create > NURBS
Primitives > Circle), and in the nurbs’ create
history modify the Degree attribute to Linear,
Section to 4, Normal Y to 0 and Normal Z as
1, then rotate the circle 45 in Z axis and delete
the history (Any Mode > Edit > Delete by type >
History).

We can now use this circle as a boundary


background of our slider. Remember to edit
its vertices to obtain a space delimiter for
the slider, shape it like a box and turn on the
Template option box in Object Display of the
nurbsCircleShape node and rename it as
“*_sld_bg”.

Now create a nurbs circle, rename it as “*_sld_


ctrl”, limit its translation X and Z to zero and the
translate Y to min 0 and max 1. This object will
be a vertical and unilateral slider.

If you want to create a square control, limit the


translate X to min -1 and max 1. Usually, we
position these sliders on the top of the head and
group them as a child of the “head_ctrl”. In the
end, create simple texts (Any Mode > Create >
Text) to label this sliders (Fig.07).

To connect this slider to the blend shape, you


can use setDrivenKeys (Animation > Animate
> Set Driven Key > Set…) or maybe direct
connecting attributes (Any Mode > Window >
General Editors > Connection Editor) (Fig.08).

www.3dtotal.com page 31 Chapter 5


Chapter 5: Facial Rigging

Facial Joints
If you need more control over a specific facial area of your character you
can create joints to do this. Start by creating a single joint at the origin of
the scene (Animation > Skeleton > Joint Tool); you can do this by holding
the “X” key to snap on the grid, clicking at the center and pressing Enter.
Create a nurbs curve to be the control of this joint and scaleConstraint
and parentConstraint the joint to it. Group the control and move it to the
desired position on the face snapping to points holding the “V” key of the
keyboard. Repeat these steps for additional joints and do not forget to
name them properly (Fig.09).

To make the controls follow the head let’s group these control groups and
parentConstraint them to the head joint, jaw joint or another part to the
facial rig. Remember to put this group under “controls_grp” to keep our
scene clean and organized. Do the same to the joints we just created,
group them and parent under “joints_grp”.

Now, to deform the face with these new joints we need to add them as an
influence of the skinned geometry mesh. So, select all the facial joints and
the character model (face) and add the influences (Animation > Skin >
Edit Smooth Skin > Add Influence). on the chin joint. Skin these joints to the tongue geometry and create
nurbs curves shapes parented to the “chin_ctrl” to control these joints. It is
You can now paint the skin influences of the facial joints using (Animation really simple (Fig.11).
> Skin > Edit Smooth Skin > Paint Skin Weights tool) and getting the
values from the head and jaw joints (Fig.10). Teeth
The rigging of teeth is just geometries in groups that will receive
Tongue parentConstraints by curves following the “head_ctrl” (for the upTooth)
You can rig a simple tongue by creating three joints and parenting them and to the “chin_ctrl” (for lowTooth).

www.3dtotal.com page 32 Chapter 5


Chapter 5: Facial Rigging

Eyes Let’s create two layers to further organize back to where you still understand what you are
Animators prefer eyes that aim towards a “look things: doing and continue. This is the key to learning
at” control for characters. So what we do is • One for the character’s geometry called while having fun and without frustrations.
create two circles, one in front of each eye, and “ett_L_geo” - you can put this layer in
create another one as a father of these so we reference mode so the animators do not We hope you liked these lessons and got
can move the two eyes together. After that, we accidentally select the mesh; motivated to study even more! See you in the
just create aimConstraints selecting the eye • And another one for the character controls next chapter, where we will take a look into
controls and lastly the eye geometry group and called “ett_L_ctrl” - you can put the entire scripting - something every hardcore rigger
choosing the command (Animation Mode >> “controls_grp” in this layer. should know to help speed and efficiency in any
Constrain > Aim). kind of production.
If you followed our organization correctly, just
Finally, the last thing to do is to group the hide the “joints_grp” to make all the joints Richard Kazuo &
“eye_ctrl” named as “eye_ctrl_grp” and parent unreachable. It is simple as that. Danilo Pinheiro
it to the “head_ctrl”. Please remember the For more from these artists visit:
eye geometries must be in a group that is Conclusion http://riggerman.animationblogspot.com/
parentContrained and scaleConstrained to the All right! We pretty much reached the end of the http://nilouco.blogspot.com
“head_ctrl” (Fig.12). rigging part of our series as the next chapter Or contact them at:
will only cover scripting, so make sure to leave richardyzo@gmail.com
Wrapping up nothing behind! nilouco@gmail.com
We have come to the end of our rig. Everything
is working nicely and now we just have to hide Remember to always keep things simple and
some things from the animators to avoid them organized. Build up your understanding of the
moving and keyframing what they are not basics and try to come up with more complex
- Free Models
This resource includes
supposed to. solutions little by little. If you get mixed up, go
The Models Used Within This Tutorial

www.3dtotal.com page 33 Chapter 5


Chapter 6: Scripting

Introduction to
Rigging: 6 - Scripting
Software used: Maya

Chapter Overview
In this last chapter we will look at scripting for
Maya. Even if you are an animator or modeler,
knowing a little about scripting can help you in
ways you could never imagine! We can identify
the best cases for using scripting by analyzing
when you repeat certain tasks, like keyframing
sets of controllers or duplicating meshes for
symmetry modeling. In rigging this can also
be used, but in larger scales. Good examples
are the automation of the creation of rigs that
are always set up in the same manner, like a
reverse foot or when you need to constrain a
large quantity of objects while maintaining a
certain set of rules.

The Script Editor


So let’s get started. This window will be your
best friend when it comes to scripting! Open For instance, let’s create a nurbs sphere by help you to do different things each time the
it up by accessing (Any Mode > Window > typing “sphere” into the MEL tab in the script command is used.
General Editors > Script Editor). editor and then pressing the Ctrl+Enter keys on
the keyboard - this will run your command and Variables
Maya (version 8.5 or higher) comes with MEL create the sphere. Now, let’s use a flag to pass To help us make things dynamic, the variables
(Maya Embedded Language) and Python a parameter to the command. Type in “sphere exist. Variables store information that we can
scripting languages; you can choose which -radius 10” and see what happens! use in programming and as the name says, their
one to use in the script editor. While MEL is value can vary. Let’s create and use a variable
better integrated with Maya, Python has the TIP (info on any Maya command) = If you ever to better understand the concept:
advantage of being a language that is widely need to know what a command does or what
used in CG softwares and thus makes it very flags it expects, just hit F1 to see Maya’s help • Open up the Script Editor
efficient in cross-program scripts and in code documents. Go to Technical Documentation > • Type in: string $sphereName = “ball”;
reuse. For simplicity, we will use MEL script in Commands (or CommandsPython) to see all • Press Control+Enter on your keyboard to
our examples (Fig.01). available commands. Or you can use the Quick execute and then type: sphere -name
Help function on the Script Editor’s window. Just $sphereName;
Scripting Theory highlight the desired command on the script
To start understanding how scripting works editor, right click it to open up a Marking Menu If you did everything correctly, a sphere by the
in Maya, you can think about it this way: and select Quick Help (Fig.02). name of “ball” will be created. Try to assign
Everything you do in Maya by clicking with your another value for the $sphereName variable and
mouse is actually a “shortcut” to a command. So basically, whatever you do while working run the script again!
That command is logged into the script editor in Maya will be logged as a command in the
window where you can see it, copy and most of Script Editor. That means whenever you need TIP (using variables) = Remember to always
the times run it again, changing parameters (we to do repetitive tasks you can run a line of code declare (create) your variables before using
call them flags) if needed. multiple times and there are functions that will them. You can create your own variable names,

www.3dtotal.com page 35 Chapter 6


Chapter 6: Scripting
just do not forget to use the dollar sign ($) at 3. Finally the float variables, that are also create an integer array, you cannot populate
the start of its name! For example: $myName, used only for numbers, but contain only it with a string or a float number. To store and
$numberOfJoints, $currentFrame, etc... (Fig.03) fractional numbers like “1.0”, “3.96”, access data to the array you work with an index
“-560.34” and so on. identifier, pretty much like an unique number
Variable Data Types in a queue; the order the elements that are
There are lots of variable types in MEL; they TIP (casting variables) = You can force some being stored in the array is the order you will
exist to categorize data so the script does not variables to show as another type by casting. call it later (please remember that array indexes
try to perform any operation using variables You do this by writing the wanted data type always starts at zero!). Do not worry about this
that Maya cannot understand or execute. For name and then enclosing a variable or value now, things will get clear when we put it into
example, you can subtract numbers, but can in parenthesis right after that. Try writing “print practice.
you subtract letters? As there are several data (int(4.5));” in the script editor.
types, we will be only be looking at three in this To create an array, just put a pair of square
tutorial: Arrays brackets after the data type. For example: string
Sometimes we need to deal with a large amount $names[], int $numbers[], float $decimals[], etc.
1. We just declared $sphereName as a string of data and using lots of variables can be
variable - this kind of variable can contain troublesome. For these cases there is a different To populate arrays use a pair of braces
any text, including numbers, white spaces variable type with the ability to easily organize, encapsulating your data and separate them
and special characters like a tab or a return access and manipulate data. They are called with commas, like so: string $names[] = {“Julie”,
line; arrays. “Florence”, “Yuki”}; int $numbers[] = {1, -2, 4,
2. There is also the int variables that are used -8}, float $decimals[] = {1.34, 5.0005, -0.4498},
for numbers and can only contain whole, A single array can contain multiple strings, etc.
non-decimal numbers like “1”, “2”, “4”, “180”, integers, vectors, you name it - but only one
“-30”, and so on; type of data at a time. That means if you Loops
Now that you know the basics about variables
and arrays, let’s take a look at loops. Loops,
as the name suggests, are used to repeatedly
execute a piece of code several times. Combine
this with the power of an array and you will get
yourself a new best friend!

For a simple introduction, let’s execute this for


loop, like so:

int $numberArray[] = {1,2,3,4,5};


for ($i in $numberArray) {
print $i;
};

You will get the following result: “12345”.


Simple, right? You must be wondering about
that $i variable over there... it’s simply our index
variable. You can name it as you wish and you
don’t need to declare it before entering the loop
(unless you want to keep track of it’s last value).
So, every time the code between the braces
finish it goes back to the top, gets the next
data value in queue and repeats all over

www.3dtotal.com page 36 Chapter 6


Chapter 6: Scripting
again, changing the value of the $i variable
dynamically. To understand, take a look at this
next piece of code that is a bit more complex:

string $namesArray[] = {“John Doe”, “Dude”,


“Bob”};
for ($name in $namesArray) {
print (“Hello! My name is “ + $name + “. Nice
to meet you!\n”);
};

TIP (printing to a new line) = Notice the “\n”


at the end of the print string. That is a special
character used in strings that makes Maya
continue printing in a new line to prevent
concatenation, as happened in our first
numberArray example. Other special characters
include “\t” for tabbing and “\b” to create a nice
little... bullet thingy (Fig.04).

Conditionals
Ok, so far we can work on really simple
and repetitive scripts. But what if you need
something more complex like adding some
“choice-making” to them? Meet the conditionals. int $numberOfSpheres = 5; array that we can use later in a loop, for
int $i = 0; instance.
Conditionals allow your code to choose how to while ($i < $numberOfSpheres){
act based on any rule you write - better than sphere; NOTE: It’s important that you declare the
that, they prevent your scripts from breaking $i++; variable that will capture the return value(s) as
or even your software from crashing, just by }; the right data type, otherwise you may get a
checking if certain conditions are met. If not, data type error. Check the Maya Commands
you can make the action cease and display an When run, this code creates five spheres on top reference to see the expected return type for
error message or even continue through another of each other. The while conditional also works each function.
route. For instance: as a loop - in this case, the conditional worked
as a counter since at the end of every iteration, Procedures
string $selectedObjects[] = `ls -sl`; it was checking to see if the statement was still When your script starts to get bigger, it also
if (`objectType $selectedObjects[0]` == “joint” ){ true. When its not true anymore, the loop stops starts to get troublesome to edit variables
print “You have selected a joint! As a prize, running. whenever you need to debug it. Using
you win a polyCube!\n”; procedures we can run several lines of code
polyCube; TIP (capturing return values) = Notice the using a single command, easily feeding data
} else { grave accent (`) symbols surrounding the “ls” to it at the same time. Some more features
print “There is no joint selected! Bad, bad command of the first conditional example. In were added to our last script, take a look at the
user!\n”; MEL they are used to indicate that you want procedure below:
} to get and use the return value(s) of that
Now take a look at this other kind of conditional command. In other words, every object name
which can be very useful: that is listed using the “ls -sl” command will be
automatically put inside the $selectedObjects

www.3dtotal.com page 37 Chapter 6


Chapter 6: Scripting
proc createSpheres(string $sphereName, int creating our procedure with pseudo-code, so
$numberOfSpheres, float $positionOffset){ that we have a good guideline to follow:
int $i = 0;
while ($i < $numberOfSpheres){ proc zeroOut(){
sphere -name ($sphereName + ($i+1) ); //get the object
setAttr .translateX ($positionOffset*$i); //create the group and name it
$i++; //snap the group’s position to the object string $selectedObjects[] = `ls -sl`;
}; //parent the object to the group string $zeroOutGroup = `group -empty -name
}; } ($selectedObjects[0] + “_grp”)`;
string $constraint[] = `parentConstraint
After running the code above, nothing will TIP (comments) = You can comment lines in $selectedObjects[0] $zeroOutGroup`;
happen. That is because we only declared the your script so it is easier to organize and debug; delete $constraint;
createSphere command. Let’s run it by typing: just add two slash (//) symbols at the beginning parent $selectedObjects[0] $zeroOutGroup;
of a commented line. To comment multiple lines, }
createSpheres(“ball”, 5, 3); use a slash with an asterisk (/*) to start the
comment and an asterisk with a slash to end the Ta-daaa! To test it, select any object and type
You will notice five spheres with the name “ball” comment (*/). zeroOut at the command line!
were created separated by the same amount
of units we wrote as the $positionOffset value. Let’s see this line by line.
Much easier, right? It’s like creating your own The Create Finger
commands and defining your own flags (Fig.05). • The only way to get the selected object in Controls Procedure
Maya is by using the ls -sl command, so let’s Going a bit further in complexity, with all this
NOTE: In the rest of the chapter we will look at use it! Since it returns an array, we should brilliant knowledge we have seen so far, we
a couple of scripts and try to explain how they capture the results as so: can create a MEL script to automate the rigging
work as much as possible. Until now we have string $selectedObjects[] = `ls -sl`; process of fingers controls, so let’s code:
only seen the tools you can use to accomplish
certain tasks. But like in real life you can use • Now let’s create our zeroOut group - since // declare variables:
tools the way you want to build anything and we cannot set its position and orientation at string $mirror[] = {“l_”, “r_”};
most of the times there is not only one way to creation, let’s just give it a name. The same string $jointNames[] = {“thumb”, “index”,
do things. So keep in mind you can (and must) as the object, but with a suffix: “middle”, “ring”};
change whatever you see fit in the code in order string $zeroOutGroup = `group -name string $hierarchy[] = {“A”, “B”, “C”};
to experiment and understand. ($selectedObjects[0] + “_grp”)`;
// run loops to create curve controls:
Remember! Your best friend in any situation • With our group created, we need to snap for ($side in $mirror) {
is the Maya Commands Help documents, the position and orientation of the group to for ($jntName in $jointNames) {
accessible by pressing F1 inside Maya. If you be the same as the object. The easiest way for ($hier in $hierarchy) {
get stuck in a tricky part, try searching for similar is to parentConstraint it (then get rid of the string $control[] = `circle -ch off -r 0.4
scripts on the internet and learn by looking at constraint): -nr 1 0 0 -d 1 -name ($side+$jntName+$hier+”_
other people’s code. string $constraint = `parentConstraint ctrl”)`;
$selectedObjects[0] $zeroOutGroup`; parentConstraint -name “tempToDelete”
The ZeroOut Procedure delete $constraint; ($side+$jntName+$hier+”_jnt”) $control[0];
Alright! Now let’s test some of our gained delete “tempToDelete”;
knowledge to create a script! Something simple • And now, for the finishing touch: select -r $control[0];
and yet very, very useful... a zeroOut procedure. parent $selectedObjects[0] $zeroOutGroup; zeroOut(); // call zeroOut procedure
Ok, so what we need is to create a group to // control joints by control curves:
zero all the transformations of any selected Put it all together in order and you should get: parentConstraint $control[0]
object without moving it’s location. Let’s start by proc zeroOut(){ ($side+$jntName+$hier+”_jnt”);

www.3dtotal.com page 38 Chapter 6


Chapter 6: Scripting
}; • We declared arrays at the start of the code
// parent curve controls in hierarchy: to loop over them - imagine writing the same
parent ($side+$jntName+”B_ctrl_grp”) code over and over for each joint, it would be
($side+$jntName+”A_ctrl”); a waste of effort and a lot harder to debug.
parent ($side+$jntName+”C_ctrl_grp”)
($side+$jntName+”B_ctrl”); • Three nested loops: that creates even
}; shorter code! The script for the left and right
// put all inside a control group: sides is the same, so why not run everything
group -n ($side+”hand_fingerControls_grp”) twice only changing the prefix? The End
($side+”thumbA_ctrl_grp”) ($side+”indexA_ctrl_ In the next chapt.. wait a minute. This is the
grp”) ($side+”middleA_ctrl_grp”) ($side+”ringA_ • The code is limited to four fingers in the end of the Maya Introduction to Rigging Series!
ctrl_grp”); $jntNames array and three joints (A, B and Well, we hope that you enjoyed it and learned
}; C) on the $hierarchy array. Can you make a lot, because we sure did! Our concern was
(Fig.06) it work with more joints and fingers? A tip: to create good lessons (not too simple and not
store the controls names in an extra array. too complex) that could get anyone started on
To run this code, you have to create all rigging: a fun and rewarding experience!
the necessary joints, like “l_thumbA_jnt”, TIP (your first steps on automatic rigging) = this
“l_thumbB_jnt”, “l_thumbC_jnt”, “l_indexA_jnt”, code can be put into a procedure to be called Like we continuously repeated across our
and so on... inside an automatic rigging solution! Versatility lessons, this is only the start of your rigging
is the key! Take for example Danilo Pinheiro’s studies. Keep up the rhythm and do not forget
Some interesting things to notice in this code Auto Rig script, this tool can rig a character like to always think about the reasons why you are
are: the ETotal in less than an hour! (Fig.07) doing something. Try to always be organized
and simple - do not follow tutorials blindly. And
last but not least, try to always have fun while
you are at it - it is the key to learn faster and
better!

Danilo and Richard signing off now, see you


next time!

Richard Kazuo &


Danilo Pinheiro
For more from these artists visit:
http://riggerman.animationblogspot.com/
http://nilouco.blogspot.com
Or contact them at:
richardyzo@gmail.com
nilouco@gmail.com

www.3dtotal.com page 39 Chapter 6


Images from 3ds Max + Vray version of this eBook
3DTOTAL.COM
Visit 3DTotal.com to see our full range of training products

Lighting La Ruellle is our new Outdoor Illumination eBook which focuses on lighting a base scene under
very different atmospheric conditions. Each tutorial will show how to build a light rig and set up the renderer
to portray an environment which includes fog/mist, sunrise/sunset, moonlight, midday sun and overcast.
Throughout the five chapters you will be provided with a step by step account of how the scene can be
transformed into one of the above environments, encompassing a range of techniques that will present a
comprehensive insight into both lighting and rendering exterior scenes

Original Author: 3DTotal.com Ltd | Original Scene by: Richard Tilbury | Format: DOWNLOAD ONLY PDF
3DTOTAL.COM
Visit 3DTotal.com to see our full range of training products

Using 3ds Max and Photoshop this eBook teaches you how to create a fantasy scene inspired by real world
architecture, and how to correctly and effectively use reference photos of your chosen source of inspiration to
get stunning effects quickly and easily.

This eBook provides and instructs a great system to creating 3DStills in the quickest way whilst still getting great
results!

Original Author: 3DTotal.com Ltd | Platform: Suitable for all 3D software | Format: DOWNLOAD ONLY PDF
3DTOTAL.COM
Visit 3DTotal.com to see our full range of training products

The aim of this 198 page eBook is to provide both an efficient and methodical approach to creating characters
that can encompass both organic and mechanical components and equip artists with the knowledge to learn
techniques used by industry professionals. The series provides an in depth account of creating a character from
the concept and base mesh stages through to the final detailing and high poly sculpt. It will as its subject adopt
the theme of an alien humanoid in battle dress, partly clad in armor and carrying weapons.

Original Author: 3DTotal.com Ltd | Platform: ZBrush | Format: DOWNLOAD ONLY PDF | Pages: 198
3DTOTAL.COM
Visit 3DTotal.com to see our full range of training products

This e-book provides a detailed account of building, texturing and lighting the interior of a Gothic Church based
upon a concept painting. The ebook is available in five different platforms. Chapter two however is dedicated to
creating a gargoyle in Zbrush – the focal point in our scene. Here the author will start by creating a rough body
form using ZSpheres and move through the numerous sculpting phases and modeling the details for each part
of the character, highlighting the various brushes and tools used throughout.

Original Author: 3DTotal.com Ltd | Platforms: 3ds max, Cinema 4d, LightWave, Maya and Modo.
Format: DOWNLOAD ONLY PDF | Pages: 47+
3DTOTAL.COM
Visit 3DTotal.com to see our full range of training products

This six chapter eBook aims to show the value of post-production and more specifically the ways in which
Photoshop can be used to aid the 3D pipeline. Over the course of six chapters we shall focus on the various
tools and techniques on offer in Photoshop that are frequently used to improve 3D renders. Compositing
passes, adding particle effects, improving lighting and making general colour adjustments are a few of the
topics covered, as well as ways to create backgrounds that both complement and enhance characters.
The methods presented within this series can provide an efficient alternative to lengthy render test.

Original Author: 3DTotal.com Ltd | Platform: Photoshop | Format: DOWNLOAD ONLY PDF | Pages: 049
3DTOTAL.COM
Visit 3DTotal.com to see our full range of training products

Manimal is a Zbrush tutorial series divided into six parts, covering nearly 70 pages and addressing the process
of transforming a generic base mesh into an original creature design. The notion behind the series assumes
the task of genetically splicing a human being with a different animal class and sculpting the resultant character.
Each of the tutorials adopts a different animal class as its theme and walks through the stages of developing
a concept and sculpting the overall proportions through to the individual features and particular anatomical
mutations.

Original Author: 3DTotal.com Ltd | Platform: ZBrush | Format: DOWNLOAD ONLY PDF | Pages: 067

You might also like