Creating character animations
From Nexus Wiki
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.
Creating a character animation
The main steps are:
- Import an existing animation into Blender
- Modify the direction of movement in Blender
- Modify the length and sound associated to the animation
- Modify the animation
- Export the animation as a kf file
- Give the finishing touches in NifSkope
Import an existing animation into Blender
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:
- 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.
- 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).
- 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.
- 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:
- 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.
- 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
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:
- Select the Loc X curve and edit it (press the Tab key to enter Edit mode)
- 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.
- When both curves (Loc X and Loc Y) have the same shape press the Tab key again to exit Edit mode.
- 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.
- 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.
- Select the Loc Y curve and edit it (press the Tab key to enter Edit mode)
- 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.
- 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
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:
- Go to the screen Text editor
- Open the Anim file
- 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.
- 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.
- 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).
- 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
To export the animation:
- In Object mode select the skeleton (Scene Root)
- Select the menu option File -> Export -> NetImmerse/Gamebyro
- Select the folder and enter the name you want for the animation file (is has to have a .kf extension)
- On the export parameters window select Export animation only (kf) as shown in picture Exporting the animation.
- Click on OK.
Give the 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.