Animating the Character

In this section, we will add facial expressions and skeleton movements to the project.

The example project for practicing animation steps: 'tutorprojects/harry/rigged.r3d'.

To see Harry's expressions better, turn shaded OpenGL on. Then, select the SDS object, which represents the body and set it to the point edit mode. If the animation window is not opened yet at the bottom of the screen, open it from the View pull down menu or by hitting the hotkey F7. The number of frames, displayed on the animation window, can be for example 100. We can change it later if necessary.

Open the choreography window (Animation/Choreographs from the pull down menu or F6 hotkey). Go to the Time Lines tab. There is a list of choreographs on the left side of the window. Open the popup menu of the choreography list gadget and make sure 'Only Selected Objects' is enabled. Otherwise the hundreds of skeleton mapped hair choreographs may show up although they will not be edited.

Now the choreography list shows two items: 'Body:Init' and 'SDS UV Set:Init'. Click the latter one and select Delete from the popup menu. We will not animate the UV Set, so we can clean up the list this way.

You can open the contents of the Body's root choreography by clicking the little square at the left side of its name. It includes one item 'Skeleton1<-Backbone'. This is the choreography, which binds the body to the skeleton.

We will define a couple of expressions using a simple pose approach. Select the Body:Init choreography by clicking it and then New/Pose from the popup menu. A new item appears to the end of the choreography list. If you open its sub structure, you can see that it contains one animated attribute, Points. The attribute was automatically included in the pose because the previous skeleton chorography modifies geometry points.

Points are just what we want to pose, so we do not have to make any changes in the attribute list. However, Select the pose item and apply Rename from the popup menu to rename it as 'smile'. In the view window, move the points of the mouth to form a smile expression.

The first pose: Harry is smiling

Go to the Weights tab of the choreography window. The weight of the new pose is at the full level 1.0. Move the body.Smile slider down and up, and observe how the expression changes respectively. Leave the slider to zero position. This makes it easier to define more expressions. Poses are combined by adding the weighted point movements together, and it is best to define each pose starting from a neutral expression.

Select New/Pose again (you can have the existing pose or the body:init0 choreography selected when doing this). Rename the new pose as 'Open Mouth'. Then edit the mouth area to reflect this new expression. Try the weight slider of the new pose to open and close the mouth. Leave the weight to zero.

The second pose: the mouth wide open

You can add as many expressions as you like this way. Let's see how we can use the poses in animation. But before that, there is one important change we must make: the order of choreographs is wrong. Namely, the skeleton choreography should be after the face expression poses in the choreography list.

For example, the smile pose moves mouth sides upwards (up direction being defined in the object space of the body). If the skeleton had bent Harry's face to look down, movement upwards would move the points of the mouth inside the characters head, which is apparently wrong. To change the order, drag and drop the skeleton choreography after the two poses.

The skeleton deformation comes after the poses

Make sure that the body.init0 choreography is selected and pick New/Keyframer from the choreography list's popup menu. Click the new Keyframer item to activate it, and go to the Animateable Attributes tab. Find the attribute SmileWeight, select it and set Animated on. Do the same for the Open Mouth Weight.

The keyframer also includes Points as an animated attribute (it was included because the previous choreographs had it, too) - you may clear the animated state of that attribute. To do it, select Points from the attribute list and uncheck the Animated field. The keyframer will now only control the selected weights.

The pose weights prepared for key framing

Switch to the Weight Curves tab. Select Create predefined curve/45 degree curve from the popup menu of the curve gadget at the right side of the smile item. Change the curve type to Poly line - it is continuous enough for controlling expressions, and very easy to set up. Then edit the curve so that Harry starts smiling at the end of the animation. To achieve this, click the curve about at the frame 75 and move the inserted point down to zero level. Then click the curve about 10 frames later and move the new point up to the full level one.

Note: The Weight Curves tab shows the curves, which control choreographs. The program does not draw any numerical scales to keep space requirements minimal. This is important, because often several curves must be visible simultaneously for animation synchronization. The vertical range of the curve graphs is by default 0..1, which is suitable for weight control. You can examine and edit a single weight curve more accurately in the Properties tab, or adjust the graph to include some negative weight range, too. A smile with a weight -1 is an unhappy expression.

Apply the same two menus, Create predefined Curve/45 degree curve and Type/Poly line, to initialize a curve, which controls the Open Mouth choreography. This time edit a curve, which opens and closes the mouth a couple of times in the beginning, then again during the third quarter of the time line. This Curve makes Harry talk. Make sure that the weight goes to zero when smiling starts. Otherwise the expression - a smile with a fully opened mouth - might look strange.

Weight curves, which make Harry talk and smile

Now you can play the animation and check that everything works as expected. The playback speed may be somewhat slow, mainly because of the large number of hair objects connected to the skeleton. You can also open a smaller view window from the Windows pull down menu and apply Animation/Preview from its popup menu to create a quickly playable .avi preview.

Next we add some skeleton controlled motions to the character. For example, let's make Harry jump. Rewind the animation to the beginning. To make animation easier, take a top view and use toolbar's Analytic/Cube tool to create a floor object. Take a side view and move the floor under the feet. Select the skeleton and make sure the skeleton is in its native pose - apply the Native button of the toolbar if necessary.

The first phase of a jump is that Harry squats down to get some speed for his jump. This probably takes half a second. So, RMB click on the animation window about at the frame 12. The time slider jumps to that position. Put the skeleton into the edit mode. From the side view, zoom into the feet. Drag-select both toe bones. Set the anchor selector in the tool control bar from Free to Anchor. A little anchor symbol appears to the locked joints. Be careful to lock the joints where the toes start from the feet, not the tips of the toes.

Toes anchored to floor

Turn animation recording on. Move the mouse over the knee position and drag the point handle at the knee forward and down. Dragging activates the inversed kinematics tool, which computes a pose by rotating the connected bones. Do the same for the other knee. Note that you can hit the Esc key to cancel joint dragging at any time.

Drag the knees until the legs are properly bent. Then check the toes. It is possible that a toe angle constraint has rotated the toes of a foot when you bent the other leg. If that has happened, click the toe bone and drag from the red arc (forward kinematics handle) to rotate the toes so that they touch the floor.

Drag the knees with IK and fix the toes with FK

Click the backbone to activate it. Drag the red forward kinematics arc to rotate Harry's body to lean forward, so that his position becomes more balanced. Turn Shaded OpenGL off (from the View property window's Draw tab) if it is hard to see the handles inside the shaded skin. Then take a front view and zoom into the root of the horns.

Select the lowest bone of the left horn and rotate it upwards using the FK arc. Be careful and zoom in enough - the bone is quite small, and there are many handles in that area. If you accidentally drag too close of the black triangles, you will start the angle constraint modification instead of FK. If that happens, hit the Esc key. Do a similar rotation for the right horn. The idea is just to make the horns match the motions of the body. These kinds of little details are important in character animation.

Rotate the body forward and the horns straight up from the FK handles

The next keyframe shows Harry leaving the ground. The jump starts with a quick acceleration, so 5 frames is quite enough. Move the time slider to the frame 17. Take a side view. Drag the knees back and up, to straighten the legs. The heels should still stay off the floor. You can also drag the joint at the hip to adjust the body position, and the FK handle of the backbone to make the body point straight up. Because Harry is accelerating the speed upwards, the flexible horns should bend downwards. So, take a front view and drag the horns from their end points to bend downwards.

The next position could define the highest point of the jump. But because the motion up and down is almost symmetric, we will now define the the key position when Harry has just fallen back to the floor, and his feet start resisting the impact of the floor. The highest point of the jump will be defined afterwards.

Harry is on his way up

So, move the time slider 10 frames forward, to the frame 27. Now Harry is falling and the horns should point again upwards; apply IK to the horn ends to pose them. From the side view, move the heels slightly downwards.

Now move the time slider back in time to the frame 22. Here Harry has reached the maximum height and just starts falling. Click the backbone to activate it. Press the y key down to lock the movement to the Y axis and drag the spine bone to the up most point of the jump. At this point, the horns have returned to a relaxed position. So, apply IK from the front view to achieve that.

We already defined the key frame (frame 27), where Harry hits the floor. The next key frame shows a squat position, because of the impact of hitting the floor. The squat position can become deepest in the frame 30. Move the time slider to that frame. Apply IK to the knees to squat him, check the toes and rotate the spine bone to lean forward. Don't forget the horns - they bend again down from the impact.

Move to the frame 33. This frame ends the jump. We can easily restore the original position by hitting the native pose button in the tool control bar. Then turn off the animation recording. You can also select the toe bones and release the anchors. The jump cycle is now ready. Rewind and play the animation to see the result.

Harry squats when he hits the floor

If you followed the steps above, the motion probably looks quite good. However, some details need adjusting. Most likely the toes penetrate the floor when Harry straightens his legs. Let's fix these errors. Make sure the skeleton system is selected and open the choreography window. Go to the Time Lines tab.

The first thing that might need fixing is the length of time lines. We key framed the jump motion to happen during the frames 0 - 33. The program initialized the time lines to cover the whole animation. It will be easier to position and adjust the timing of the jump if the time lines reflect the key frame range. We will not add any other keyframe motions in this tutorial, and therefore we can set the root level time lines.

Click first the backbone.init0 choreography to select it. Open its sub time lines, including the keyfr1 time line, to see the animated attributes and their key positions. Press the Shift key down click the end knob of each .init choreography, one by one, to multi select it. Do not select any sub time lines! When all .init-related end knobs are selected, press both Shift and Alt keys down and drag the first selected knob to the frame 33. Alt-modifier scales the time line without moving underlying key frames.

Root level time lines normalized to match the key frame range

The keyframe choreography for the backbone includes some items we will not need. The native pose tool assigned also bone lengths to the skeletons. However, we did not actually change the bone length. A choreography, which assigns a constant value, is pretty harmless, but we can clean up the animation data and improve performance by removing unnecessary items. Click the Length 0 attribute name and hit the Del key to remove it. Remove also Length 1. Open also other keyframe choreographs and delete the length attributes from them.

Next we will change the time when the jump happens. Harry is talking in the beginning of the animation - let's make him jump after that, starting from the frame 25. Click in the middle of the time line of the first choreography (backbone.init). Press the Shift key down and select the rest of .init time lines by clicking in the middle of them. Shift key held down, LMB drag the first selected time line to the right, until the start knob is about at the frame 25.

Time lines moved to a later moment

Next we solve the problem of foot penetration into the floor. Move the time to the frame 25, where the jump starts. You can step the animation time back and forth frame by frame either by LMB clicking the time line, using the mouse wheel over teh time line or with the + and - hotkeys. Move time forward, until you find the frame where the feet are in the lowest position. In the example animation, it is the frame 31. Select the choreography attribute backbone.init0/keyfr1/RootPosition and go to the Properties tab. The position curves are defined in the object space of the skeleton. The red curve shows the motion in the vertical direction. Click the red curve in the position, which corresponds the frame 31. A new point appears to the curve. With this new key frame, we can fine tune the motion. Drag the point upwards, until the feet no longer penetrate the floor. The view window is updated instantly to reflect the editing of the animation curve.

Note that the final height position of the feet is defined as a combination of several bone angles and the base position, which we just edited. Setting y=0 for the new curve knot does not mean that feet touch the floor. It means that Harry's hip is at the same height as in the first frame. If knees are bent or ankles are pointing straight down, feet will not match the ground.

Foot penetration fixed in the frame 31

When you move the time forward, you will notice that some frames later the feet penetrate the floor again. You can add a new point to the red curve and move it upwards to compensate. However, if you solve the penetration by only editing the vertical position of the skeleton, the result may look unnatural.

A better solution is to check all the joint angle curves and edit them as well. For example, leg1.init0/keyfr1/Angle 2 is the angle of the ankle. The ankles do not straighten up in the beginning of the jump. They give the final push for the jump just before the feet get off the ground. Editing the red curve to reflect this fact will create a better-looking motion and reduce the penetration problem.

Ankle rotations improved

Getting the motion right will take a lot of curve editing for all choreographs. It is also important to understand what the curves define, what is the relation of curvature to acceleration etc. Just continue editing the curves and experimenting until you learn to control the motions via the curves.

When you are satisfied with the jump motion, save the project.