Navigation: 3ds Max

Tutorial 2 - Animating a Character


Overview

Now if you have a character model complete, like the one described in the previous tutorial, you are ready to animate it. If not then you can download the barbarian here or search for a different character. Here we will give a character bones so that we can animate it and use it as a game character.

Note: I have attached the hood, and arm bands to the main character mesh so these will be animated as well. The reason I modelled them separately was in case I wanted to attach them to other characters.


Figure 60.

Creating Bones

You don't actually have to use the bone system in 3ds max to create bones; You can use cubes for example instead as bones and use Select and Link to link them together if you find that easier. Here we will use the 3ds max bone system to create bones.

Before you start you need to be aware that you cannot use more than about 40 bones for your character if you will be loading him into a DirectX game. Also if you will be giving the character items or weapons then it is a good idea to create a hand bone so that you can give the character a sword or an axe for example.

Let's get started.

You want to aim for something like Figure 61.


Figure 61.

Note: Notice I have added bones for the cloth hanging down from the barbarian's belt. This stops the auto skin from making most of the cloth attached to the leg bones and also allows us to animate the cloth a little bit.

The idea is that you want to use the character's bones to animate the limbs such as the arms and legs. A head bone will also allow you to animate the character's head.

Go to Create -> Systems -> and select Bones (See Figure 62).


Figure 62.

Now when you click in a viewport a bone will be created. Working in the front viewport is probably easiest when you are making bones.

Start by making a Body Bone. The body bone will be the root bone so if you move this bone around then the whole character and all the other bones will be moved with it. That is why we start at the body.

Click in the Front viewport in the middle of the character's body and click down a bit to make the body bone(See Figure 63). Right Click anywhere to end using the bone tool. Press Delete on the keyboard to delete the other bone that get's created as we don't want it.


Figure 63.

We will create the leg bones from the body bone.

Select Bones again(See Figure 64).


Figure 64.

While the bone tool is selected click on the body bone to make a new bone, the right hip bone, that extends from the body bone. By doing that the new bone you create will be attached to the body bone. If you move the body bone the hip bone will be moved with it. You can continue to create the rest of the leg while the bone tool is selected(See Figure 65).


Figure 65.

Note: Make sure you create each bone at the joints of the character, the hip and knee joints for example.

Press Delete on the keyboard to delete the last bone after you right-click to end creating new bones.

Create the left leg by doing the same thing as you did for the right leg.

Now for any cloth on a character you will want to add a joint where the cloth will be moved around; you can keep it simple. For example I have created one bone that moves around a joint for the cloth hanging down(See Figure 66). You need to use two bones for the cloth.

Note: Make sure any bones you make are attached to the root bone, the body.


Figure 66.

Now you need to make the following bones starting from the body bone:
  • Right Hip Bone
  • Right Thigh Bone
  • Right Shin Bone
  • Right Foot Bone
  • Left Hip Bone
  • Left Thigh Bone
  • Left Shin Bone
  • Left Foot Bone
  • Cloth joint bone 1
  • Front cloth bone
  • Cloth joint bone 2
  • Back cloth bone
  • Neck bone
  • Neck bone 2
  • Head bone
  • Right shoulder bone
  • Right upper arm bone
  • Right lower arm bone
  • Right wrist bone
  • Right hand bone
  • Left shoulder bone
  • Left upper arm bone
  • Left lower arm bone
  • Left wrist bone
  • Left hand bone
You will get a skeleton that looks like this:


Figure 67.

Once you have created the bones it is a good idea to re-name them for example "BodyBone", "RightHipBone" (See Figure 68). Then you know what bone you have selected if they are not very visible and re-naming them is also very useful when you link the bones to the character as you will soon see.


Figure 68.

Once you have created the bones in front view you can move and rotate them so that they are positioned inside the character's body(See Figure 69). Move the root bone, the body bone, first so that it is positioned in the middle of the body. You may find it easier to create the back of the cloth bones after you have re-positioned some bones.


Figure 69.

Note: you can hide the character to get a better view of the bones by right-clicking the character and selecting Hide Selection.

The final skeleton for the barbarian character looks like this:


Figure 70.

Skinning the Character

Now that the character's bones are made and positioned we can link the bones to the character mesh so that when we move a bone like a leg bone, the character's leg will move with it.

By attaching the bones to the character we can animate the character and make it do things.
The technique we will use to achieve this is called "Skinning".

Select the character mesh and add a skin modifier:


Figure 71.

In the panel select "Add" beside "Bones: " (See Figure 72)


Figure 72.

Highlight all the bones in the menu that pops up(Figure 72). You can hold down CTRL+click to select multiple bones.

Press "Select"(Figure 72) to add the bones to the Skin Modifier (See Figure 73):


Figure 73.

As a result of adding the bones to the Skin Modifier, now the Skin Modifier has automatically assigned vertices of the character mesh to the bones but we need to fix the skinning so that all vertices are assigned to the correct bones.

To illustrate what I mean try rotating some of the bones like an arm or leg(Press Ctrl+Z to undo). You will see that most of the arm or leg moves as it should but some vertices might move undesirably.

To fix this problem, we need to assign the stray vertices to the bones that should control them.

I will start with the right leg. If I rotate the right leg in left view I can see that a vertex is not being moved with the leg(See Figure 74).


Figure 74.

Undo any movement or bone rotations you made.

Go back into the Skin Modifier and select Edit Envelopes (See Figure 75).


Figure 75.

Check the "Vertices" check box under Edit Envelopes.

Select the vertices you want to attach to the right leg bone (See Figure 76).


Figure 76.

In the list of bones select RightThighBone because we want to attach them to the right thigh bone(See Figure 77).


Figure 77.

Scroll the panel down and select the weight tool(See Figure 78).


Figure 78.

Enter 1 in the box that appears(See Figure 79). This value will be the weight that we want to give to the vertices we have selected. A value of 1 means that the right thigh bone will have complete control over them and a value less than 1 means that the right thigh bone will have less effect on them. Click "Set Weight" and the value 1 will be assigned to the vertices for the currently selected bone.


Figure 79.

Exit the Skin modifier(click on Skin) and rotate the right leg now, or whatever bone you updated. Now the vertices you updated should move with the bone.

If it still doesn't look right then you can continue setting the vertex weights as described until it does look right. You may also have to set some vertex weights to 0 to stop them from being moved by some bone; remember 1 means completely influenced by a bone and 0 means not influenced at all by a bone.

Fix all the vertices so that they are desirably influenced by each of the bones and then once you are done you will be ready to animate the bones and have a character that walks, jumps or whatever.

Good luck!

Animating the bones

Ok, if you were successful in applying the bones to the vertices then you can go ahead and animate the bones. Here is the barbarian I will be animating:


Figure 80.

It might take a little practice but if you think about how your own bones move when you walk, swing a sword, or jump then you can use this as a guide to animating humanoid game characters.

Let's say we want to do a walk cycle.

Since this is a game character and not a movie production character he pretty much needs to walk on the spot. You can make him bob up and down to give a bit of exaggeration to the walk if you like.

First think about when you walk you're legs are always going in the same motion as you walk along. They're always doing the same thing. Forward back, Forward back. This is the motion we want to create for a walk cycle.

Start by selecting a thigh bone. You're probably best doing the animating in left view to begin with.

Select Auto Key and click Set Keys to add the first key(See Figure 81).


Figure 81.

Set Keys records the position and rotation for all currently selected models or bones. In this case the thigh bone(See Figure 82).


Figure 82.

I will demonstrate key-framing by example.

Keep Auto Key turned on. Move the time slider to frame 10. Then rotate the thigh.

A frame is automatically insterted at frame 10(See Figure 83).


Figure 83.

Turn Auto Key off and drag the time slider from frame 0 to frame 10.
You can see that the leg has been animated.

Ok, we will make it so while one leg goes forward the other leg goes back. This will be the walking motion of the two thighs.

Select the other thigh.

Move the time slider to frame 0.

Select the Rotate tool.

Turn on Auto Key.

Click Set Keys to create a key frame at frame 0 for the left thigh(Or whatever thigh you have selected).

Move the time slider to frame 10 and while Auto Key is still turned on rotate the thigh in the opposite direction to the other thigh in the left viewport or perspective viewport.

Move the time slider from frame 0 to frame 10 again to see that the other thigh has been animated(See Figure 84). If it hasn't then please go over the steps again.


Figure 84.

Ok, so we've made it so it takes 10 frames for a leg to go from the middle position to forward or back. This means it should take 20 frames to go from completely back to completely forward.

Let's now make the legs go a complete length over 20 frames.

Move the time slider to frame 10.

Select one of the thighs.

Make sure Auto Key is turned on.

Move the time slider to frame 30(20 frames ahead).

Now rotate the thigh in the opposite direction it is currently in so that it is completely forward or completely backward.

Move the time slider to frame 10.

Select the other thigh.

Make sure Auto Key is turned on.

Move the time slider to frame 30(20 frames ahead).

Now rotate the thigh in the opposite direction it is currently in so that it is completely forward or completely backward.

Turn Auto Key off.

Now we want it so the walk cycle will repeat perfectly so we are going to copy the first keyframe(Actually keyframes), frame 0, and place the copied keyframe 10 frames ahead of frame 30 because keyframe 0 is a middle pose of the characters legs. It should take 20 frames for the legs to go from fully back to fully forward and therefore 10 frames to go from back to middle or forward to middle.

Select both thighs and drag a box around keyframe 0 on the time display to select it.

Hold down the Shift key and click and drag keyframe 0 to frame 40.

Now you have made a copy of keyframe 0 (See Figure 85).


Figure 85.

Drag the time slider from frame 0 to frame 40 to see that the thighs have been animated completely.

Also you can play the animation and loop frames 0 to 40 by going to Time Configuration and setting Start time to 0 and Length to 40(See Figure 86). Press Play to play the animation.


Figure 86.

Now you can animate the feet and hands in the same way as you did for the thighs.

I don't feel it's necessary for me to explain how to animate the arms and head. If you get stuck you can look over the steps I have described for animating the thighs. There is nothing new when it comes to animating the arms, head and feet.

Lastly you can make the character bob up and down by animating the body bone while he walks. Again this can be done in the same way as animating anything else by using Set Keys and Auto Key

The only thing left I can recommend is that you exaggerate the movement of this kind of character to make him appear confident.

Good Luck!