Things Named Veazie Places Named Veazie People Named Veazie The Site for All Things Veazie!

Using SMD2X (Static Models)

SMD2X.exe is an application for importing SMD model files, SMD animation files and DirectX X-files (both static and animation), and for exporting static and animation Direct X X-files.

Not all DirectX X-file templates are supported. This isn't a general use conversion utility. It was developed expressly for:

Importing SMD format model files (as exported from SoftImage XSI v4.2 Mod Tool
Importing SMD format skeletal animation files (as exported from XSI)
Importing DirectX X-file format files, both with and without animation sets
Combining loaded animation sets with reference (model) information
Exporting DirectX X-files, both static and with animation sets, compatible for loading into DirectX-based applications using the D3DX function D3DXLoadMeshHierarchyFromX.

 

If you're still interested, see What You'll Need to use SMD2X.

To get started using SMD2X, you'll need, at a minimum, an SMD model file. You can generate one yourself using the XSI Mod Tool, or you can use the SMD files included in the SMD2X download. A later article will describe generating animations in XSI Mod Tool and exporting the appropriate SMD animation file.

Introduction

SMD2X was developed to satisfy a need for creating DirectX animated character models to be used in DirectX applications developed with Microsoft C++ .NET 7 and the DirectX 9.0 SDK. It is likely that SMD2X will prove useful for other DirectX application developers who have a need to generate X-file format static and animated models.

To use SMD2X, an understanding of the underlying structure of the program may be useful.

It's not nearly as complicated as it looks. Starting at the bottom, two types of X-files can be exported: a static model file and an animation file. A "static" model file can be loaded by a DirectX application as a non-animated mesh. An animated X-File can be loaded by a DirectX application as an animated skinned mesh. Both the static and the animated X-File formats must contain a mesh.

The static X-file is generated from a Primary Reference, which is a structure of frames (bones) and a mesh, each vertex "weighted" by one or more of the bones. The animation X-File is generated from a Primary Reference and one or more animation sets. An "animation set" is a set animations, one for each bone, prescribing the bone's movement over time. Because each mesh vertex is influenced by one or more bones, as the bones move during animation, the mesh vertices are moved, deforming the mesh. For example: a character mesh may have vertices in the left arm which are weighted to the bones in the arm. As the bones in the arm are moved during animation, the mesh vertices are moved and it appears that the model's arm moves.

At the top are the three types of files that SMD2X can import.

An SMD Model (or reference) file contains a hierarchy of bones, a mesh (a set of vertices, normals and texture coordinates), and a table describing the influence that each bone has on vertices in the mesh. After an SMD model file is imported, it can be set as the Primary Reference.

An SMD Animation file contains a hierachy of bones and a set of timed animation keys for each bone, called an "animation set." It does not contain any mesh information (vertices, normals or texture coordinates, nor does it contain any bone weight information (how much each bone influences a vertex' position). After an SMD Animation file has been imported, it can be set as the Primary Animation set, or added to the Primary Animation Sets.

An X format file may contain both model information and one or more animation sets. After an X format file has been imported, the model information can be set as the Primary Reference and the X-file animation set(s), if any, can be set as the Primary Animation Sets, or the X-file animation set(s) can be added to the Primary Animation Sets.

When you open SMD2X ( version 4 - SMD2X_4 ), the status of the application is shown. The Primary Reference has not been set and no animation sets have been added to the Primary Animation Sets.

Neither an SMD model Reference file or an SMD Animation Set has been loaded.

No X File has been loaded.

The SMD Files menu has two choices:

- Load an SMD Reference (model) file

- Load an SMD Animation file

Click on Load SMD Reference File and, in the resources directory that comes with the SMD2X download, select ss_woman_basic.smd and click OK.

As the reference file is loaded, the status of the loading process is displayed. This status may appear only momentarily, depending on the speed of your machine.

By far, reading the mesh takes the most time. If the application appears stalled during this phase, be patient. It may take several seconds.

Checking SMD file header..
An SMD file is a plain text file and the header is simply the line "version 1." If you wish, you can open ss_woman_basic.smd in any text editor and examine the sections as described below.
Loading nodes..
The "nodes" section of the SMD file is read in and stored. This is an array of frame names along with node identification numbers and the identification number of each node's parent node
Setting up relationships..

A structure is set up which describes each frame's parent frame, any child frames for which it may be the parent, and sibling frames - other frames which have the same parent.

During this phase, a default Scene_Root frame with a transformation identity matrix is created which is the parent frame for all frames in the file.

Reading the skeleton structure..

The "skeleton" section of the SMD file contains the position and rotation of each bone frame with respect to its parent frame. This is the local transformation matrix DirectX programmers may be familiar with.

During this phase of loading, the base skeleton node, the node which is parent to all other bones, is identified and a rotation of -PI/4 about the X axis applied. This provides compatibility between the SMD format (used in the Half-Life® and the Half-Life 2® games) and DirectX axes.

Fixing names..

As exported from XSI Mod Tool, the names of many bones in the ValveBiped structure contain a period (.), denoting its relationship to the rest of the bone structure. A period (.) in any name is replaced with an underscore (_).

An X-file exported with names containing periods may not result in the proper bone structure in DirectX. Instead, in the X-File format, the relationship between a frame and its children is determined by imbedding the children between the parent's open '{' and close '}' brackets.

Reading the mesh..

The "triangles" section of the SMD file contains vertex positions, normals, texture coordinates and a list of bone identification numbers and the weight on that vertex associated with each bone.

These are the "bone weights" or "skin weights" DirectX programmers may be familiar with.

After the reference file has been loaded, the status is updated, showing that the SMD Reference is available.

The Primary menu now has one item enabled - setting the Primary Nodes to the SMD reference.

This corresponds to the red arrow in the application structure pictured above this table.

Click on Set Primary Nodes to SMD reference.

As shown, the Primary Reference has been copied from the SMD Reference.

The Save status reflects that no X-file exports have been made.

As indicated in the Primary menu, now that the Primary Reference has been set, a non-animated (static) X-file can be exported.

In the application structure above this table, that is indicated by the purple arrow pointing from Primary Reference to X-File (static model).

  Click on Export Non-Animated X File, select a filename (such as woman_basic.x or similar) in the FileSave dialog box and click OK.
The status now reflects that you have exported the current Primaries to the filename you chose.

Open your favorite mesh viewer and load the x-file you just exported.

IF THE MODEL APPEARS SOLID GRAY, instead of textured:

- Ensure you set the texture in XSI to a DirectX compatible format. The default in XSI is a GIF texture and will not load properly.

- Ensure that the texture file you used in texturing the model in XSI is in the same folder with the X-file you exported.

 


updated 24-Apr-2008