Last modified 9 months ago Last modified on 08/23/11 20:34:31

Warzone 2100 new advanced 3d format specification proposal

This format will support advanced features such as tangent space normal mapping and various forms of animation.

Textures & Shading

This section will specify used textures as well as some shading options and other flags.

  • Animated (boolean) specifies whether the texture will be animated
  • Normalmap (flag) 0 = disabled, 1 = tangent space, 2 = object space
  • Specmap (boolean) specifies whether the alpha channel of the normalmap is used as spec map. (if normalmap = 0 it will still load the image but not use the normalmap)
  • TCmask (boolean) specifies whether a tcmask texture will be loaded and used
  • Name (string) if animated is enabled, a folder with this name will be used. Otherwise it will look for name_diff.png, as well as name_nor.png and name_tc.png if they are enabled

In certain cases it might be practical to use different normalmaps/tcmasks with the same diffuse texture. If it turns out we need this flexibility, additional filenames for normalmaps/tcmasks can be specified.

The folder for animated textures will contain textures named diff_XXX.png, nor_XXX.png and tc_XXX.png etc where XXX is the frame number. If a frame is unavailable, the previous one will be used.

Geometry

Geometry data will be presented as shapes, out of which shape 0 is the original mesh. Every shape will have the same vertices and faces, only the properties (position, normal, UV-coordinates etc.) will be changed. If a mesh has no animations or deformations, only shape 0 will be present.

Shape 0 will have the following data:

List of vertices with the following properties:

  • index (integer)
  • position (3x float)
  • normal (3x float)
  • tangent (3x float)
  • bitangent (3x float)

List of faces with the following properties:

  • index (integer)
  • vertices (3x integer) only triangles allowed
  • UV:s (3x float-pair) floats should be in 0-1 range. If a float is outside the range, the texture will be tiled.

Further shapes will have the same data but only need to list faces/vetrices that are affected. If only UV:s are altered, no vertices need to be lited and likewise if UV:s aren't changed, only vertices need to be listed. This structure theoretically allows animating the vertex indices of the faces, although that has very few, if any, practical applications and doesn't need to be supported by warzone.

Bones

Every bone will have the following properties:

  • Index (integer)
  • Parent bone (integer) if index is -1, the bone has no parent.
  • Hinge (boolean) whether or not the bone will inherit rotation from its parent bone.
  • position (3x float)
  • List of vertices affected

Animation

The format is intended to support shape key, simple bone and texture frame (image sequence) animation. Animations may be split into separate files or simply included with the model. Every animation will have the following data:

  • Index (integer) since there will probably be multiple animations
  • Animation length in milliseconds
  • List of animated properties and whether or not they will be interpolated between points. Properties are shapes, bones and animated textures.
    • Property number (integer)
    • Type (bone / shape / texture)
    • Index (integer)
    • Interpolation (boolean)
  • List of points with the following data:
    • Property number (integer)
    • Time (milliseconds)
    • Value (float / int depending on type)

Shapes are animated using weights. The final shape is calculated by subtracting shape 0 from the shape, multiplying it the weight and adding back shape 0

i.e. Final shape = shape 0 + sum( weight * (shape n - shape 0)) (where n goes from 1 to the last index) The calculations are done separately on the properties of all listed veritces and faces. Vectors interpolated this way will of course no longer be of unit length and need to be normalized