Blender/Creating a Character Animation

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
Tools used in this tutorial

Required

Optional


Introduction[edit | edit source]

This is a basic tutorial that describes the process of creating and exporting a biped character animation from Blender. This focuses on making a stationary or "pose" animation but can be used for others as well.


Part 1: Setup[edit | edit source]

Start by opening Blender. This tutorial was written using 2.48. Some earlier versions may not have all the needed features, and the latest NIF scripts are absolutely necessary to avoid a tiresome workaround on export. Before we begin, we need a skeleton we can use for animation. Importing a skeleton alone does not work well with NIF scripts 2.1.13, so we'll need a body first. This will work just as well with the regular Bethesda meshes or any body mod, male or female. The following pictures will depict Robert's Average Male V4 (and later Fantasy Figures Beta).


Import the headhuman.nif from meshes/characters/imperial (or any other head of your choice) by selecting File -- import -- netimmerse/gamebryo. Then import the upperbody.nif, lowerbody.nif, hand.nif and foot.nif from meshes/characters/_male. Delete the skeleton pieces from each and every one of these as you import them. This is very important and prevents large problems later.


Select all of these body pieces and join them with ctrl+J. This makes a unified body mesh that will animate well.


Select the body you have created. Import the skeletonbeast.nif from meshes/characters/_male. Make sure you select the "import skeleton only and parent to selected" option as in this pic.


This should leave you with something like this.


This also shows you somewhat the number and type of windows you will need. The easiest way to manipulate frames of the animation is to use the Timeline. You can create a long, narrow window for this by right-clicking on the right or left-hand border of Blender and choosing "split." Then click on the little square in the corner and choose "Timeline" as shown.


The buttons window in the lower left should already be there for you. It is used in many things; in this tutorial it will largely be noteworthy for skeleton settings.


And very importantly, make sure you have a window in the lower right for the text buffer. Use your split command on the top border of the buttons window to create another box on the right, then select the little square and choose "text editor."


Now choose Text -- New. Give this the name "Anim" so that Blender knows we are working with the Anim buffer.


Now type what you see here.


You will end up varying the "end" number depending on how many frames you use. Animations will really never be two frames long unless they are a stationary pose.


This next part is needed in order to insure that your animation is given priority over others the game is using on a character, such as walking or the regular idles.


Switch to pose mode. Select all the bones by pressing the a key.


Now go to the button window and temporarily turn it into a scripts window - as you can see, it's the one with the green python for an icon. Choose the "Set Bone Priority" script under Scripts -- Object.

30 is a number that works well here.


Now turn your buttons window back into a buttons window and make sure you are still in Pose Mode.

We are ready to animate.


Part 2: Animation[edit | edit source]

So just to recapitulate, before animation begins the window should look roughly like this.


Note that we have the correct number of frames set up, and the timeline shows we are on frame 1 of 2 to start with.


Pictures are less useful at this point, because it's time to do the actual animating. The simplest way to do this is by selecting an individual bone and pressing "r" to rotate it. If you press 3 or ctrl+3 on the numpad, you can select both leg or arm bones at once to create symmetrical poses like the ones in this pic.


Look at the buttons window options here as well - having "x-ray" selected makes the bones visible through the body, and having "Names" and "Axes" turned off helps prevent clutter in our view.


The above pic also shows the timeline. You can see what frame you are on and click through the frames using the arrows on either side of the number 1. You can also change the number of frames by changing the number beside the word "end," but the text Anim buffer we created will determine how many frames are actually exported from Blender. Don't change one without changing the other.


Try to avoid translating the body too far up, down or to the sides as you animate, because that will mean more work in NifSkope later. You want to use rotation instead of translation whenever possible.


Remember, you can achieve more precision with your rotation of a bone by selecting x, y or z after pressing r. Pressing the ctrl key and holding it down while rotating insures you rotate in whole units and can be quite useful as well. With practice, you can create a pose very quickly. Moving individual finger joints takes the longest.


Once you have the pose where you want it in frame 1, press I key and choose locrot. This inserts a keyframe for location and rotation. Location is more important if you create an anim that actually moves rather than a stationary pose.


Move to frame 2. Repeat the insertion of a keyframe.


If you are creating a moving animation with many frames, you will need to continue this process through all of them. Instead of inserting a keyframe at every frame, however, you should be able to only stop, pose, and insert a keyframe every five to ten frames. Blender will then create steps in between. This is a bit risky since they may or may not look the way you wish. Creating moving animations takes considerable time and practice, which is why stationary poses are a good start in learning the export process.


When the pose or animation is completed to your satisfaction, you can play it back by pressing the "play" arrow on the timeline (you will not see changes if it is a stationary pose).


Part 3: Export[edit | edit source]

Now export using these or similar settings.


The most important thing is that you select "animation only." If you will be setting this up as an idle in the CS, you will need to create a new folder in meshes/characters/_male/IdleAnims for your animations.


Part 4: Nifskope Alchemy[edit | edit source]

Open your .kf file in NifSkope. Nothing is visible because there is no mesh data included.


You can see in the example that the nicontrollersequence node at the top (#0) is named "KNEELINGcower1." For it to be recognized by the game, it must be renamed to "specialidle_KNEELINGcower1." Your anim will need to have "specialidle_"in front of its name as well.


With this node selected, you can see information in the data blocks down below as well. Most important in this case are the start time, stop time and cycle type. Set the cycle type to "Loop." The start time should be 0. The stop time will be 0 as well if you are creating a stationary pose; change it to this if so. It will be a different number if you create a moving animation and probably will not require change.


Save now. This is a good spot to pause and playtest your anim. The Actors in Charge scripts by Trollf are a popular choice for getting optional animations into the game, or you can create your own plugin adding new idles, but that is a long topic for a separate tutorial. Alternately, you can back up one of your existing animations such as the idle.kf and replace it with your new one for the easiest playtest possible. (You will not want to leave things this way unless you want to constantly see your anim on every character in the game.)


If your animation already works at the correct height above the ground and is not at an odd angle, you do not need the next bit. However, since the current NIF scripts tend to ignore translations on the Bip01 NonAccum node, it is very possible you will need to do some tweaking post-export.


Part 5: Tweaking and Troubleshooting Translations[edit | edit source]

You will need this section if your animation places a character too high above the ground or, in case of this test animation, too low so that characters partly vanish into the floor. This may be preventable in Blender but, pending further understanding of those mechanics, this will fix the problem.


In the last pic you can see the "Num Controlled Blocks" line of the NiControllerSequence. Select that and double-click to expand it.


There are many controlled blocks. You need to locate the one called "Bip01 NonAccum."


Expand that node as well and find the number of the NiTransformInterpolater (in this case it's 20). Go to that node and expand it in the main details screen. Select the NiTransformData (in this case 21) and look at the details below.


Expand the Translations node and its Keys. There are two keys in this example, one per keyframe, but you could have many, many more if you create a moving animation. Either way, it will do no harm to set the number of keys to 2 in this particular array. This is the number next to "num keys." Right-click the green circling arrows and choose array -- update to update the number.


Now you should have one key for the start time and one for the stop time. Don't change the numbers if they're already this way - you don't need to change stop time to 0 for a pose in this particular place.


Normally the height given for Z should be 67.414 in this NonAccum node's translation keys. As you can see, it's 0 in the above example, which is why the test anim dropped partway through the floor. Changing the Z numbers to 67.414 fixes the problem.


This is why changing the number of translation keys to 2 is a good idea in this case. If you have a moving anim that is not meant to be translated on the Z axis, it can be very tedious to change all the Z values.