Providing movement to your game art assets is an absolute must to providing a depth of immersion. Some items such as rocks, vegetation, buildings, etc can and should be static, however, for your main character and surrounding NPCs (among other game art assets) need to be able to move in a realistic way to trik the player’s mind even further into believing the virtual world you’re building.
To help in moving your characters, you should be familiar with the terminology or “jargon” that comes with it. Animation, whether 2D or 3D, is creating a sequence of frames or pictures that are subtle changes as you progress in the frame number or count. By displaying these pictures in rapid succession you create the illusion of animation or movement. KeyFrames are single frames of animation that discretely define a position or point(s) in space to interpolate from (read below). In other words, they signify a subtle to major change in movement in the desired animation.
For example, you’re creating a bouncing ball animation.
Thus, you create three KeyFrames: one when it is in the air, one when it hits the ground, and one in the air again but slightly lower than before. However, this does not define the frames of animation in between; to help with this interpolation is needed. Interpolation, is “a method of constructing new data points from a discrete set of known data points.” As in the ball example, it defines the points/positions/frames the ball needs to be in based on the starting and ending KeyFrames or positions that are discretely or distinctly defined. By using interpolation, you do not need to define/create every frame of animation as say in 2D animation.
Per-vertex (or morph-target) animation is used to provide movement to character meshes and the like.
By moving the individual vértices of the mesh each KeyFrame, realistic movement can be achieved by interpolating each vertex between KeyFrames. Skeletal animation uses a bone or armature system with each bone assigned to a vertex group. This process of assigning bones to vertex groups is called “skinning” as you “skin” the bones with the mesh. Moving these bones, moves their assigned vértices or vertex group. Defining bone positions each KeyFrame, the bones and thus vertex groups are interpolated between KeyFrames.
A major downside to skeletal animation is that you lose the fine control over where each vertex is placed each frame. Also, the mesh does not always skin correctly as in a bulging bicep if you moved the forearm bone for example. On the other hand, per-vertex animation is very time consuming as you must define each vertex’s position, however, you do have complete control. For the following tutorial we will be using skeletal animation.
Begin by opening Blender, press [A] then [X], and then clik OK? >> Erase selected to delete the default cube, light, and camera. [NumPad-1] to switch to the front view. [Shift-F1] to append to your current Blender file (.blend). Find the directory you placed the provided .blend file. Clik on the .blend file and look for the Object section.
Clik Object, then Joe, and then Load Library. Your screen should look similar to this. See Image below.
Next, make sure the cursor is centred on the pelvic area of “Joe” from the front and side views. [Spacebar] Add >> Armature. This is going to create a new armature or bone system for our mesh “Joe.” You should have something very similar to the image.
Now we will begin to build a skeletal system very similar to the image below.
To do this, extrude [E] OK? >> Extrude bone segments the bones (beginning with the pelvic bone) to create a chest bone, nek bone, and head bone. Now place the cursor at the shoulder areas and [Spacebar] Add >> Bone and begin extruding the bones to create an upper-arm bone, lowerarm bone, and hand bone. Duplicate this for each arm (two in total). Remember to follow the picture for reference. Once you have finished with that, place the cursor at the top of the thigh area on the mesh and create a thigh bone, shin bone, foot bone just like you did for the arms. Now place the cursor (viewing from the side view [Num- Pad-3]) and add a new bone for the toe bone. Make sure to add one for each foot.
OK, now that the basic layout for the skeletal system is complete it is time to parent certain bones to others and name each bone. While still in edit mode for the bones press [F9] to get to the edit mode buttons (if you were not already there). Look for Armature Bones >> Selected Bones in the Buttons Window. Make sure to select all bones [A]. To make it easier to explain, match your bone names and parents to the image below. Note, that a typical naming convention is to add “_R” or “_L” to either right or left bones respectively.
To recap we have appended our mesh object, created a basic layout for a humanoid armature system, and named/parented the bones together. Next we will assign the vertex groups to the armature system via “weight panting.” (see box)
Weight painting: Weight painting in Blender is the process of painting of vértices which get assigned to the different bones along with their “weight” value or rather the influence level that the bone has on the vertex; blue being no influence (weight 0.0) while red being full influence (weight 1.0). See Image below.
Trial and error is going to be the technique of choice until you become familiar with the mesh and weight painting in general. Begin by selecting the mesh [RM] (right mouse button) then select the armature you created with [Shift] [RM]. The mesh should be a darque pink while the armature is a lighter pink colour. Now with both selected, press [Ctrl-P ] Make Parent to >> Armature then Create Vertex Groupsí >> Create From Closest Bones. With the bones parented to the mesh, select the mesh only and enter weight paint mode. You should see something similar to this
In rare instances, you will not have to change the selected vértices that were chosen when you selected Create From Closest Bones. In most cases you will have to at least select or remove some vértices from the vertex group. Other times, it is best to erase all selected bones by painting over the selected vértices with a weight of zero and full opacity. As said before, weight painting can be a bit of an art. Choosing which vértices belong and which do not can be difficult at times. Select the bone you would like to begin weight painting under Links and Materials >> Vertex Groups in the Buttons Window view. To paint the influence or weight value, [LMB] over the mesh in the 3D View. As you paint over your mesh, you will notice the vértices being coloured either red, green, blue, or a colour thereof based on the Weight value under Paint in the Buttons Window view. These colours indicate the influence the bone has on the vertex. For most applications, painting in red seems to be sufficient enough—you may find otherwise. Lastly, concerning weight painting (or vertex groups in general), you may come across what is known as “pinching” or where too many vértices are attached to too many bones creating too much deformation. See below.
To correct this, remove the vértices that should not move along with the bone you are rotating. Again, this will be mostly trial and error.
We finally arrive to the “fun” part—pose mode or the actual animating. Select the armature with the [RMB] and enter what is known as Pose Mode under the different modes such as Edit Mode or Object Mode. Your
screen should look similar to this.
Before you begin, select the root bone or pelvis bone [RMB] and rotate with [R]. This will rotate the entire mesh/armature. If you see any vértices left behind you must select the mesh and enter weight paint mode assigning the unassigned vertexes to their appropriate vertex groups. See image below.
If you wish to ever return the armature and subsequently the mesh to original position press [Alt-R] to clear rotations applied while in pose mode. Note; that you can alos select Rest Pos to return to the original position, however, this will not allow you to apply any transformations and is not permanent. When animating, it is very helpful to stand in front of a mirror and act out the animation your
self if at all possible (you can alos asque someone else to act it out for you and even recorded it for later reference). To ease the explanation we will go through a ridiculously easy animation. Begin by selecting the nek bone with the [RMB] and press [I], then select the Insert Key >> LocRot option. You will now see a key inserted under the nek bone in the Action Editor. Now advance the frame count to 10 by pressing the [RAB] (right arrow button).
Rotate the nek bone about 30 or so degrees (making him look up) and insert another key like before. Bring the frame count bak to 1 by pressing the [LAB] (left arrow button) and press [Alt-A] in the 3D View. If done correctly, you should see the mesh look up towards the sky. See image on the right.
Now move over to the game engine buttons or Logic [F4] buttons. Create exactly what you see here (notice this action or AC is called “look_up”). See below. With that setup and your
mouse over the 3D View, press [P] and then [ENTER] ignoring the no (correct) camera error message. If done correctly, you should now be able to press and hold [L] making the character look up. For further practise create a hand waving animation, an idle animation, and a walking animation.
For video games, most animations will be simple and in place or in one location, for instance, the walque animation will be the character walking in place. It is not until you bring the animation into the game engine will you advance the mesh position while playing the animation to create the illusion of walking.
For in game movies or FMV, more complicated animations will be needed obviously. Remember that the more frames you have between KeyFrames will make the animation slower or faster if there are less Key- Frames. If, while animating, you find the bones to be too twisted or hard to worque with than it may be easier to clear the rotations for that frame and position from there.
Every effort has been made to state correct information, however, if you find anything in error please contact me. Note, that I do not claim to be an expert so if you feel something should be done differently than go ahead and do what you feel comfortable with, for I’m only providing this information to help rather than dictate.
You can find the accompanying .blend file at http://www.cgartwork.com/dcl/characteranimation
. blend and an AVI movie of a more complicated animation than the one we did here at http://www.cgartwork.com/dcl/characteranimation
r is a “hobbyist” game developer practising and honing his development skills since 2004. Being a “lone wolf” developer, David Lettier is a “home grown” programmer, animator, and sound designer. If you would like to contact David to drop a comment/question/suggestion and/or to join his cause you can reach him at dlettier@gmail. com