Character Setup Overview
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.
Contents
- 1 Build Your Model
- 2 Texture The Character Mesh
- 3 Set Up the Eyes
- 4 Set Up the Mouth
- 5 Freeze Your Model
- 6 Define Animation Clusters
- 7 Initialize the Shapekeys
- 8 Create Shapekeys
- 9 Import the Character Rig
- 10 Envelope the Character Mesh to the Skeleton
- 11 Export a .smd File
- 12 Export a .VTA File.
- 13 Set up Character Eye Data for the .qc File.
- 14 Edit the .qc File
- 15 Compile the run-time model with StudioMDL
Build Your Model
- The character seen in-game or in the Half-Life Model Viewer, usually loaded from a
.mdl
file; the combination of mesh, bones and animations comprising a character. Although texture names and paths to texture files are imbedded in the.mdl
file, the textures themselves are not part of the character model. - Incorrectly as the surface mesh created or imported into a modeling application, simulating the surface or skin of the character. Mesh or character mesh is a more precise term to be used for this modeling object.
- A distinct type of object in the XSI Mod Tool; in XSI, for Valve character model examples: a container for a heirarchical set of deformers ('bones') and their characteristics, and for groups of objects such as animation controls for the deformers.
The Goal
The purpose of modeling in the XSI Mod Tool is to put together information and export files which the model compiler, studiomdl.exe
, will use to create the files necessary for the game engine (HL2, HL2DM, CS:S, etc.) to display an animated character in-game.
With regard to the XSI Mod Tool, Studiomdl
will need:
- a model reference
.smd
file - an animation or skeletal reference
.smd
file - optionally, a vertex animation
.vta
file (primarily for facial animations)
A detailed description of what's contained in those files can be found on the SMD file format page.
General Construction Steps
In general, there are several steps for creating a character model:
- Create or import a mesh for the character, and apply a texture to the mesh. This provides the 'skin' that will be seen when the character model is viewed.
- Create or import a rig (deformers and controls). This provides the structure on which the 'skin' will be placed and provides the means to animate or provide movement for the character.
- Envelope the mesh to the deformers. The 'skin' will now move with the skeleton and be rendered as a solid object.
- Create new or adapt existing animations for the character.
- Export model reference, animation and, optionally, vertex animation files.
- Create or modify
.qc
and, optionally,.qci
files. - Compile the model.
To get a triangle count for selected objects in XSI:
- Do one of the following:
- Click any viewport's eye icon and choose Visibility Options from the menu.
- From the main menu, choose View > Visibility Options (All Cameras). The Visibility Options property editor opens.
- From the Stats tab, activate the Selection/Scene Info > Show Selection Info option.
Texture The Character Mesh
- If the mesh does not have a Texture Projection (check in Explorer):
- Click Get->Property->Texture Projection
- Select a projection appropriate for the mesh.
- Select all the polygons in the portion of the mesh you want to texture (e.g., the head).
- Click Edit->Create Cluster.
- Click Render->Get-Texture->Image and answer Yes to make a local material.
- In the image section of the property box, click New and select New from file..
- Select the texture for the cluster just created.
- 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,
"eyeball_r.tga"
and"eyeball_l.tga"
, or"dark_eyeball_r.tga"
and"dark_eyeball_l.tga"
(for the right and left eyes respectively) are used as the eye textures for most Valve characters. 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.
- A VBS file (Visual Basic Script) such as this one can be used to determine the positions of the centers of the spheres. Download the script file and save it with a
.vbs
extension to a location accessible from within XSI. In XSI, open the Script Editor, load the script and pressF5
to execute 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. Those positions are used for input to theQCEyes
application or to manually update the.qc
file for the model.
Set Up the Mouth
The mouth geometry also needs its own texture (e.g., "mouth.tga"
or "fmouth.tga"
) which has the texture data for the upper and lower teeth and inner mouth. The 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.
- 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.
- Since XSI 5.0, Save Shape Key has been renamed to Store and Apply Shape Key
- Make sure that the Construction Mode is set to Shape Modeling Mode
- 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:
- 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.
- 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.
- 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.
- 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.
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.
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:
- Select your enveloped mesh and the entire ValveBiped branch.
- Open the SMD Export Options dialog from ValveSource> Export SMD....
- Select Model (.SMD) as your file type. Leave all Options checked, and click OK.
- 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:
- Select your enveloped mesh and the entire ValveBiped branch.
- Open the SMD Export Options dialog from ValveSource> Export SMD....
- Select Vertex Animation (.VTA) as your file type, leave all Options checked, and hit OK.
- 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 tutorial.
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:
- Update the eye/face data (see Set Up the Eyes).
- Update the names of the model
(modelname_reference.smd)
and animation files (modelname_expressions.VTA) to the same names you exported from XSI. - 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.