At this stage in the
series, after eight information packed tutorials, we have pretty much
covered all the bases. You have worked through both high and low
polygon modeling, UV mapping and also texturing. This was then
followed closely with skeleton building, rigging and even two
approaches to facial rigging, leaving you with a character ready to
be animated.

From here we have only
two more areas to investigate, and the first being a pretty obvious
one. As your moving and posing Kila don't you get the feeling
something is missing, perhaps we have overlooked a key area?

Well, look closer at
her head and you will soon realize that her hair, no matter how much
you move her, remains static. Yes her body moves, her face emotes, but
the hair is still a solid, inanimate block of polygons.

In this, the ninth part
of the Game Character Creation Series we will investigate a
number of ways to rectify this and bring Kila's hair to life.

Your Options

These days, real time
hair and cloth animation can be approached a wide variety of ways,
with most being dictated by the target platform and the game engine
you’re using.

At the lower end of the
scale most hair or cloth remains static, or is simplified so it needs
the minimum amount of hand animation. This is to help reduce the
strain on the processors as it tries to include the extra
calculations needed for the additional joints and deformation data.

Jump to the opposite
end of the scale and most hair and cloth simulations can be done in
code, being calculated in real time as the character interacts with
the game world.

Take the recent Tomb
Raider reboot, which utilized AMD's TressFX technology to create and
simulate each individual strand of hair on Lara's head. Granted, it
wasn't a perfect representation of hair, but it wasn't far off, yet
it demonstrated how close we are to replicating hair in the virtual
world.

In this tutorial we
will investigate two techniques to help drive the movement of Kila's
polygon strip based hair.

Firstly we will add
joints which, with the help of a simple rig, will allow you to pose
and animate the hair. Once we have those in place we can then look at
taking things a step further and introduce dynamics into the rig,
allowing Maya to do some of the work for you.

1. Add More Joints

Unless you’re
choosing to use blend shapes or a real time dynamics system like
TressFX, you are going to need something to help drive the
hair geometry. In this instance you will be calling on your old
friend the joint, to help you out again here.

Note:
In this tutorial you will be using the joint based facial rig version
of Kila created in Part 7, but feel free to follow along with the
blend shape version if you prefer.

Begin by going to
Modify > Evaluate Nodes > Ignore All. This will disable
the IK, and other influences on the Kila rig.

Next select the
Kila model and go to Skin > Go To Bind Pose, resetting her
to her default pose.

Note:
If this doesn't work, or you get an error, simply Right Click on the
root joint of Kila's skeleton and go to Assume Preferred Angle as an
alternative way to reset her.

What you need is a
single joint chain which you can then duplicate and reposition around
her head at key points. There is no need to add a joint chain for
each and every strand of her hair, this wouldn't be economical, plus
as Kila's hair is built from simple polygons strips you only want
subtle movement.

Note:
In hindsight, if you want more dynamic movement from your future
character's hair, you could add in more geometry from the start to take
this into account.

So let’s start
building the first chain.

Go to Skeleton
> Joint Tool.

Now create Five
new joints following the hair down the left side of Kila's head.

Before you move
on, rename these joints appropriately as shown below, to maintain a
tidy scene.

With the first
strip created you can now duplicate this to populate the left side
of Kila's head, and also add a one at the rear, making sure you
adjust them to fit the flow of the geometry.

Finally, rename
the joints in each chain to ensure you, or someone else, can quickly
find each in the scene.

2. Edit Orientations & Mirror

Now the joints for the
left side of Kila's hair have been created you can think about
generating them for the right. However, before you do it’s a good
idea to adjust each chain's rotational pivot so, when animated, they
naturally fan away from the head, rather than move in one direction
and end up passing through it.

Select each new
joint you created for the hair.

Now go to Display
> Transform Display > Local Rotational Axis.

What you are seeing now
are the orientations of each joint. By default they will simply be
trying to mimic the world orientations, so the Z axis will be
pointing forwards in most cases.

Note:
Don't worry if your orientations differ from the example shown.

If you rotate the
joints around the X axis now you will see that they will all rotate
forwards and pass through Kila's head, which isn't an ideal setup
for this rig.

To rectify this,
first use the Skeleton > Orient Jointtool to quickly
realign each axis, just as you did in Part 5 of this series. Ensure
that initially, each joint is oriented in the same way.

Next click the
Select By Component button on the top menu.

Now move over to
the right of that button and Right Click the Select Miscellaneous
Components button. This is the button with the question mark
icon.

While clicked make
sure Local Rotation Axes is enabled.

With this selected
you can now go in and physically select, and then rotate the
rotational axis for each joint, making sure the X axis is pointing
perpendicular to the curve of the head.

Now when you
rotate the joints around the X axis they should all move away from
the head, almost as if Kila is falling.

With the rotational
axes fixed it’s now a simple case of creating the joints for the
right side of Kila's hair.

First Parent each
new joint chain to the Head joint.

Now go to Skeleton
> Mirror Joint and open the options.

You should be
familiar with this tool by now, so set Mirror Across to YZ
and Mirror Function to Behavior.

Finally, under
Replacement Names for Duplicated Joints, set Search For
to L_ and Replace With to R_.

Click Apply and the right side of the head will now be generated for you.

As a final step
edit these joint chains to match the flow of the hair. You may need
to delete some joints as her hair on the right is tucked behind her
ear.

3. Binding

With the joints added
you now need to attach these to the hair geometry, and adjust how the
hair will deform by editing the weighting information.

Kila already has a
skinCluster attached, which is the node that stores all the
weighting information, so all you need to do is tell the new joints
to jump into that same skinCluster.

The new joints will now
influence the Kila model, but the problem is, particularly if you are
using the joint based facial rig, all the weighting information you
edited around the face has been destroyed.

If you move the
hair joints now, parts of her face and body will also move with
them.

You could start again
and rework all the weights in her upper body, and then move on to
work on her hair. Fortunately there is a simple solution which will
restore the weighting on Kila, and also give you back that precious
information on her head and face.

First Save the
current scene, giving it a new temporary name.

Now go to File
> Create Reference.

Point the browser
to the file you began this project with, which should be
Kila_Hair00_Start.ma, and reference it into the scene.

This will temporarily
bring the original file into the same scene and most importantly it
will also give you a version of Kila with the weighting information
intact.

Now select the
referenced Kila model and go to Skin > Go To Bind Pose,
making sure she is also in default pose.

Note:
Again, if this doesn't work, or you get an error, simply Right Click
on the root joint of Kila's skeleton and go to Assume Preferred
Angle, to reset her.

With the
referenced Kila model still selected, now add the main Kila model to
the selection. In effect you have selected the Source model
with the correct information and then the Destination model
where it will be transferred to.

Now go to Skin
> Edit Smooth Skin > Copy Skin Weights.

What you have done is
simply copied the weighting information from one version of Kila to
another, restoring the weights in her face in the process.

Quickly test this
by rotating the hair joints, and also animating her facial joints,
(if you have them). If everything is working you can then
move on to delete the referenced file.

To do this go to
File > Reference Editor.

Right Click on the
item called Kila_Hair00_StartRN Kila_Hair00_Start.ma and
select Reference > Remove Reference.

Your now back to stage
one, except your new hair joints are also contained in the main
skinCluster and influencing the model, plus you don't have to waste
time reworking the weights on her face.

4. Painting Hair Weights

If you're now rotating
the hair joints and nothing is happening, don't worry. When you copied
the weighting information across previously, it was from a version of
Kila without the hair joints, so in effect, there was no information
to be copied.

The hair is still
connected, but currently not being told to influence any vertices. In
a way this is good as it means you can safely work on the hair
without the need to touch anything else.

All you need to do now
is define the weighting information for the hair joints, a process
which we covered earlier in Part 5 and also Part 7, but we will
briefly recap here.

First it’s
important to pose the hair joints, so as you paint you will see the
geometry move showing how it’s being influenced.

Now select the
Kila model and go to Skin > Edit Smooth Skin > Paint Skin
Weights Tool and open the options.

If you recall, this is
the stage where the model will go black, showing in white or grey the
influence of the currently selected joints.

Right Click on the
first hair root joint and go toSelect Influence in the
marking menu.

Back in the Paint
Skin Weights window, now select Replace as your Paint Operation.

Next to Profile
select a softer brush.

Set Value
to 1and Opacity to around 1 – This time
around you want some more definite influences painting onto the
hair.

Note:
Opacity will paint a percentage of Value and gradually build up the
weighting for you until it reaches 1, which means the vertices are
effected fully by the specific joint.

With those set you
now need to paint over the vertices you want to be influenced by the
L_Hair_01_Root joint.

Note: If you paint
in too much influence, simply set Value to 0 and gently remove the
joints effect.

Continue this for
each joint in the current hierarchy, adding in more influence until
the full length of the hair strip is effected by the joint chain.

As a final step,
before you move on to the next joint chain, set Paint Operation
to Smooth, with a small Opacity of around 0.25.

Clicking Flood
will wash over the whole model, smoothing the weights for you, which
can help to make the hair appear less rigid and more organic as it
moves.

Tip:When using the Smooth operation it’s always a good idea to follow
it up with the Skin > Edit Smooth Skin > Prune Small Weights
option, just to tidy up any stray values.

You can now repeat
these steps for each of the left hand side joint chains for the
hair, and also the one at the rear.

Now that you have her left
side working well, you can focus on the right, but luckily you can
take the work you have already done and copy this across to her right
side.

To do this simply
select the Kila model and go to Skin > Edit Smooth Skin >
Mirror Skin Weightsand open the options.

Set Mirror
Across to YZ, and also make sure Normalize is
checked to clamp the weighting between the values of 0 and 1.

Now click Apply
and you are done.

This will mirror the
weighting information for her entire body, so make sure everything is
working as it should be before you proceed. Also check the weighting
on any areas which are not symmetrical, like her fringe, as these may
need some final adjustments.

5. A Simple Rig

The joints are now
driving the hair allowing you to pose and even animate it, and from
here you could call her complete and move on, letting the animator go
in and select each joint in turn.

This is an “OK”
approach, but not very intuitive, so instead lets now look at
applying a basic rig to add a little more control into the hair while
also making it easier to animate.

How you approach your
rig is entirely up to you. You could choose to simply connect
attributes to a main controller, unifying them so they are in one
place, or you could use Set Driven Keys, as you did with the
facial rig in Part 7, to lock in key hair poses.

What you will do in
this section is use a series of IK handles. This will simplify the
rig meaning that the animator is manipulating a few key controls,
rather than juggling five times as many joint attributes.

To begin go to
Skeleton > IK Handle Tool and open the options.

Make sure Current
Solver is set to Single-Chain Solver. For the hair you
don't require the extra rotation plane, so this solver will work
well here.

Now click the
first, root joint of the hair chain followed by the tip.

It’s quite a
simple setup, but if you now move the IK handle around you will see
that the joint chain will follow.

Adding the IK Handle
will allow you to quickly pose the entire joint chain just by
manipulating a single control.

However, with any rig
you ideally want visual controllers for the animator to work with,
rather than just the basic IK handles, so let’s add one next.

Create a new curve
based icon, or duplicate one of the existing ones in the scene.

Move this new icon
to the tip joint of the hair joint chain, the same place as the IK
Handle, and go toModify > Freeze Transforms to zero out
any attributes on it.

All you need to do
now is Parent the IK Handle to the new controller, and
then hide the IK Handle.

With one hair
joint chain rigged you can now repeat this process, adding a simple
IK Handle and control icon to the others.

These icons are a good
and simple approach to animating Kila's hair but at present they
don't move with her head, plus with a little bit of extra work you
could make them even better.

Select all the new
icons and Group them twice.

Call the new
groups HairGroup and HairControllers, with
HairControllers being at the top of the hierarchy.

Now move the
HairControllers group so it’s under the Kila_CS:Controls
group.

In order for these new
groups to move correctly the pivot point for each has to match that
of the head joint.

Select each new
group and press Insert.

Holding V, snap
each pivot to the Head joint's position.

Now select the
Head joint, and then add the HairControllers group to
the selection.

Finally go to
Constrain > Parent to lock the groups translations and
rotations to the head joint.

You will find now
that as you move Kila, all the hair controls will happily follow.

At this stage you are
probably wondering about that second group, HairGroup aren't
you? Well this extra node is going to give you even more control.

Note:
As we have covered adding and connecting attributes extensively
before we will just briefly cover the process here. If you are unsure
then please refer back to Part 6.

Create a new curve
based icon. For this example you could simply use an H
symbol, as it will help to represent the hair.

Now add a series
of new, float based attributes onto this icon using the Modify >
Add Attributes tool. The attributes are listed below.

Control
Visibility

Swing
FB

Swing
LR

Twist

Tilt
FB

Tilt
LR

Bounce

All you are going to do
now is use the Connection Editor to directly connect these
attributes with another on the HairGroup group.

Connect the
attributes as follows –

Control
Visibility > HairGroup.visibility

Swing
FB > HairGroup.translateZ

Swing
LR > HairGroup.translateX

Twist
> HairGroup.rotateY

Tilt
FB > HairGroup.rotateX

Tilt
LR > HairGroup.rotateZ

Bounce
> HairGroup.translateY

With these extra
controls added you can now animate her hair globally without having
to physically go in and select the HairGroup node, while also
having the option to pose each controller individually if you desire.

Note:
As always it’s a good idea with any rig to go in and Lock and Hide
any attributes which aren't to be used.

That’s the first
approach complete and what you have is a quick way to add movement to
Kila's hair as she moves around the game world.

Again, this is a basic
rig, but should be sufficient to get some movement into her once
static hair.

6. Applying nDynamics

We all know Maya is a
powerful application capable of many things, including simulations
using its complex nDynamics systems. So at this stage, after
you have spent days animating Kila, wouldn't it be nice to let Maya
do some of the work?

In this instance her
hair is a perfect area to bring Maya on board. As Kila moves around
her hair should follow and react accordingly, movement which could
easily be achieved using nDynamics.

This approach means you
don't need to worry about animating her hair and can concentrate on
polishing the animation elsewhere. Another plus side to this
technique is it is still essentially joint based, so the animation,
once simulated, can be happily baked and exported to use in your game
engine.

So where do you begin?
First you will need a curve to base the dynamics on.

First go back to a
previous version of Kila where the joints for the hair were created
and weighted, but not rigged. If you don't have one, then simply load
the file Kila_Hair01_Joints.ma.

Isolate one hair
joint chain for now. You will focus on applying dynamics to one
chain, and then the same steps can be repeated for the others.

Now go to Create
> EP Curve Tool.

What you need is a
curve which is made up of the same amount of control points as you
have joints so it can match its flexibility.

Holding down V
now click on each joint in turn, starting at the root and ending at
the tip. Holding V will enable Point Snapping, so each
point will lock to the center of each joint.

Press Return
to complete the curve.

Your new curve will now
be created and follow the joint chain perfectly, although it’s
still just a static curve, and isn't moving in any way. The next
stage is to tell Maya that this curve needs to be dynamic.

Select the new
curve.

Go to nHair >
Make Selected Curve Dynamic.

Your scene will now be
populated by a hand full of new dynamics based nodes, like a
hairSystem and Nucleus as well as a few new groups.
Don't let these worry you for now as you will only be using a hand
full of controls, so most of this can be ignored.

Even with these systems
in place you probably won't see much happening in the viewport, not
until you press play in the Time Slider. Even then you may
catch a slight wobble on the curve, but then it’s over all too
quickly.

Adjust your Time
Slider so the end time is something huge, like 100,000
frames. This will give Maya more time to evaluate the simulation
before it returns to frame 0.

This time select
the follicle1 node, which should be beneath the new
hairSystemFollicles group.

Now, rather than
pressing play in the Time Slider, go to nSolver >
Interactive Playback. What this will do is play back the
animation, while allowing you to interact with the scene.

Tip:
You can also press the green arrow button found in the nHair shelf.

Now you can move
the follicle1 node around and watch as the curve,
(illustrated in red) wobbles and moves as you would expect.

Note:
If your animation is still not playing back as it should, then you may
also need to adjust your playback preferences, ensuring they are set
to Play Every Frame.

Your curve is now
dynamic, and as you have seen, is reacting to the movement of the
follicle1node.

7. Driving the Joints

The curve is now setup
and reacting to the dynamics systems inside Maya, meaning if the
follicle1 node is animated, Maya will take care of the curves
movements for you. What you ideally need now is for the curve to
drive the joints, and to do this you need to create an IK Spline
Handle.

Go to Skeleton
> IK Spline Handle Tool and open the options.

You already have a
curve in the scene which you can attach the new spline IK, so you don't
need a new one automatically created.

DeselectAuto
Create Curve.

Now select the
first joint, and then add the last joint in the chain to the
selection.

Finally, holding
Control, select the dynamic curve. This will be the curve
found under thehairSystem1OutputCurvesgroup called curve2.

With the IK Spline
Handle created the curve will now also drive the joint chain.

You can see this
in action if you select the follicle1 node, activate
Interactive Playback and move it around in the viewport.

What you will also see
is that you have another problem, and that is the dynamics are
currently a separate entity to the rest of the Kila rig.

What this means is as
you move the follicle1 node the joint chain moves, but also
comes away from the head joint. You will probably also find that if
you move Kila, the dynamic joints remain static, stretching the
geometry and breaking the rig.

Select the Head
joint.

Next add the
follicle1 joint to the selection.

Now go to
Constrain > Parent.

This will make the
follicle1 node move with Kila's head, so if she animates the
dynamics will now move with her.

8. Adjusting the Dynamics System

You now have one joint
chain driven by dynamics, but before you repeat the process and apply
dynamics to the remaining hair joints, let’s look at adjusting some
basic settings to improve how this initial strand moves.

The first and most
obvious issue is that when the hair moves it appears to be locked at
the tip. Ideally you want the tip to flow freely.

Select the
follicle1 node and open the Attribute Editor.

If you look under
the follicleShape1 node you will see all the attributes
associated with this follicle. As I said earlier, they may look
intimidating but we only need to be concerned with a few key
attributes.

Under Follicle
Attributes you will notice a Point Lock drop down menu,
currently set to Both Ends.

Change Point
Lock to Base.

If you now move
Kila around during Interactive Playback you will see that
this has unlocked the tip of the curve, keeping just the base point
locked.

With the tip unlocked
you can turn your attention to the curves dynamic properties, which
will dictate how it will move in virtual space. These are things like
mass, drag and stiffness, all of which will contribute to the hairs
movement.

Tip:
It’s a good idea to apply some basic animation to Kila at this
stage, so you can see the dynamics in action without having to
physically move her each time. Just selecting and moving her root
node should be fine, and the keys can easily be deleted when you are
finished.

Select the
hairSystem1 node and open the Attribute Editor, making
sure you’re looking at the hairSystemShape1 node.

There are an awful lot
of attributes to play with here, but remember that this is a simple
dynamics setup so you can ignore most of these settings. In fact, the
only tab you need to look at initially is the Dynamic Properties
tab.

Note: I
won't go into too much depth on what each attribute does, instead I
will give a quick overview of key areas. With an nDynamics setup like
this I find it’s better to experiment than be told what to do, as
this will give you a much better idea of how each attribute effects
the curve.

Initially your hair may
have far too much movement, and even once Kila has stopped moving, it
seems to continue like it has a life of its own.

To help reduce
this, you can begin by adjusting the Start Curve Attract value
to something small like 0.1.

This will essentially
tell the hair to try and remain close to its start position, so a
greater value will have more influence.

You can also control
the effect this attribute has down the length of the hair through the
Attraction Scale graph below it. Changing the curve will
affect the falloff, so by default the effect is quite linear with the
attraction being strong to begin with but then reducing to almost
none at the tip.

In the example below
you can see this has been adjusted so only the hair towards the very
end of each curve will stray from the initial pose. This is a good
setup for Kila as it means the hair closer to her scalp will have
less movement.

These graphs occur
quite frequently throughout the hair system attributes, and can be
quite useful to adjust and experiment with to vary the overall effect
of the dynamics.

If you now focus
on the Forces tab you will see that this area allows you to
adjust the properties of the hair as a whole, and in here you can
adjust its Mass, Drag and other key attributes.

Mass
dictates how heavy the actual dynamics curve is, so leave this at 1
initially.

Adjusting Drag
will affect the amount of friction the hair has with the air around
it. A setting of around 0.1 is a good starting point for Kila as it
will slow down its movement slightly.

Damp
controls the amount of momentum the hair will inherit from Kila's
head. Leaving this at 0 will mean initially it inherits the
full movement, but feel free to adjust this to 0.1 if you
want her hair to be stiffer.

As you can see these
are just a few key attributes, so the rest for now can be left alone.
I do urge you to experiment with the other dynamic properties and
forces, not only to get a feel for what they do, but also to achieve
the movement you desire.

Tip:
Adding some Turbulence into the system will give the hair a little
variety in its movement, like there is a subtle breeze in the scene.

With your first
joint chain now fully driven by dynamics it’s now your turn to
work through and apply the same techniques to the others.

At this stage however I
would leave editing any new hairSystem nodes attributes as
next we will look at allowing each dynamics system to share the same
hair system.

9. Scene Cleanup

You should now have
dynamics setup on each hair joint chain, and in the process you have
probably noticed your Outliner filling up with a number of new
hairSystems and their associated groups and nodes.

This could be a good
thing, as it means that each joint chain has its own unique system
associated with it, meaning you could essentially use different
attributes per joint chain. For Kila it makes sense for her hair
strips to all use just one hair system, so it all moves and animates
in the same way.

You can quickly and
easily reassign hair systems in Maya.

Select all the
hair system nodes and groups, except for the hairSystem1
node.

Now go to nHair
> Assign Hair System > hairSystemShape1.

Once done you will see
that most of the nodes which sat under the hair system groups have
moved to be under the hairSystem1 nodes groups. There may
however be some strays which linger behind.

Move all remaining
follicle nodes so they are with the others under the
hairSystem1Follicles group.

Now delete all the
empty groups, and unused hairSystem nodes.

Finally rename the
hairSystem1 node to KilaHairSystem, hairSystem1Follicles
to KilaHairSystemFollicles and hairSystem1OutputCurves
to KilaHairSystemOutputCurves, just to clean up the scene and
make them more recognizable.

10. Adding a Basic Rig

Just as you did earlier
when you added the basic rig, you also now need to create a simple
controller for the dynamics. In this instance it’s probably even
more important, as adding a few simple attributes to an icon will
help to focus the animator on just the attributes they need to worry
about, rather than allowing them to stare blankly at the full list in
the attribute editor.

Just as you did
previously, create a new curve based icon. The H will work
nicely again here.

Now add a series
of new, float based attributes onto this icon using the Modify >
Add Attributes tool. The attributes are listed below.

Start
Curve Attr

Attr
Damp

Mass

Drag

Motion
Drag

Turbulence

Note:
Feel free to add any more attributes you may have found useful to
this list.

Use the Connection
Editor to directly connect these new attributes with the same
ones on the KilaHairSystem node, connecting them as follows –

Start
Curve Attr > Start Curve Attract

Attr
Damp > Attraction Damp

Mass
> Mass

Drag
> Drag

Motion
Drag > Motion Drag

Turbulence
> Turbulence Strength

Again, this is a simple
controller but adding it means the animator not only can animate
these attributes, but isn't distracted by other areas of the system.
In short, they can focus on animating.

Summary

We are now at the end
of Part 9 of this series with just one more to go, but to be honest
in this particular section there is a lot more I could have shared,
like adding more control into the dynamics hair rig, or even baking
out the animation when you are finished.

For now though I hope
you have learned even the basics of adding movement into Kila's hair,
be that through a simple IK based rig, or using nDynamics. From here
you have the foundations to take things further, experiment and
improve on these rigs to make them your own.

This leads us into the
tenth and final part of the Game Character Creation Series,
and although it’s the last, it’s probably one of the most
important as we take a look at generating Level of Detail models.