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.
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 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 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 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]
The parameters are as follows: