MAX2SKL Reference Guide

Overview

Max2skl is a command line utility for converting .SKL files into a form usable by the Tiki model system. .SKL files are text-based model files exported from 3DS Max using SkelOut. Having the functionality of Max2skl as a separate program from the exporter allows changes in model format without requiring the artists to re-export their models.

Max2skl will check the file times of the source and destination file and only rebuild them if they differ. This reduces runtime when running Max2skl from a batch file that converts a lot of animations when only a few have changed.

File formats

Each .SKL file contains a list of material identifiers, a list of bones in the model, triangle and vertex assignments, and any number of frames of animation. Being text-based allows .SKL files to be viewed or edited in a text editor, making diagnosing problems in models more convenient.

Max2skl exports two types of files: .SKA and .SKB. SKB files contain the definitions of the bone heirarchy, vertex weights, surfaces, triangles, and level of detail (LOD). SKA files contain only the bone animation info.

SKB Files

SKB files are created from the model’s baseframe. Each model only needs one SKB file. The baseframe is the .SKL file that has the model posed in such a way as to create the best LOD information possible. The order that triangles are removed as the model is lowered in detail is based upon the length of the edges and the orientation of neighboring triangles. Triangles with very short edges or whose orientation differs the least from triangles that share the same edge are chosen first. Edges that are seams (either the triangle has a different texture from its neighbor, or doesn’t have a neighbor) can not be removed, and so limit how low detail the model can go.

In order to create the best LOD information, models should be posed such that important joints are bent so that triangles at those joints reduce detail last. For example, if a model’s arms are kept straight in the baseframe, then when the model reduces in detail the upper arm and forearm will appear to have webbing between them, like a bat. Bending the arms in the baseframe will help Max2skl choose more appropriate triangles when lowering detail.

Since the SKB file also contains the definition of the bone heirarchy, if the order of the bones are changed, or the bones are renamed, then the SKB file should be recreated to reflect the changes. Also, while changing the bone names is harmless, if the bone order changes in the SKB file, you should rebuild the SKA files to make sure the bone order is the same in them.

The names and triangles contained in each surface are stored in the SKB file. When surface names or IDs change in the SKL file, you should rerun Max2skl to recreate the baseframe to reflect the change.

The Tiki model system allows separate animations to play on the torso and legs of the model. To do mark bones in the model as “leg bones” (that is, bones that will use the leg animations as opposed to the torso animation). this, you must edit the baseframe’s SKL file and change the bone definitions from “Bone” to “Legbone”. Here’s an example of a changed SKL file:

Bones that should be marked as leg bones are not always grouped together; it depends upon the hierarchy. Usually any bone that is below the spine is a good start. Check the model in the game and see if the animation looks right when another animation is playing in the torso.

SKA Files

SKA files contain only animation information. You should have at least one SKA for each animation in the model. SKAs contain bone animation information and movement deltas for each frame.

Movement deltas are created by measuring the movement of the specified origin bone. By default, the bone named “origin” is expected, but you can use the –origin parameter to specify a different bone. No matter where the origin bone is in any frame of the original animation, it will be moved to (0, 0, 0) in the model’s coordinate space, with all other bones still in the same relative position around it. When the model is animated in the game, it will simply sit in place if the game physics doesn’t apply the movement deltas to the position. Using this method we are able to remove any sliding of the character’s feet on the ground.

Tags

Tags are special triangles placed in the model to indicate attachment points on the model. These work the same way as they did in the vertex animation format that Tiki uses (.TAN) and you should refer to the Tiki document for an explanation of them. The difference between tags in vertex animated models and tags in skeleton animated models is that tags are turned into bones in skeleton models. In the case where there is already a bone with the same name as the tag, the tag will override the bone. Another consequence of this is that all bones are available as tags in the game, so extra tags only need to be added if a bone doesn’t exist in the appropriate location.

Command line options

max2skl animname [-uv filename] [-force] [-scale num] [-dest name]
[-ignore filename] [-origin originname] [-reverse]
[-verbose] [-nolod] [-noclampz] [-zeroz] [-noorigin]
[-clearz] [-clearxy] [-baseframe] [-maxbones num]
[-weightthreshold num] [-md4] [-bones filename]
[-offset x y z] [-clearx] [-cleary] [-loop]
[-zerox] [-zeroy] [-uvb filename] [-destdir dirname]
[-ignoreflags]

The parameters are as follows:

  • animname
    This is the name of a SKL file created by SKELOUT.

  • -uv filename
    This specifies a SKL file to copy the texture coordinates, material names and surface IDs from. This is useful for when you have model exported before you’ve textured it.

  • -force
    Causes MAX2SKL to re-process the animation regardless of what the time and date of the destination file is.

  • -scale num
    Specify a scale to be used when converting the file. The default scale is 1.

  • -dest filename
    Specify an alternate destination name for the SKA for SKB file. Normally the destination file shares the same name as the animname but with a SKA or SKB extension. Note that the directory remains the same.

  • -ignore filename
    Specify an external file which contains a list of surfaces to ignore when grabbing this model. This is used extensively when grabbing a multi-part model.

  • -origin originname
    Specify an alternate surface name for the origin. Normally, the origin surface is simply called “origin”, this allows one to choose an alternate surface name for the origin. This is used extensively when grabbing a multi-part model.

  • -reverse
    Reverse the order of frames of the animation.

  • -verbose
    Output a lot of information while processing the model.

  • -nolod
    Do not create an LOD mapping for this model.

  • -noclampz
    By default, the Z component of the origin tag is clamped to only positive and zero values. If you would like to allow negative Z values, use this option.

  • -zeroz
    Always set the Z component of the origin tag to zero.

  • -noorigin
    Don’t subtract the origin’s position from the model’s position. No movement deltas are produced.

  • -clearz
    Specifies that Z movement is cleared out on deltas.

  • -clearxy
    Specifies that X and Y movement is cleared out on deltas.

  • -baseframe
    Save the model as SKB. The SKB file contains the bone definitions, the surfaces, texture coordinates, triangles, and the LOD mapping.

  • -maxbones num
    Limit the number of bones that can affect a vertex to num per vertex. The num most influential bones will be used. The default (and maximum) is 8.

  • -weightthreshold weight
    Limit the minimum influence a bone must have to be included in a vertex. Any with less influence will not affect the vertex. The default value is 0.01.

  • -md4
    Save the model as an MD4 file. MD4 files are Quake 3 skeleton models. This was implemented for Quake 3, but was never used.

  • -bones filename
    Use the bone heirarchy from the specified file. This is used when the hierarchy changes somehow, usually due to bones being unlinked from the hierarchy in Max for animation reasons. Since MAX2SKL doesn’t know anything about animations other than the one it’s currently working on, it can’t guarantee that the names of the bones, or the order of the bones, hasn’t changed from one animation to the next. If you always specify this and use the baseframe as the source, you will be assured that the animations always have the same number of bones and the same heirarchy.

  • -offset x y z
    Offsets the model by the specified amount. This is useful for when animations are animated at different heights or using different origin tags.

  • -clearx
    Specifies that X movement is cleared out on deltas.

  • -cleary
    Specifies that Y movement is cleared out on deltas.

  • -loop
    Drops the last frame of the animation. This allows MAX2SKL to properly calculate deltas on looped animations. The last frame in the animation should be the pose as the first frame.

  • -clearx
    Specifies that X movement is cleared out on deltas.

  • -cleary
    Specifies that Y movement is cleared out on deltas.

  • -loop
    Drops the last frame of the animation. This allows MAX2SKL to properly calculate deltas on looped animations. The last frame in the animation should be the pose as the first frame.

  • -uvb filename
    The same as using –bones and –uv. This is just an easy way to copy both the bone heirarchy and the surface definitions from one file.

  • -destdir dirname
    Specify an alternate destination directory for the SKA for SKB file. Normally the destination directory is the current working directory.

  • -ignoreflags
    Normally, when a bone’s parent is unused and no bone with the same leg/torso designation exists higher up the hierarchy, the parent is kept, despite the fact that it doesn’t affect any vertices. Ignoreflags instructs Max2Skl to not perform this check. Typically, this would be used when it isn’t feasible to use the –bones command because the hierarchies differs.