Monday 2 December 2013

Dynamic Hair Tutorial Part 2 (Dynamic connections)

Welcome to the second part of the dynamic hair tutorial, by me, if you have not checked out part one of the tutorial, check it out here: PART 1

In part 1, we have gone through setting up the mesh needed (skinned to joints) for a dynamic hair simulation, and also went through the setting up of curves for the dynamic hair system.

In this part 2, we are going to do some connections, connecting the curves and joints and the mesh all together step by step. From here onwards I will be addressing the curves you have created in the first tutorial as inputCurves.

To start off, load up your file (if you have closed it) and check that you have the following items from the previous tutorial:

Mesh (model/object)
Joint chain (skinned to mesh)
Hair follicles
inputCurves (child of their respective hair follicles)
Output hair curves (not the same as the original curves)
Hair systems

*hint* You can check the uploaded picture in the previous tutorial. *hint*

Next, isolate ([shift + I] or hide the rest [shift + H]) the joint chain and the output curves.

Isolation mode, the whole joint chain and all the output curves.
What you are getting ready to do is to IK spline the joints with the curves that are already made. Check the tools settings of the IK Spline tool located at:

Animation tab>Skeleton>IK Spline Handle Tool (option box)

Default settings.
Set it like so:
The settings needed.

We do not want the curves to be auto parented to the joints they are in because that might cause it to become missing in the rig, we want it outside anything; in its own group. We also want to check the "Auto create curve" OFF, because we want the joints to be driven by the dynamic output curves we created a while back.

Now you have your tool set up, time to IK Spline those joints.

Click on the first joint once the tool has been activated (you will see something like a cross hair)
Next, click on the curve that runs along that joint chain.
Lastly, click on the last joint of the same joint chain (must be at the place where the last curve point is).
Do this for the rest of the joint chains and you will get the following results, the brown lines are the IK Spline and the cross at the ends of each joint chain are its handles.

Do not worry about the blue and the red lines inside the joint chain here, those are merely the inputCurves and the output curves overlapping each other.
At this time, your hair is now able to move dynamically, however, if you try to do it, you might destroy your hair rig.

There are actually a few settings to set before you can have it flow with a master control. You can just press the "play" button but you will not see much happening. Truth be told you are just 70% done.

In case you do not know how it looks like, it is situated at the bottom right corner of the whole Maya interface by default.
Be mindful this is not Interactive Playback, so you cannot move anything while the time slider is playing.
First thing to set is the "point lock" attributes on all the follicles, either one by one in the attribute editor or do it like me, on the channel box on the right side.

"point lock" attribute is fourth (4th) from the top of the follicleShape.

Set it to base, by having done so, it means that the base (starting point of your inputCurve when you created it, which is also the start of your hair joint chain) is locked in place and will be acting like a pinned point while the rest of the points on the curve swing about freely.


Now if you zoom in close enough, you can see that the hair joints are already moving a little bit at the ends. In the next section I will be guiding you on how to integrate the hair system components (hairSystem, outputCurves, follicles and their inputCurves) into the master joint of the joint chain.

First thing you realise, when you want to move the master joint of the chain, this happens:

The individual hair joint chains do not move and you might destroy the rig if you do not place the joint you moved back.
Basically, you can never move the joints which are part of the IK Spline, because the whole chain is controlled by the IK Spline's curve, your inputCurve. Thus, you have to let the joint above the hair strands joint chains control the follicles with the inputCurves. Try it now and you should get a different and more favourable result.

Follicles under their direct parent joints.

Now it can be moved when the master joint is moved.
Now that the follicles are placed correctly, you can hide them along with the inputCurves.

Select the follicles and [shift + H] to hide the things you selected.
The hidden follicles will look like that in the Outliner when hidden.
You can delete the groups where the follicles originate from since they are empty, you may wish to group all the IK handles from the IK Splines, the hairSystem and the output curves into a group, just to keep the Outliner clean.

So your Outliner will not be cluttered with a lot of things.

YOU ARE DONE!!
(well not really)

Your result should look like the following when in Interactive Playback:


However, if you have noticed, the hair mesh is penetrating the "head", I will go through the collision methods to have the hair not penetrating the head and I will go through setting up the hairSystem node in the next part.

Click here for Part 3

If you have any questions, you can leave a comment or you can send an e-mail to me. Thank you for your audience.

No comments:

Post a Comment