In this tut we're going to build a stable bones rig setup for a character. As I started thinking about it, there is a lot of work in even a basic character, so I will split it up into sections.
This 1st section will concentrate on the legs & feet because a) its the area where almost all animators use IK, & b) because I've had a couple of questions about this area recently. The methods discussed here are max based, but the concepts should carry over to most packages with IK systems.
OK, so before we start I want to run over a few terms and also to look briefly at how the bones system in max 4 has been updated. More advanced users may want to gloss over this 1st part, but I'm not going to go into great depth here, as the new features are discussed in the manuals & help files, so anyone wanting to go further should check in there 1st. This is a fairly intermediate level tutorial, so I'm going to assume some prior knowledge of things like aligning objects and assigning controllers in max, so I won't tell you where to find every button. I will however, explain some of the finer points and also anything that I think may be unclear along the way.
Bones & the IK systems in max 4 have been completely rewritten from the ground up. This is a welcome change as they were mainly unreliable & quirky to implement before. Anyone who is still stuck on max 3.x & using bones a lot, my 1st piece of advice is: UPGRADE!! You'll be glad you did! My second piece of advice is: If that's not an option, then get hold of a copy of 3d studio max 3 professional animation by Angie Jones & Sean Bonney. That book has a good discussion on rigging and stable IK setups in max 3.
OK, so the main changes to the bones/IK in max 4 are:
- Bones are now representations of the parent joint, not the child joint. This leads to a more intuitive manipulation of bones systems, because now when you rotate the bone length, (not the joint) directly under the shoulder you rotate the shoulder joint, not the elbow joint. Dunno about you, but that makes more sense to me.
- Bones are now parametric geometry, rather than a 2d wireframe representation of the bone. This has a whole host of benefits, including the fact that you can resize them to fit your mesh easier and get a closer representation of the volume of the mesh,making it easier to animate just the bones in order to speed up viewports. With the bones being actual geometry, you can edit them as you would any other object by collapsing them as an editable mesh/poly/patch. There is no reason why you couldn't model your character from bones and have the rig & mesh as one object! Also now any geometric object can act as a bone. You want a bone chain where the bones are made from teapot primitives? You got it, but good luck with the skinning!
- Bones can now have squash & stretch. Invaluable for that cartoony feel.
- Bones chains can be refined at any point by using the refine button. (No, really! : P ) For example, some animators like to split the forearm into 2 sections, one that controls the orientation of the arm, (usually the one near the elbow joint,) with the other controlling the forearm twist. This operation can now be performed at any stage of the rig creation/setup. There are other ways to do this though, as we shall see in later chapters.
- Bones are now created slightly differently. Instead of clicking and dragging for the length of the bone & releasing you now just left click where you want each joint to be and right click to finish as before. This is due to the bone being representations of the parent joint, as mentioned before. New to max 4 is the fact that parent bones are automatically rotated to face child bones. Also when you right click to finish creating a bone chain in max 4, you get a small extra bone, which I call the "nub". This nub is created to calculate the rotation of its parent bone, but is also helpful in the creation of IK chains, as we shall see.
- Bones can now have fins! This does not make them fish or even give them the ability to swim, but rather can be used to easily determine which way any particular bone in a chain is facing at any particular time. Think of a bone chain for a tail. In past versions of max it was necessary to view the mesh if you twisted the tail to make sure it was rotated correctly. With fins turned on, you can easily tell how any of the bones in the chain are oriented.
Fig 01. Which way are each of the bones in this chain oriented?
Fig 02. With fins activated we can easily see how twisted the tail is
The main improvements in IK in max 4 are that the IK solvers functionality have been separated from the actual base properties of bones and are implemented as a type of controller, meaning that any object can act as a bone as mentioned before but also that you can apply an IK solution to any hierarchy of objects. Also the IK solvers are written as extensible plug ins, meaning anyone, (with the right knowledge,) can write their own IK solvers. Max 4 comes with 3 IK controllers built in. These are the history dependent, history independent and limb solvers.Without getting into the various pros & cons of each and a big discussion on IK vs. FK, suffice to say that the HD solver is basically the IK solver from Max 3.x, the Limb solver was mainly developed with games companies in mind & the HI solver is manna from heaven for character animators & what we shall use here. Another fantastic addition to the IK arsenal in max 4 is the fact that every HI (& limb,) chain is automatically assigned an FK subcontroller. So what? Well, this means that you can effectively "switch off" the IK controller at any point, use FK on the chain & then just as easily switch it back on again. Pretty nifty eh? There is also an "IK for FK pose" feature. This is only available when the IK enabled button is switched off and allows you to move the chain by manipulating the IK goal, (end effector in max 3.x,) as you would for IK, but you get the arching motion of an FK chain, instead of the linear interpolation between keys that typifies IK motions. Nice.In max 4 IK chains, there swivel angle manipulator that allows you to turn the chain. This is used instead of the old up vector cheat that used look at controllers or similar in previous versions of max to control the angle of joints like knees.All in all, a very easy to implement and stable IK system.
Before we go any further, I just want to explain that this is not the only way to do this - obviously there are any number of ways, which may vary according to needs. For a start there is a very simplified version of this set up, but I wanted to do this version to get people trying some of the new features of max 4, like parameter wiring etc., so if you've never done any of that before, don't worry we'll go slow. ; ) The other main reason for this is that it gives us a rig which is stable an easy to use with lots of control.
So finally on to the actual tutorial part!
In max's left viewport, create two bones, the thigh & calf portions of the leg. Make sure you create them with a slight bend at the knee joint. This gives max a preferred angle for the chain & helps avoid the knee bending the wrong way. When you right click to finish, a nub bone is inserted automatically. I drew my bones with the bend to the left, but you may want to draw them to the right, as this has them facing towards you in the front viewport, rather than away from you as mine are. A good habit to get into is to use naming conventions. This helps to avoid problems later when you have 30-odd bones & can't remember if bone 17 is a leg or arm bone. I named mine L_thighbone, L_calfbone & L_legnub, but use whatever works. The preceding "L_" denotes which leg the bones are for in my world, making it easier to select bones from either leg. Go to the modify panel & adjust the bones width, height & taper to suit. My bones parameters were:
- L_Thigh bone: Width 25, Height 25, Taper 80.
- L_Calf bone: Width 20, Height 20, Taper 90.
- L_legnub: Default settings.
Fig 03. The main leg bones, seen here in the left & perspective viewports, respectively
Also turn on any fins that you feel necessary. I usually put one on the front of the thigh bone & one on the back of the calf bone as a visual aid. Due to drawing my bones right to left in terms of the knee bend as shown above I actually have to turn on the back fin for the thigh & the front one for the calf, but hey, as long as I know which way its all facing, I'm not too fussed.
Fig 04. Add fins to make them look like a caddillac. Or a fish. Or not
Hokay we have a leg but nothing to balance it on, so how about we make a foot?
In the left viewport again, draw two bones from the leg nub diagonally down/left the straight across left. The nub is created as usual. Play with the settings & fins again until you are happy.
My foot bones parameters:
- L_anklebone: Width 30, Height 7, Taper - default (90)
- L_toebone: Width 25, Height 5.
- L_footnub Width 5, Height 5. I also performed a non-uniform scale along the x axis. Whenever you do this with bones, always remember to go to the hierarchy tab & hit Reset - Scale.
& that's it! So thanks for reading &.... OK, just kidding. 1st we'll create the other leg & then start applying IK to the chains.
Double click the L_thighbone. This selects that bone & all its children. (This should work on any hierarchy too, afaik.) Go to the tools drop down & select mirror. Choose x axis, copy as the clone option, offset to taste, (I used 75 units,) & most important, check the "mirror bones" box. This is so that the pivots are the same way around on both legs. Mirroring is actually a negative scale function, so usually reverses the orientation. (Like a mirror view, see?)
Fig 05. Mirroring the bones
Even though the mirror dialogue has a "mirror IK limits" checkbox, its best to mirror the bones 1st & then add the individual IK chains after to avoid problems. OK, so now we have 2 legs, complete with feet. Next we'll set up some helper objects to aid in the animation process, then finally add the IK & link it all together.
I use my own helper objects rather than the usual dummy or point helpers, because then I can colour code them & have a visual reference as to what controls what. The large controller object is simply 3 circle splines at 90 degrees to each other. In the modify tab under rendering, you can tick "use render mesh" & use viewport settings to make it easier to view & select. The foot helpers are the same object just with an additional line spline added for a further visual aid. The heel objects are just modified circle splines, made to look a little like the outline of a shoe heel. If you want to download these helpers you can get them separately here
Fig 06. The helper objects in position
Position the helpers so that the COG sits between the top of the thighbones and that the foot controls line up with the heel and two joints of the foot. The heel control splines should sit under the foot where the heel would naturally be, but level with the floor. Use Fig 06. as a guide if you need.
Naming conventions for the helpers are as follows. The large one I named COG (Center Of Gravity), the foot helpers are named (L or R)_ankle control, (L or R)_BOF control, (Ball of Foot) & (L or R)_toe control. The heel controls are simply (L or R) heel, but as usual name them whatever works for you.
All done? Good, now we get to do the fun but complicated part, adding the IK chains & also adding some automated controls for the feet. OK, first & foremost, select an anklebone (doesn't matter which, as you'll have to do them both,) & hit "unlink selection". Huh? Why? Surely I want the foot to follow the leg when I move it? Well, yes you do, but not in the way that is set up at the moment. Trust me, we'll set it up in a minute so that the foot moves quite happily with the leg when animated.
Now select either thighbone, (its probably best that you work all down one leg for now & then go on to the other one afterwards,) and go to the animation drop down menu, choosing "IK solvers / HI solver". You should get a dotted line following your cursor. Click the legnub bone attached to the thighbone chain you selected, i.e. the legnub directly below the thighbone. Bingo! And that's it... OK not quite, but you did just add IK to your leg. To test the IK, select the IK goal, (the blue cross above the legnub,) & move it up on its y axis. Does the knee bend? (the foot SHOULD come off / not move with the leg at this stage btw.) Woohoo! Remember to hit ctrl-z or undo!
Fig 07. Testing the IK
To get a little techy here, if you look on the motion tab, under the IK solver properties rollout, you should see a section labeled "Parent space". The two options are "IK goal" & "Start joint". I've heard conflicting things about which this is supposed to be set to. One school of thought says that because the parent bone in the chain is connected to something else, (well, not yet but it will be connected to the COG later,) setting the parent space to IK goal prevents unwanted rotations being passed from the COG (or whatever,) down to the leg. The other school of thought is that setting the parent space to start joint prevents gimbal lock on the chain. If you don't know what gimbal lock is, put it into the max help or a search engine, as its too much to go into here, but suffice to say its a pain in the rear for animators & you don't want it. My thoughts? Well I'm glad you asked. My thoughts are thus: USE WHATEVER WORKS. Really, its that simple. If you find that you are getting rotations on the legs that you didn't create, try setting the parent space of all IK chains to IK goal. If you find you are having to afford expensive therapy due to the unbelievable gimbal lock problems you are having, try setting all of your IK chains parent space to start joint. Simple really.
Now would be a good time to play with the swivel angle too. Just above the parent space section you should see swivel angle. Mine was set to something like 175. Right click the arrows to the side of the number spinner & it should reset to 0. (This r-click works on all spinners to zero them out too.) Its good practice to reset the swivel angle for IK chains, as it can help avoid problems later. Drag the spinner up & down. You should see the knee rotate. You can also do this by selecting the IK goal & turning on manipulate mode. See that green line thing? Move that to manipulate the swivel angle. Its not quite an up-vector constraint, (so I'm told,) but its still very useful. Don't forget to r-click the spinner when you're done.
Unfortunately setting up the thigh to ankle IK chain was the easy bit. The foot requires a little more work but when you think that the human foot has more muscles, bones & tendons per square inch than any other area of the body, you've got it easy - imagine having to design the real thing! Select the (R or L)_anklebone & from the animation drop down menu choose, "constraints / position". Now choose the legnub bone that corresponds to the foot. You might find that the foot bones move up or down slightly, but at this stage that's OK because we don't have all the helpers linked up yet. If this happens, just move the helpers to line up with the foot again, or conversely, move the legs, (including feet,) & COG object to line up with the helpers. I always try to have the bottom of the feet at 0 on the y axis, as it makes it easy to drop in a floor & start animating. Another thing you might find is that the foot pops off if you move the IK goal down too far. If this happens its because you have multiple targets for the position constraint. Select an anklebone, go to the motion tab & under PRS parameters, choose the position button on the bottom left. Go down to the position constraint rollout & look in the target window. If you have anything other than legnub listed as a target, (most likely an IK chain,) then highlight it & hit delete position target. This will ensure that the feet follow the legs & don't pop off.
Next we set up the IK chains for the feet. Select the anklebone on the leg you've been working on so far & choose animation, IK solvers, HI solver. Select the BOF bone below the anklebone in the chain. You should see an IK goal appear where the joint between the two is. Now choose the BOF bone and apply HI IK to it and choose the footnub bone connected to it. Under IK display, turn off the enabled checkbox for the swivel angle manipulator, as you won't be using that on this section of the foot. The IK goal where the anklebone meets the BOF bone should have its swivel angle set to 0 by default, but the one near the toes might not. DO NOT RESET THIS ONE TO 0, or you may find yourself with a twisted foot. If you do, just undo until its back again. Right, now go do the other foot for practice & then we'll start on wiring up the helpers and automating the feet. Oh & btw, if the IK goals are a little large & you think you might select them by accident, you can change the size of them in the IK display rollout of the motion tab when the IK goal is selected..
Fig 08. All the IK chains applied
Now it starts to get fiddly. Select the toe control spline, (again either one - just concentrate on one leg at a time,) & use the align tool to align it to the toe IK goal. Select pivot point to pivot point and the y & z axis. Next, select the BOF control & align it to the mid foot IK goal, same settings. Finally select the ankle control and line it up with the back of the heel helper. Its OK to eyeball this one, but use the gridlines if you can. Use fig9. as a guide until yours looks like the left hand frame of fig 9 for both feet.
OK, now for the linking. Its important that you get these linked correctly or the rig will not work properly. My advice? Read this next section at least twice before trying it & go slow, starting again if necessary. That's what I did anyway.
- Link the toe IK goal to the toe control spline.
- Link both IK goals from the ankle & ball of foot to the ball control spline.
- Link the ball control spline to the toe control spline.
- Link the toe control spline to the ankle control spline (the one with the ball on, NOT the one shaped like a heel.)
- Lastly, link the ankle control spline (with the ball,) to the heel spline. (Shaped like a heel.)
Wow. Try moving the heel control spline up & down. Does the knee bend? Cool! Now try rotating each of the control splines with the ball on the end around the axis that runs along its line. (z in left viewport, x in front for me.) Way cool! Now try & get a pose like this:
Fig 10. Testing the controls
OK, you don't have to really. Undo until its all back to its default pose, then do the other leg.
Now we come to the automation part, which is a little fiddly but really cool. Select one of the heel controls, (R or L)_heel. In the animation menu, choose "add custom attribute". Choose parameter type - float, the UI type - spinner and set the width to somewhere between 70 - 100. (This value just decides how wide the actual spinner is so don't worry about it too much.) Name it something like (L or R)_foot roll. Set the range to go from -20 to 50, with the default at 0. (You can experiment with these values later, after you've seen what its for, depending on your needs.) In the finish section, choose objects base level & click add. In the heel's modifier tab at the bottom, you should see the custom attribute spinner. Try dragging the spinner - nothing happens. That's because at this stage we could apply that spinner to pretty much anything in the scene from animating a material to a foot roll, which coincidentally is the one we're going to do. Do the same thing for the other heel, remembering to adhere to naming conventions.
A very useful, but little known trick in max is being able to freeze an objects position or rotation. What this does is layer two controllers on to the object. One controller is kept at 0 as a reference and the other controller is animated. Basically the upshot is you can define a starting point for an object and then easily revert it back to that starting position or rotation at any time, kind of like zeroing out a spinner. To add this ability to your arsenal, we need to customize some quad menus. Go to customize user interface & choose quad menu. You can add the scripts that allow you to do this to any quad menu, but a recommendation I read was to add them to the animation 1 quad, which uses alt + right click to access. Go ahead, hit alt + r-click now in a viewport & the animation 1 quad should appear. (Unless you still have a dialogue box open of course.) With the dialogue box open, use the drop down menu & choose animation tools. Drag the freeze position and position to zero functions to the lower right quad & the freeze rotation and rotation t zero functions to the upper right quad, adding separators if you feel the need. Close the dialogue box & save you UI scheme with whatever name you want. Select one of the control splines & press alt + r-click. Choose freeze rotation. Rotate the spline as before to move that part of the foot. Alt + r-click again & choose rotation to zero. Cool huh? Add the freeze rotation to all the foot spline helpers, but not the heel control splines.
Last bit for this part coming up - reactor controllers to automate the foot roll. This will involve assigning layered controllers to ensure that the automation can be overridden in order to tweak a pose, so if you haven't assigned controllers before, you may want to take this next stage slow. I'm only going to explain this the once & the its up to you to apply it to the other side.
Select an ankle control spline & go to graph editors, track view, selected. Right click the ankle's name in track view & choose expand all. Find the Keyframe xyz : Euler xyz, x rotation track & hit the assign controller. Add a float list controller.
Fig 11. Adding layered controllers
Expand the x rotation: float list and then highlight the available slot and hit assign controller again. Choose float reactor.
Fig 12. Adding a reactor controller
In the dialogue box that pops up, hit react to and choose the heel control spline. You the get a series of choices. Choose "Object (editable spline), Custom attributes, (L or R)_foot roll. Don't close the reaction dialogue box.
Fig 13. Creating a reaction. (This pic has had some elements moved, so don't be surprised if yours is slightly different.)
Cool, you just set up your 1st reaction at 0. Now we'll set up a 2nd reaction to make the foot rock back on its heel. Keeping the reaction dialogue open, select the heel control spline & under custom attributes on the modify tab, set the spinner to -20. Now hit create reaction in the dialogue & move the state spinner to 0.8, or -0.8 if it rotates the wrong way. (This is another value you can experiment with afterwards) Look at fig14. for the correct foot position. Close the dialogue. You should still have the heel control spline selected. Move the foot roll spinner between 0 and -20. Oh yeah, that makes things easier!
Fig 14. The position the foot should be in after creating the second reaction & setting the foot roll spinner to -20
Reset the foot roll spinner to 0. Now on to the next helper. Select the BOF control and track view selected again. (You can access this command from the standard r-click quad menu.) As before find the keyframe xyz : euler xyz track & highlight x rotation. Hit assign controller & add a float list. Under the available slot, assign a float reactor. Click react to & choose the heel control custom attribute as before. That sets up the reaction at 0, now for the second one. Select the heel control & set the foot roll spinner to 25. Click create reaction and adjust the state spinner to 0.6 or -0.6 again, depending on which way around you created the bones at the start. Use fig16. as a guide. Basically, the foot should be on its toes.
Fig 15. The foot position for when the foot roll spinner is at 25
Last one for this foot. Keeping the foot roll spinner at 25, Select the toe control & as previously, track view selected, assign a float list to the x rotation of the keyframe xyz track. Highlight the available slot & assign a float reactor. Hit react to & choose the heel custom attribute: foot roll again. Now select the heel control, set the foot roll spinner to 50, hit create reaction & set the state spinner to 1.25 or -1.25, whichever gets the foot right up on its toes like a ballerina.
Fig 16. Woo Hoo! sexy gams!
Close the reactor controller dialogue & select the heel control spline. Roll the foot roll spinner up & down, taking in both extremes. Pretty cool eh? Also, because of the way we assigned the float list controllers, the reactor controller is secondary, with the bezier float being the default controller. What this means is that you can use the foot roll spinner, but still manually tweak & adjust poses by rotating the foot helper splines - oh yeah!
Now simply do all that again for the other foot.
Done? It wasn't as bad second time around now that you'd got used to it was it? OK, we're into the home straight now & I saved this bit until last so you can wind down after all that controller layering. Link both thighbones and both anklebones to the COG. Try Moving the COG or rotating it.
Go and get yourself your beverage of choice - you've earned it.
Really this time.
Download the max 4 scene file here
Download the helper objects seperately here