Creating character animations

From Nexus Mods Wiki
Jump to: navigation, search


You can create character animations from scratch or using existing animations and modifying them. The second approach is easier because you don't need to worry about things like setting the bone priorities becuase they will be already set in the animation you use as a starting point. This tutorial will explain the main steps involved in this second approach.

In addition to this, in this tutorial I am going to explain how to replace an existing animation with the one we are going to modify, so you won't need the Construction Set or the GECK.

I wrote this tutorial for Oblivion but it works for Fallout 3 as well.

Required tools

Creating a character animation

The main steps are:

  1. Import an existing animation into Blender
  2. Modify the direction of movement in Blender
  3. Modify the length and sound associated to the animation
  4. Modify the animation
  5. Export the animation as a kf file
  6. Give the finishing touches in NifSkope

Import an existing animation into Blender

Importing an animation

Choose an existing animation from the game that is similar to the one you want to create, and then import it into Blender following this steps:

  1. Select the menu option File -> Import -> Netimmerse/Gamebyro (.nif)
    Note: If you cannot find that option it is because you haven't installed NifScripts. Follow the instructions given here: Installation of Blender to install everything you need.
  2. Select the nif file that contains the skeleton you are going to animate (for Oblivion it is better to import the skeletonbeast.nif that is the one that contains the complete skeleton, inlcuding the tail of argonians and khajiit).
  3. In the import parameters screen select in the lower part the kf file that contains the animation that you are going to use as a base (Keyframe file) as shown in picture Importing an animation. Animation files are usually under the \Data\Meshes\characters\_male\ folder.
  4. Click on OK.

Now you will have in Blender the skeleton and the animation you've imported.

You can also import a body to see much better how the animation moves the body than if working only with the skeleton. To do this you will have to import the body parts also:

  1. Import into Blender the parts of the body you want to animate. Body parts are usually under the \Data\Meshes\characters\_male\ folder.
    Note: You can see a more detailed explanation on how to import the body into Blender here: Importing into Blender all parts of the Body. Although that tutorial is written for Fallout 3, it works for Oblivion as well.
  2. In Object mode select one part of the body and then the skeleton (Scene Root) pressing the Shift key to have both objects selected at the same time. Then press the Ctrl+P keys and select make parent to Armature from the pop up window. Repeat the process with each of the body parts until the skeleton is the parent of all of them. This way, the body will follow the skeleton when it is animated.

Modify the direction of movement in Blender

Starting IPO curves
Fixed IPO curves

Until now, when importing into Blender animations with movement (like animations for walking, swimming, running, etc), you have to modify the direction of movement or the animation will move sideways. It is possible that this bug will be fixed in future versions of NifScripts. When this is the case, you will be able to skip this step.

Once you have imported the animation into Blender, press the keys Alt+A to play it. You'll see that it moves sideways instead of forward. Luckily it is not difficult to fix this as it affects only one bone (Bip01) and working with IPO curves makes it quite easy.

* for more information on editing IPO diagrams see Edditing IPO Curves and Creating IPO Keyframes
* for other methods of fixing this sideways movement see Avoiding Blender animation pitfalls

In Pose mode select the Bip01 bone of your skeleton and you will see that its IPO curve looks like the one shown in picture Starting IPO curves. Your goal is to get something that looks like the IPO curves shown in picture Fixed IPO curves. To get it follow these steps:

  1. Select the Loc X curve and edit it (press the Tab key to enter Edit mode)
  2. One by one move up all the points of the curve until they are just on the same position than the points of the Loc Y curve. To move the points of the curve, select them and press G.
  3. When both curves (Loc X and Loc Y) have the same shape press the Tab key again to exit Edit mode.
  4. Select again the Loc X curve and select the menu option Curve -> Mirror -> Over vertical axis. This will make the Loc X curve to rotate around the vertical axis.
  5. Press the G key to grab the Loc X curve and move it horizontally until the first point of the curve is on Frame 1 and the last point of the curve is on the last frame of the animation.
  6. Select the Loc Y curve and edit it (press the Tab key to enter Edit mode)
  7. One by one move up all the points of the curve until all of them are forming a flat line. To move the points of the curve, select them and press G.
  8. Press the Tab key again to exit edit mode.

Once you've done this, the animation will move forward. You can check it by pressing Alt+A to play the animation.

Modify the length and sound associated to the animation

Editting the animation buffer

The length of the animation (for how long it plays) is measured in frames. The length of the animation you play inside Blender when pressing Alt+A can be different than the length of the animation in your game. The length of the animation in your game (Oblivion or Fallout) is set in a text file and, if the animation in Blender is longer than what that text file says, when exporting your animation you won't export those extra frames.

To modify the length of the animation in frames when exporting it (making it longer or shorter) and the sound that will play when playing the animation in game, do the following:

  1. Go to the screen Text editor
  2. Open the Anim file
  3. You'll see a screen like the one shown in picture Editting the animation buffer. In the example shown the Anim file indicates that the animation goes from frame 1 to 49 and that in frame 11 the sound FSTWaterSwim plays. You can edit the Anim file just typing on it like you will write in any text file.
  4. If you want to change the lenght of the animation modify the value of the last frame (49 in the example) to a higher or lower number.
  5. If you want to modify when the sound plays, modify the frame where if plays (11 in the example) to any other frame number that is inside the range of the animation (in the example, you can use any number from 1 to 49).
  6. If you want to modify the sound that plays, change the name of the sound of the animation (FSTWaterSwim in the example) for any other sound available in your game.

Any changes you make to this animation buffer will be exported together with your animation. You don't have to save the anim file as a txt file.

Modify the animation

In this part the basic work is to move the bones of the skeleton in each of the frames of the frames of the animation until you get them in the position you want. It is a laborious task as you have to move the bones one by one and frame by frame.

In this tutorial Your First Animation in 30 plus 30 Minutes Part I and Your First Animation in 30 plus 30 Minutes Part II you have the basic steps on how to create an animation in Blender. As you already have the skeleton and the weighted body, you can skip the first part of the tutorial and concentrate on the parts where it explains how to move the bones (Posing section of the tutorial).

You can also modify the animation using the IPO curves we used previously to fix the direction of movement.

Tip: If you are creating an animation that will loop several times in game, make your animation one frame longer in Blender than in the kf file. In the example, the exported animation will have 49 frames, so made it in Blender 50 frames long.
Then, copy the frame 1 into the last frame (in the example, copy frame 1 into frame 50), and don't set the position of the bones for the frames before the last (in the example, don't set positions for the bones for frames 49, 48, etc). This way, when the animation plays in game you will see a smooth transition from the end of one loop to the beginning of the next loop.

Export the animation as a kf file

Exporting the animation

To export the animation:

  1. In Object mode select the skeleton (Scene Root)
  2. Select the menu option File -> Export -> NetImmerse/Gamebyro
  3. Select the folder and enter the name you want for the animation file (is has to have a .kf extension)
  4. On the export parameters window select Export animation only (kf) as shown in picture Exporting the animation.
  5. Click on OK.

Give the finishing touches in NifSkope

Finishing touches in NifSkope

You will have to modify two values in NifSkope:

  • the value of NiControllerSequence: Blender will have put in this value the name of your animation and for the animation to work in Oblivion you will have to use the same name and the animation you want to replace. For example, if you want to replace the animation for swimming forward, you will have to put Forward there. To see what is the name you have to put there in other cases, open in NifSkope the original animation.
  • the value of Cycle Type: usually you will have to change this value into CYCLE_LOOP (if you want the animation to play continuously in a loop). Check also the value of this parameter in the original animation.

Once you've modified these values, save the kf file with the same name than the file of the original animation and copy it into the \Data\meshes\characters\_male\ folder. Now in your game, you'll see your animation playing instead of the original one.