The Torque DTS Exporter for MilkShape


The Torque DTS Exporter is included in your C:\3DGPAi1\resources\tools directory and is called ms2dtsexporter.dll. Copy this file into your MilkShape directory, C:\Program Files\MilkShape 3D 1.6.6, and then restart MilkShape. The name of the MilkShape folder changes from version to version, so watch out for that. The exporter shows up under the File, Export menu.

The Torque Game Engine (DTS) Exporter Dialog Box

The Torque Game Engine (DTS) Exporter dialog box (see Figure 14.94) has three groups of options, none of which normally need to be set. Option settings are not saved, so you rarely use this dialog box for more than just a means to double-check your option values. The recommended approach is to set options using special materials.

click to expand
Figure 14.94: Torque Game Engine (DTS) Exporter dialog box.

Collision Mesh

The exporter allows you to create as many collision meshes as you want. Each collision mesh must be named "Collision"; if you have three collision meshes, they will all be named "Collision". If you do not have a collision mesh defined, you may have the exporter create one for you as either a box or a cylinder.

You can also manually select an existing mesh. Player-characters don't need a collision mesh at all.

Select the Create a visible copy of the collision mesh check box to make the mesh visible as well as collidable.

Animation Settings

The Animation Settings group displays the global values for the Animations.

  • Frames per second. This field indicates at what speed the Torque Engine should play at the animations. This field can be set using an Export Options material and applies globally to all animation sequences. This does not affect the number of keyframes; it simply sets the rate at which they will be played.

  • Export animation. If the shape is animated, but no animation sequence has been defined for it, then this field contains the name that will be assigned to it. The sequence will cover the full timeline. This feature is useful for simple models with a single animation sequence.

Other Settings

The Other Settings group contains miscellaneous settings values.

  • Global scale factor. The global scale factor is the amount by which the shape is scaled when it is exported. The default scale factor is 0.1, but this field can be changed to any value set using an Export Options material.

  • Minimum visible size (pixels). If the projected screen size of the bounding radius of the shape drops to the minimum visible size, the shape will no longer render. This is normally used to switch between different detail levels, and it's recommended that you leave this at the default value: 0.

  • Export material information. You may disable the exporting of material information (not recommended) by clearing the Export material information check box.

Special Materials

MilkShape does not directly support a number of Torque Engine features, so the tool has been extended through the use of several clever uses of existing MilkShape features, based on material and mesh names. These are described more fully in the following sections, but they basically fall into two categories: mesh flags embedded in the mesh's name and specially named materials that are used to declare animation sequences and exporter options.

Special materials are materials that are not exported as real materials but are instead used only to store information in the MilkShape file. These materials are processed by the exporter but are not written into the DTS file.

Export Options

Materials with special names can be used to set several export options. These materials are ignored during export and are solely used to set options.

Option materials are named as follows:

 opt: option, option, ... 

All other properties of the material are ignored. Table 14.4 lists the available options.

Table 14.4: Export Options

Option

Description

scale=n

The global shape scale factor, where n is a floating point value. The default scale value is 0.1.

size=n

The global minimum visible pixel size. The default is 0.

fps=n

The global default frames per second value for animations. Each animation sequence may set this value, but if it's not defined by the sequence, this default value is used.

cyclic

The global default animation looping flag. Each animation sequence may set this value, but if it's not defined by the sequence, this default value is used.

There may be more than one option material. If the same options are set on multiple materials, then the last one in the material list is the value used. Here are a couple examples of valid material names:

 opt: fps=10, cyclic opt: scale=0.1 

Material Option Flags

Material attributes can be set using the MilkShape Shininess and Translucency sliders as well as by embedding additional flags in the material name.

Environment mapping can be controlled for the model by use of the Shininess slider—it's the one on the left-hand side. Setting the slider to any value but 0 will enable environment mapping for the texture. Note that the texture you are using must have an alpha channel, which will be used to control the per-pixel shininess of the texture. Any value of the slider other than 1.0 or 0.0 will be ignored.

You can enable translucency by setting the MilkShape Translucency slider—this is the slider on the right-hand side. Setting the slider to any value other than 1.0, which is to the far right, will enable translucency for the texture. The texture you are using must have an alpha channel, which will be used by the Torque Engine to control the per-pixel translucency of the texture. Any value of the slider other than 1.0 or 0.0 will be ignored.

Options that are embedded in the material name follow this format:

 name: flag, flag, ... 

where the : and flags are optional. Table 14.5 shows which flags are available.

Table 14.5: Material Option Flags

Flag

Description

Add

Enables additive transparency.

Sub

Enables subtractive transparency.

Illum

Enables self-illumination (lighting doesn't affect it).

NoMip

Disables mipmapping.

MipZero

Sets the "MipMapZeroBorder" flag.

A self-illuminating additive material could be called as follows:

 Flare: Add, Illum 

Mesh Option Flags

Meshes can have additional flags embedded in the mesh (or group) name. The mesh name follows this format:

 name: flag, flag, ... 

where the : and flags are optional. Table 14.6 shows which flags are available.

Table 14.6: Mesh Option Flags

Flag

Description

Billboard

The mesh always faces the viewer.

BillboardZ

The mesh faces the viewer but is only rotated around the mesh's Z-axis.

ENormals

This flag encodes vertex normals. It is deprecated and should not be used unless you know what you're doing.

Here are some legal mesh or group names:

  • leaf

  • leaf: Billboard

  • leaf: BillboardZ

By default, meshes do not have any flags set.

Animation Sequences

MilkShape only provides a single animation timeline, but the Torque Engine supports multiple animation sequences, each of which can be named and have different properties. Multiple sequences in MilkShape are animated on the main timeline and are split into separate sequences by the exporter. For this to happen animation sequences must be declared, indicating where each sequence starts and ends on the master timeline. This is done through materials with special names. These materials are ignored during export and are solely used to declare animation sequences. The section on Special Materials above provides more details.

Sequence materials are named as follows:

 "seq: option, option, ..." 

All other properties of the material are ignored. Table 14.7 describes the Sequence Material Options.

Table 14.7: Sequence Material Options

Option

Description

name=start-end

This declares the name of the sequence followed by the starting and ending keyframes. This option must exist for the sequence declaration to be valid.

fps=n

This is the number of frames per second. This value affects the duration and playback speed of the sequence.

cyclic

Sequences are noncyclic by default. Cyclic animations automatically loop back to the start and never end.

Here are some valid sequence declarations:

 seq: fire=1-4 seq: rotate=5-8, cyclic, fps=2 seq: reload=9-12, fps=5 




3D Game Programming All in One
3D Game Programming All in One (Course Technology PTR Game Development Series)
ISBN: 159200136X
EAN: 2147483647
Year: 2006
Pages: 197

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net