Rigging in XSI

From Valve Developer Community
Revision as of 06:24, 11 January 2006 by Stevenm64 (talk | contribs) (Fixed a error and started new section.)
Jump to: navigation, search

Rigging Your Character - The Easy Way

Anatomy of the Valve Character Rig

The first thing you need to know is how a HL2 character is setup in XSI.

Characters in Half-Life 2 are enveloped (skinned) to a skeletal rig. The skeletal rig is then animated to deform the envelope. These animations are then stored in the XSI Mixer and later exported to individual SMD file.

Take a look at the complete HL2 Character in detail. The character we will use as a base is a Counter-Strike character included in the source SDK. A image of the urban_reference.scn file

  • Start XSI Mod Tool
  • Select File->Open
  • Select the Source SDK sample scene called urban_reference.scn (\sourcesdk_content\cstrike\modelsrc\urban\xsi\urban_reference.scn)

Once loaded, you should see the character in what we will call the reference pose (neutral pose). The colored spheres and boxes are animation controllers (implicit geometry). They are simple helpers attached to the underlying skeletal rig (which is currently hidden). They make it simple to animate a complex rig without seeing the entire skeleton on screen.

Next, open up the XSI Scene Explorer by either selecting it from the Application menu (Application->Views->Explorer) or hitting the 8 key.

The explorer is a powerful tool to manage your scene. With the explorer, you can navigate through the hierarchy of the scene, re-parent stuff, call up properties, etc.

This image shows How the Scene is setup. How the urban_reference.scn file is setup

The rig is located under the model called urban_mdl. This model is simply a "container" object. The actual IK rig is located under the node called Bip01. At the bottom of the model, you see three groups. Groups are also a container object that points to a bunch of other object in the scene. They are handy for grouping similar object together.

Envelope Deformers is a group that contains are the objects (bones) that actually deform the mesh. That is, that have influence on at least 1 vertex in the mesh.

hidden_distractions simply contains all objects that are not immediately useful to the animator and that should be hidden (like parent nulls, IK chain roots and effectors. etc.)

Plotted is a group that contains all bones that should be considered when creating an animation clip. You will learn more about this group in chapter 3.

Understanding XSI Envelopes and Weights

Now let's look at the other part of the scene, the one we will be replacing with our own mesh. Before replacing it though, we must understand it's different parts. different parts of the original mesh.

When you expand the urban_mesh polygonal mesh object, you can see that it contains a property called "Polygonal Mesh". This is were you will find all operators that affect the mesh in any way. On the image above, you can see that this mesh has an Envelope Operator under it's animation set. A little lower, you can see a list of clusters containing two clusters. One is the WeightMap, the other is the UV coordinates. XSI uses clusters when it needs to store per-vertex attributes. For the weight map cluster, these are the weights for each vertex to the bones that are deforming it. And for the Texture_Coordinate_AUTO, well, it contains UV coordinates for each vertex.

The cluster that is interesting us for now is the WeightMap. Basically, we want to transfer this WeightMap onto our new character instead of re-enveloping the character manually. This automatic assignment of weights will literally save you hours of tedious mesh weighting.

Included in the Valve Source Addon for XSI is a nifty little export plugin called WeightMap Export. See below:

The Weightmap Export Option

To use it, follow these steps:

  • First select the mesh that has the weight map you want to export. In our case, select the urban_mesh object
  • From the ValveSource menu, select WeightMap Export
  • Give it a filename and save the map.

Importing Your Custom Mesh

The XSI Mod Tool comes built in with several importers available under the File->Import menu.

  • dotXSI - Softimage Open File Format
  • .3ds - Autodesk legacy format
  • .obj - Alias Scene(non Functional at this time)
  • .x - Microsoft DirectX file.

The following is the mesh we will use for our custom character. The new unskined mesh

Of course, you can always create your character from scratch directly in Mod Tool using it's powerful modeling toolset. Here is a small list of modeling tutorials for XSI.

http://www.xsibase.com/tutorials/modeling.php http://www.mindspring.com/%7Ebblakesley/Tutorial1/main.html http://www.chnl1.tv/tutorial_1.htm http://www.chnl1.tv/tutorial_2.htm http://www.anikoleez.com/tuto/tuto02.htm http://www.onionboy.co.uk/tutorials_eye.html http://www.joncrow.com/tutorials/xsi_tuts/rotoscope_technique/rotoscoping_technique.htm http://www.joncrow.com/tutorials/xsi_tuts/Symmetrical%20Shape%20Anim/sym_shape_anim_compressed.avi http://www.thejaco.com/tutorials/3_tire.avi http://www.anotherhell.com/tutorials.htm

The next step involves moving and scaling the character (and possibly moving some points as well) and try to match the position of the original mesh. Is it not mandatory that the mesh fits perfectly on top on the original mesh, but the better the fit, the better will be the resulting envelope. However, it is important that the joints (like elbows, knees, ankles, etc.) be at the same position. If they aren't, the arms and legs will bend in the wrong position.

The new mesh overlaying the original

Once you have place your character on top of the other one, you need to delete the old mesh. Do this by branch-selecting the urban_mesh object and hitting the delete key. Branch-selection means that it will select the mesh and everything under it as well. You branch-select something by middle-clicking on it. Or by selecting it and using the Select->Branch from the Select menu.

Next, we will re-import the saved weight map to transfer the weights onto our new mesh. To do this, do the following steps:

  • Select the mesh on which you want the weights to be applied.
  • Use the ValveSource->WeightMap Import menu.
  • Select the weightmap file you have saved earlier and click OK.

WeightMap Import Before

The WeightMap Import plugin will transfer the WeightMap by averaging the weights according to vertex positions. The results are not perfect, but again, it will save you hours of envelope tweaking. The following image shows the results after the weights have been imported.

WeightMap Import After

Test your WeightMap by moving the rig around. As you can see from the image below, some weights might need some tweaking. Here's a tutorial on Enveloping in XSI: http://www.softimage.com/education/Xsi/SelfPacedLearning/Tutorials/webTutorials/XSI_3_0/Char_Setup_env/XSI30_Tutorial07.pdf

WeightMap Problems.

Fixing WeightMap Problems

Rigging Your Character - From Scratch