Character Setup Overview

From Valve Developer Community
Revision as of 13:50, 6 June 2006 by Deadity (talk | contribs) (→‎Create Shapekeys: made a link to Character Facial Animation Shapekey Set page)
Jump to navigation Jump to search

The following procedure is a step-by-step overview of how to prepare and compile a character for use in the Source engine, using the SOFTIMAGE|XSI Mod Tool.

Build Your Model

Note.pngNote:If you're building your model using the XSI Mod Tool, you'll need to keep it within poly export limits which are 7500 triangles per enveloped mesh or character, and 4000 triangles for prop objects, or meshes without skeletons.

To get a triangle count for selected objects in XSI:

  1. Do one of the following:
    1. Click any viewport's eye icon and choose Visibility Options from the menu.
    2. From the main menu, choose View > Visibility Options (All Cameras). The Visibility Options property editor opens.
  2. From the Stats tab, activate the Selection/Scene Info > Show Selection Info option.

Texture Your Model

Using XSI (v4.2):

  1. Select all the polygons in the portion of the model you want to texture (e.g., the head).
  2. Click Edit->Create Cluster.
  3. Click Render->Get-Texture->Image and answer Yes to make a local material.
  4. In the image section of the property box, click New and select New from file..
  5. Select the texture for the cluster just created.
  6. Open the Texture Editor (alt-7) and UV map the cluster points as appropriate.

For information on how textures in XSI relate to materials in the Source engine, refer to Character Textures and Materials.

Set Up the Eyes

  • Each eye needs its own texture. For example, we use "eyeball_r.tga" and "eyeball_l.tga", or "dark_eyeball_r.tga" and "dark_eyeball_l.tga" for our eye textures. These texture names are accessed for rendering the eyeball shaders in the engine.
  • Create and position spheres for eyeball reference. These spheres should not be textured or enveloped, and will not be exported with actual model geometry.

click to view


  • Using XSI v4.2: You can use a VBS script such as this one to determine the positions of the centers of the spheres. Using the script, click on the sphere center in a Front view to get X-Y values and in a Top or Right view to get the Z value. You'll need those positions for input to QCEyes or to manually update the .qc file for the model.

Set Up the Mouth

The mouth geometry also needs its own texture (we use "mouth.tga" or "fmouth.tga") which has the texture data for the upper and lower teeth and inner mouth). Again, this texture name is accessed by the mouth shader in the engine.

Freeze Your Model

Before setting up and creating the facial animations, freeze the model using XSI's Freeze and Transform > Freeze All Transforms commands.

Define Animation Clusters

Create two clusters for the facial shapekeys (morphs):

  • One cluster for the flexible portion of the front of the face - from the lower front of the neck back to the front edge of the ears and up to the upper forehead.
Note.pngNote:Be sure NOT to include the teeth or inner mouth polygons in this cluster.
  • A separate cluster for the lower teeth.

Initialize the Shapekeys

On each animation cluster, initialize the shapekeys for frames 0 through 35.

A quick way to do this is to run ValveSource> Shape Tools > Init Shape Keys on each animation cluster. Be sure the cluster is selected before running the script. This will create a keyshape copy of frame 0 on frames 1 through 40

Create Shapekeys

You'll need to create shapekeys for frames 1-34. For the complete list of keyshapes see the Character_Facial_Animation_Shapekey_Set page.

  • To create a new keyshape, translate, rotate, or scale points to 'sculpt' the keyshape, then make sure that you have the appropriate cluster selected before you hit Animate > Deform > Shape > Save Shape Key.
  • To copy a shapekey to another frame number you can use the script ValveSource > Shape Tools > Copy Shape Keys.

Make sure to select the cluster with the corresponding shapekey, then run the script; you'll be prompted for the destination frame number.

You can blend a portion of one shapekey with another shapekey as follows:

  1. The first step is to select a cluster on the model and then hit ValveSource > Shape Tools > Blend Shape Keys > Set Cluster . This defines the cluster on which the shape key blending will occur. Points outside this cluster will never be changed.
  2. The second step is to make sure that proportional modeling is turned on, move to the frame that you want to blend from, then make a proportional selection of points in the cluster. This defines the source frame and the weight map for the blending.
  3. The third step is to move the key frame index (right click and drag in the timeline) to set the destination frame for the blending. You'll notice a green frame indicator on the destination frame, the red indicator on the source frame.
  4. Finally, hit ValveSource > Shape Tools > Blend Shape Keys >Blend Shape. This will update the shape key at the destination frame by blending the points between the two frames based on the weight map.

click to view

Import the Character Rig

You'll need to get a character rig. Use ValveSource > Characters > Biped Guide to set the size and position of your rig, then run ValveSource > Characters > Create Rig From Guide to create the rig.

You can also get a default male or female Valve rig with ValveSource > Helper Bone Tool > Default (Male/Female) Rig to load a Valve rig.

To add interpolator (helper) bones to your rig to help maintain better joint and limb deformations, you can use ValveSource > Helper Bone Tool > Import helper bones.

click to view

Envelope the Character Mesh to the Skeleton

Export a .smd File

The .smd file contains geometry, textures, envelope data and skeletal data.

To export a .smd file:

  1. Select your enveloped mesh and the entire ValveBiped branch.
  2. Open the SMD Export Options dialog from ValveSource> Export SMD....
  3. Select Model (.SMD) as your file type. Leave all Options checked, and click OK.
  4. Navigate to the appropriate directory and name for the exported .smd file and click OK.

Export a .VTA File.

The .VTA file contains facial animation data.

To export a .VTA file:

  1. Select your enveloped mesh and the entire ValveBiped branch.
  2. Open the SMD Export Options dialog from ValveSource> Export SMD....
  3. Select Vertex Animation (.VTA) as your file type, leave all Options checked, and hit OK.
  4. Navigate to the appropriate directory and name for the exported .VTA file and hit OK.

Set up Character Eye Data for the .qc File.

There are two ways to set up the character eye data:

  • Using the QCEyes applet: run QCEyes and the help screens/text will take you through the process.
  • Doing it by hand, as described in the Eye Position Setup document.

click to view

Edit the .qc File

The .qc file is the script for compiling your character resources (geometry, textures, animations, etc.) into a run-time model (.MDL).

To compile a new .MDL, you’ll need to do the following:

  1. Update the eye/face data (see Set Up the Eyes).
  2. Update the names of the model (modelname_reference.smd) and animation files (modelname_expressions.VTA) to the same names you exported from XSI.
  3. Update the run-time model name (modelname.MDL) to what you want the model to be named.

Compile the run-time model with StudioMDL

See Compiling Models for information on using StudioMDL to compile your character.


If you wish to make further changes to your model, see Making Changes to Your Character Model.

Template:Otherlang:en Template:Otherlang:en:jp