Importing Models

From TargetWiki

Contents

File Formats

Tool can only import the 3D files on the list of supported 3D formats.

Creating TW2 Files

While all of those file formats can be used directly in game, it's better to first import them to the TW2 native format. This is for several reasons:

  • Faster loading.
  • Optimal rendering speed.
  • More control over animation.
  • More control over materials.

XYZ Axis alignment for models

Targetware follows the "right-hand rule". This means +Y is up, +X is right and +Z is behind you.

Now if you import your model using Tool, then for the supported formats it will take the model tools native rotation and convert it to Targetware rotation.

If you don't use Tool and just use the native 3D file, then you need to create a .model file manually. Adjust the rotation in the .model file value as follows:

  • .ac (AC3D) - no changes required: rotation = { 0, 0, 0 }
  • .dae (Collada) - ???
  • .lwo (Lightwave) - rotation = { 180, 0, 0 }
  • .3ds (3D Studio) -  ???

Hints and Tips

One thing you can do to make like easier is to follow some basic hints:

  • Always create a unique directory/folder for your conversion work. DO NOT USE YOUR MASTER FILES. You've been warned. Never get rid of your original 3D files!
  • Neither TW2 files nor Collada files can be used to regenerate your original, 3D modelling package files. Always keep the originals.
  • Set your PATH system variable so that Tool can be run from any directory. This way you never have to copy Tool around or worry about typing a long path to where Tool lives.
  • When running Tool, you can 'pipe' the results to a text file using
tool import hangar_f.ac > output.txt

This way a full report of your import will be available for you to check for errors. More useful in the bulk load as tool doesn't report like the older version.

  • AC3D files in native view within the tool will be converted to the correct TW2 rotation, so no additional work required here.

Single Model - Import

To import a single 3D model, use Tool. The command line to do so looks like this:

tool import [-t] [-d] <file to import>

So an example, without options thus no removal of files, would be:

tool import hangar_f.ac

Bulk model import - Importdir

To import a diectory of models use Tool. The command line is different:

tool importdir [-t] [-d] <directory>

An example, without options, within the same directory as the models, would be:

tool importdir .

Note: the fullstop after the import command, this is necessary to tell tool to use the directory it is running in.

To call another directory, then insert the full absolute path name after the importdir command.

Import and Importdir Options

The -t is optional. If it is used, the resulting TW2 file will include automatically generated tangents. These are only necessary if you have a shader that uses them, for example for normal maps.

The -d is optional, if used it will delete the original model file in the directory your converting. WARNING: Before using this make sure it is a working directory you are using.

Other to be documented features

  • Atlas - for making texture atlas'
  • Arcinfo - for defining terrain data
  • Noise - ?????
  • Terrain - for building terrains
  • shape - ?????

Using TW2 Files

Using Tool to import a file will result in a collection of files:

  • A .graphics file. This text file describes the part hierarchy, attaches materials to parts, describes animation, etc.
  • One or more .material files. These text files describe materials in full.
  • A .geometry file. This binary files contains vertex and index information. There's nothing to edit in them.

Both .graphics and .material files are standard TW2 configuration files.

Views