Animation in XSI

From Valve Developer Community
Revision as of 05:51, 11 January 2006 by Stevenm64 (talk | contribs) (Category changes)
Jump to: navigation, search

By KillerMonkey

I can be reached at with the same username


I STRONGLY suggest you read my beginner and texturing tutorial before you read this one. In this tutorial I will be discussing the major points of animating in XSI, and making a final deliverable into HL2. THIS IS NOT A TUTORIAL ON HOW TO ANIMATE A BIPED (AKA CHARACTER)

Some Definitions

A Skeleton

A skeleton is what comprises the moving parts of your model. A skeleton is comprised of "chains" of bones, joints, effectors, and a root. Some good things to know:
Bone: This is the principle object in the skeleton and is what is going to be attached to the mesh of your object
Joints: These are in between two bones, and is where bending and IK (defined below) occur
Effector: These move a bone system around, sorta like the end point
Root: Where your skeleton starts, if you mess with this it will move EVERYTHING in the skeleton as one unit

(NOTE: the default root shape is the 3D cross thing like the effector, I changed it to rings in its properties)

IK (Inverse Kinematics)

The backbone of animation in any game is the ability for bones to interact together in order to create realistic motion. This is where IK comes in. IK is how the bones and joints work together to create animation that is linked and able to be done easily without having to move every single bone every time you want them to take a step, or turn their head. More information can be obtained here: Inverse Kinematics

Animation Stuff

Some things to know about animation specific things.
Key: A point in the animation sequence where specific settings about the bones are saved into the frame. Two keys spread across a certain time automatically creates an interpolated sequence, essentially doing the 'animating' for us
Frame: A section of time in the entire sequence

Animating in XSI

This is a really advanced tutorial, and I am going to assume you have a good knowledge of the XSI layout, if you don't stop now and get that knowledge then come back. Okay here we go!

Placing a Skeleton

The first thing that needs to happen before we can start animating is to place a skeleton for your model. Your model can have as many skeletons as you want all working independent of each other. HOWEVER, only one bone can be used per mesh (more on this later).

To get your skeleton started we will make one for my security camera. Click 'MODEL' on the top left of the screen and then click 'ANIMATE'. This is the animation pane in which we can do some neat stuff! Now to create your skeleton go under 'CREATE' then click 'Skeleton' then 'Draw 3D Chain'.
The Skeleton buttons

Now place your points down, I suggest going in the middle of your object, however you'll have to experiment with a good position depending on what type of animation you are doing, you can always change the position later. AN IMPORTANT POINT to keep in mind is that all NON-ANIMATED parts of your model still needs to have a bone. This is because when you put it in HL2, it will only play the parts that are defined in the animation, and if there is no bone there will be no object. As you can see in my camera model I have NOT connected my two skeletons, this is because I do not want the base to be animated, just the camera (remember IK).
My Bones

Connecting Bones to "Skin"

When I refer to the mesh I mean the polygons of your object. You DO NOT have to combine a bone with the entire object, you can combine just a few polygons, vertecies, what have you! But for the security camera, I wanted the whole camera to rotate together so there is one bone that is bound to the the whole object (camera/lens). You do this by 'enveloping' the mesh to the bone.
Before starting 'enveloping', don't forget to perform Freeze and Transform > Freeze All Transforms on your model. Without these Freeze operations, your model won't be exported right. Then make sure you have selected Animation in the pull down list in the bottom left corner under 'Construction Mode' to ensure XSI is set in animation mode. To envelope your mesh make sure the things you want to attach to the bone are selected, then under 'DEFORM' click 'Envelope' then click 'Set Envelope'. A picker will become your cursor, so pick the bone you want to attack this stuff to, then right click to set it. Good, now you have stuff attached to a bone! Let's Play with it!!!

Animation Bar

Animation Bar

=== Blue Box ===
These are you animation playback controls. The two on the far left are to go from keyframe to keyframe (more on that later). The next four are your basic rewind, play backwards, play, and fast foward buttons. The last button is to say whether or not to keep looping the animation.

=== Red Boxes ===
In these boxes are information on what frame you are currently on, and how many frames you want in your total sequence. In the box on your left when you start your animation make sure 0 (zero) is in that box. You can go to different frames by just putting the frame number in that box, or by dragging the little red bar in the long timeline, or just clicking in the timeline. In the box on the left is how long (in frames) your animation sequence is. You can put whatever size you want in it, depends on how long your animation is going to be.

=== Yellow Box ===
In this popup menu are all sorts of sweet things. The main thing I want to focus on is the 'Animation Editor...' in which you can fine tune your animation and create so AWESOME effects really easily. You can also access this by pressing the number zero on the keyboard.

=== Green Box ===
Press this button to create a key. If this button is colored Gray you are placing your first key. If the button is colored GREEN then you are placing a key that will have interpolated values. If the button is RED it will delete the key at the current frame. If the button is shaded like it is now YOU CANNOT place a key!!! More on keys later (they are pretty indepth).

=== Purple Box ===
Finally, in the purple box is a magical list that you can use to pinpoint the exact type of transform you want to capture in a key. ie - If I only wanted to make the camera rotate back and forth I would select 'Ori.Y' and when I pressed the key button it would only store that value at that key!

Getting Dirty with Animation

Okay, I have filled your toolbox with a CRAP LOAD of new things. I hope you have made it this far, because this is where the fun begins. My rule of thumb is to KEEP IT SIMPLE STUPID, before we start moving onto more complex things. So make two cubes at 90 degrees to each other, texture them, make a skeleton with TWO bones and envelope each cube to their respective bone. When you finish that come back and we'll animate this sucker!

The Cube and Bone

Setting Up Your Workspace

This paragraph is EXTREMELY important. These are things that HAVE to be done in order for the animation to work correctly in HL2. You must make sure you start your animations on frame 0. Make sure any transformations you do, do them in global coordinates
Global Coordinates

Animating This SOB

Okay, in object selection mode select the effector. Now press V to enter Translate mode. Press the button to set a Key at the first frame (0). This is now our reference key, and the next key will interpolate from this position, if you wanted to start at another place just move the effector around and set that as your first key. Click on 20 in the timeline to set the place for your next Key. Now move the effector 10 units in the Y direction. Now make a second key at 20. Congratulations, you have just made your first animation in XSI!!!

I am working on more detail for this tutorial, if anyone wants to jump in where I left off by all means do so!