LGW Animation and skinning

NOTE: The reader should understand the concept of skeletal animation.

NOTE 2: All the matrices are in OpenGL format.

Overall file structure

The structure of an animated model is basicaly same as of nonanimated model with some additions and one change.

MODEL "noname"
  EXPORT_VERSION 4
  SOURCE_FILE "Q:\Graphics\kreace\Finder\mutant\larva\!larva-export-skin-ref.max"
  MATERIAL_LIST
    MATERIAL 0 "3 - Default"
      ...                         
//Material descriptor (see standard model)
    END_OF_MATERIAL
    MATERIAL 1 "veins"
      ...
    END_OF_MATERIAL
    ...
  END_OF_MATERIAL_LIST
  MESH "veins
    LINKINFO
      ...                         
//Linkinfo block
    END_OF_LINKINFO
    MATERIAL_REF 1
    DEFAULT_COLOR 0.0235 0.5255 0.2275
    WVERTS 16
    -12.225889 -26.951185 91.145966 0.613739 0.361441 -0.971233 0.031175 0.236082 1 1.000000 "Larva-bone4"
    -12.225889 -26.951185 91.145966 0.613739 0.361441 0.971233 -0.031175 -0.236082 1 1.000000 "Larva-bone4"
    -3.732286 25.132370 78.187614 0.349508 0.316180 -0.984783 0.169803 0.037011 1 1.000000 "Larva-bone4"
    -3.732286 25.132370 78.187614 0.349508 0.316180 0.984783 -0.169803 -0.037011 1 1.000000 "Larva-bone4"
    -2.632672 -32.064461 101.436836 0.633740 0.405749 -0.970294 -0.090893 0.224208 1 1.000000 "Larva-bone4"
    -2.632672 -32.064461 101.436836 0.633740 0.405749 0.970294 0.090893 -0.224208 1 1.000000 "Larva-bone4"
    -2.478609 42.939400 133.548996 0.281280 0.553241 -0.977065 -0.037840 0.209550 2 0.500000 "Larva-bone4" 0.500000 "Larva-bone5"
    -2.478609 42.939400 133.548996 0.281280 0.553241 0.977065 0.037840 -0.209550 2 0.500000 "Larva-bone4" 0.500000 "Larva-bone5"
    -0.258639 -25.026554 239.609406 0.571765 0.999205 -1.000000 0.000000 -0.000003 1 1.000000 "Larva-bone6"
    -0.258639 -25.026554 239.609406 0.571765 0.999205 1.000000 -0.000000 0.000003 1 1.000000 "Larva-bone6"
    ...
    PRIMITIVE_GEOMETRY_GROUPS 1
    GROUP 0 TYPE_LIST
      COUNT 36
      2 14 0 3 1 15 4 6 0 4 10 12 5 1 7 5 13 11 6 2 0 6 4 12
      7 1 3 7 13 5 10 8 12 11 13 9
      ...
    END_OF_GROUP 0
  END_OF_MESH "cievy"
  MESH "veins2"
    ...
  END_OF_MESH "veins2"
  ...
  HELPER "point-atack"
    ...                         
//Helper declaration
  END_OF_HELPER "point-atack"
  HELPER "point-head"
    ...
  END_OF_HELPER "point-head"
  ...
END_OF_MODEL

The key WVERTS replaces the key VERTS from nonanimated models and the definition of a vertex is extended with bindings to bones. Example:

-2.478609 42.939400 133.548996 0.281280 0.553241 -0.977065 -0.037840 0.209550 2 0.500000 "Larva-bone4" 0.500000 "Larva-bone5"

As in nonanimated model the first eight floats are position, texture coords and normal. Then follows integer indicating number of bones to which is the vertex bound. After it follows pairs of float and string, where the float is weight for the bone specified by the string. All weights must be in range from 0.0 to 1.0 and sum of the weights for one vertex must be 1.0 and one vertex must be bound to at most four bones.

Linkinfo block

LINKINFO
  LINK_TYPE SKIN
  BONES 11
    BONE "Larva-main-bone"
      PIVOT
      0.7300 0.0000 0.0000 0.7572 0.0000 0.7300 0.0000 21.6918 0.0000 0.0000 0.7300 17.0244 0.0000 0.0000 0.0000 1.0000
    END_OF_BONE
    BONE "Larva-bone1"
      ...
    END_OF_BONE
    BONE "Larva-bone2"
      ...
    END_OF_BONE
    ...
  END_OF_BONES
END_OF_LINKINFO

The content of the LINKINFO block depends on the LINK_TYPE key. The LINK_TYPE can be SKIN or NORMAL.

When the LINK_TYPE is SKIN the LINKINFO block consist of bones definitions. First is key BONES followed by integer which indicates number of bones. Then follows the actual bones. Each bone starts with the BONE key and ends with the END_OF_BONE key. After the BONE key is the string which is the name of the bone. Next is the PIVOT key followed by sixteen floats which makes 4x4 matrix. This matrix represents the positon and orientation of the bone.

When the link type is NORMAL there is only one block which is enclosed in the PARENT and END_OF_PARENT keys. After the PARENT key there is a string with the name of the bone. It is followed by the PIVOT key with sixteen floats forming a 4x4 matrix. Example:

LINKINFO
  LINK_TYPE NORMAL
  PARENT "Larva-bone6"
    PIVOT
    0.0000 -0.0000 0.5573 -61.9757 0.7300 0.0000 -0.0000 -68.0254 -0.0000 0.7300 0.0000 208.8695 0.0000 0.0000 0.0000 1.0000
  END_OF_PARENT
END_OF_LINKINFO

Helper declaration

HELPER "point-atack"
  TYPE POINT
  LINKINFO
    LINK_TYPE NORMAL
    PARENT "Larva-kost6"
      PIVOT
      0.0000 -0.0000 0.5573 -61.9757 0.7300 0.0000 -0.0000 -68.0254 -0.0000 0.7300 0.0000 208.8695 0.0000 0.0000 0.0000 1.0000
    END_OF_PARENT
  END_OF_LINKINFO
  PIVOT
  1.0000 -0.0000 0.0000 -0.6177 0.0000 0.0000 -1.0000 -90.8538 -0.0000 1.0000 0.0000 180.6291 0.0000 0.0000 0.0000 1.0000
END_OF_HELPER "point-atack"
HELPER "hit-03"
  ...
END_OF_HELPER "hit-03"
HELPER "point-head"
   ...
END_OF_HELPER "point-head"
...

A helper is basicaly a point and direction.

The TYPE is always POINT. The LINKINFO section specifies the parent of the helper. PIVOT specifies the absolute matrix of the helper.


Prev: Specification of 3D format Next: Specification of Particles Up: Home