Call of Duty: XMODEL formats

From COD Modding & Mapping Wiki
Share/Save/Bookmark
Jump to: navigation, search

Intermediate (*.XMODEL_EXPORT)

Version 6

Header

// Export filename: 'C:/Program Files/Activision/Call of Duty 4 - Modern Warfare/model_export/base_character/base_character.XMODEL_EXPORT'
// Source filename: 'C:/Program Files/Activision/Call of Duty 4 - Modern Warfare/bin/maya/rigs/character/COD_DefMesh.mb'
// Export time: Mon Jan 07 15:55:16 2008
MODEL
VERSION 6
  • // Comments (optional)
  • MODEL data type definition (magic word)
  • VERSION format version number


Bone hierarchy table

Visual bone hierarchy tree (section)
NUMBONES 126
BONE 0 -1 "TAG_ORIGIN"
BONE 1 0 "J_MainRoot"
BONE 2 0 "TAG_SYNC"
BONE 3 1 "J_CoatFront_LE"
BONE 4 1 "J_CoatFront_RI"
BONE 5 1 "J_CoatRear_LE"
BONE 6 1 "J_CoatRear_RI"
BONE 7 1 "J_Hip_LE"
BONE 8 1 "J_Hip_RI"
BONE 9 1 "J_SpineLower"
BONE 10 1 "TAG_STOWED_HIP_REAR"
BONE 11 7 "J_HipTwist_LE"
BONE 12 8 "J_HipTwist_RI"
BONE 13 7 "J_Knee_LE"
...
  • NUMBONES number of bones
    Note: Numerations starts with zero, e.g. BONE 0 + BONE 1 + BONE 2 = NUMBONES 3
    ---
  • BONE description:
    • Bone number
    • Parent number (-1 = root origin, a model can only have one!)
    • "name string" (has to be unique per model)


Bone orientations

Local bone axis, corresponding to vectors of the bone's rotation matrix
BONE 0
OFFSET 0.000002, -2.222280, 0.000042
SCALE 1.000000, 1.000000, 1.000000
X 0.000000, -1.000000, -0.000001
Y 1.000000, 0.000000, 0.000000
Z -0.000000, -0.000001, 1.000000

BONE 1
OFFSET 4.866636, 1.218493, 37.227966
SCALE 1.000000, 1.000000, 1.000000
X -0.008941, 0.033732, -0.999391
Y -0.004868, -0.999420, -0.033689
Z -0.999948, 0.004564, 0.009100
...
  • BONE number (as declared in the hierarchy table)
  • OFFSET translations / position in the 3d space, like a coordinate (3x float)
  • SCALE bone scale, appears to be always 1.000000 (3x float)
  • X part of rotation matrix, basically the local x-axis of the bone (3x float)
  • Y part of rotation matrix, basically the local y-axis of the bone = bone direction (3x float)
  • Z part of rotation matrix, basically the local z-axis of the bone (3x float)


Vertices

NUMVERTS 93
VERT 0
OFFSET -17.273228, -12.413740, 43.184647
BONES 2
BONE 88 0.020674
BONE 103 0.979326

VERT 1
OFFSET -16.432205, -12.622912, 43.149212
BONES 3
BONE 103 0.657893
BONE 115 0.232664
BONE 125 0.109443

VERT 2
OFFSET -16.693701, -12.187638, 43.322441
BONES 1
BONE 103 1.000000
...
  • NUMVERTS number of vertices in model
    ---
  • VERT number
  • OFFSET coordinate (3x float)
  • BONES number of bones influencing this vertex
  • BONE bone number as declared in the hierarchy table, normalized influence (float, between 0.000001 and 1.000000, all listed influences sum up to ~1.0)
    The influences are controlled via weight painting in the 3d modelling application.


Faces

Triangulated Cube. Face normals shown in light blue, vertex normals in dark blue. Selected triangle in orange

Faces are flat surfaces described by vertices. Call of Duty doesn't support quads or polygons with 5+ vertices. Each face is made up of 3 vertices. Thus, a face is always a triangle. A triangle definition is started with a TRI line, followed by 3 blocks of VERT, NORMAL, COLOR and UV to set up all triangle properties.

NUMFACES 6292
TRI 0 0 0 0
VERT 4
NORMAL -0.773691 0.437762 -0.458003
COLOR 0.679886 0.686872 0.684380 1.000000
UV 1 0.863103 0.886260 
VERT 5
NORMAL 0.194225 0.477258 -0.857030
COLOR 0.455880 0.463456 0.460754 1.000000
UV 1 0.863439 0.887645 
VERT 0
NORMAL -0.738602 0.340904 -0.581594
COLOR 0.696122 0.701748 0.699741 1.000000
UV 1 0.865185 0.885729
TRI 4 1 0 0
VERT 779
NORMAL -0.874954 -0.363632 0.319730
COLOR 1.149123 1.155146 1.152998 1.000000
UV 1 0.454800 0.496727 
VERT 769
NORMAL -0.707711 -0.706459 0.007776
COLOR 1.233310 1.238597 1.236711 1.000000
UV 1 0.484654 0.505479 
VERT 778
NORMAL -0.886900 -0.450325 -0.103034
COLOR 1.172201 1.178101 1.175997 1.000000
UV 1 0.455714 0.506690
...
  • NUMFACES number of faces in model
    ---
  • TRI description:
    • Number of the object, the triangle belongs to
    • Material number,
    • 0 0 (static numbers)
  • VERT vertex number
  • NORMAL Vertex normal vector, normalized (3x float, apparently not doing anything; face orientation is rather controlled by the order of the 3 vertices)
  • COLOR Vertex color (4x float, RGBA?)
  • UV description:
    • 1 (static number)
    • UV texture coords (2x float)


Objects

This data block seems to have no effect on an xmodel file.

NUMOBJECTS 15
OBJECT 0 "_handRIShape"
OBJECT 1 "_handLEShape"
OBJECT 2 "polySurfaceShape3796"
OBJECT 3 "polySurfaceShape3797"
OBJECT 4 "_headShape"
...
  • NUMOBJECTS number of objects in xmodel_export file
    ---
  • OBJECT description:
    • Object number
    • "name string"


Materials

NUMMATERIALS 3
MATERIAL 0 "mtl_desert_marines" "Lambert" "marines_col_desert.tga"
COLOR 0.000000 0.000000 0.000000 1.000000
TRANSPARENCY 0.000000 0.000000 0.000000 1.000000
AMBIENTCOLOR 0.000000 0.000000 0.000000 1.000000
INCANDESCENCE 0.000000 0.000000 0.000000 1.000000
COEFFS 0.800000 0.000000
GLOW 0.000000 0
REFRACTIVE 6 1.000000
SPECULARCOLOR -1.000000 -1.000000 -1.000000 1.000000
REFLECTIVECOLOR -1.000000 -1.000000 -1.000000 1.000000
REFLECTIVE -1 -1.000000
BLINN -1.000000 -1.000000
PHONG -1.000000
...
  • NUMMATERIALS number of materials
    ---
  • MATERIAL description:
    • Material number
    • Material name
    • Type (taken from 3d application, has no effect on xmodel)
    • "texture file name"

Note: None of the following material data is useful, it will be ignored by the xmodel converter

  • COLOR material RGBA color (4x float)
  • TRANSPARENCY transparency RGBA color (4x float)
  • AMBIENTCOLOR ambient RGBA color (4x float)
  • INCANDESCENCE incandescence RGBA color (4x float)
  • COEFFS coefficients (2x float)
  • GLOW glow (float, int)
  • REFRACTIVE refraction (int, float)
  • SPECULARCOLOR specular RGBA color (4x float)
  • REFLECTIVECOLOR reflection RGBA color (4x float)
  • REFLECTIVE reflection (int, float)
  • BLINN blinn (2x float)
  • PHONG phong (float)


Version 5 (CoD1)

Only differences compared to version 6 are listed.

Header

// Source filename: 'C:\trees\model_source\character_models\character_lod\airborne_Low.max'
// Export time: Fri Aug 01 15:44:31 2003
MODEL
VERSION 5
  • // Comments (optional)
  • MODEL data type definition (magic word)
  • VERSION format version number

Bone orientations

Same as Version 6, but without commas:

BONE 0
OFFSET 0.000002 -2.222280 0.000042
SCALE 1.000000 1.000000 1.000000
X 0.000000 -1.000000 -0.000001
Y 1.000000 0.000000 0.000000
Z -0.000000 -0.000001 1.000000
...


Vertices

Same as Version 6, but without commas:

NUMVERTS 93
VERT 0
OFFSET -17.273228 -12.413740 43.184647
BONES 2
BONE 88 0.020674
BONE 103 0.979326
...


Faces

NUMFACES 172
TRI 0 0 0 1
VERT 10 0.873177 0.502103 0.514332 0.849479 0.117676
VERT 3 0.875169 0.254302 0.964290 0.262399 -0.035947
VERT 65 0.910332 0.493356 0.583699 0.238673 -0.776100
TRI 0 0 0 1
VERT 6 0.399969 0.721943 0.699542 -0.713791 -0.033821
VERT 3 0.470804 0.723883 0.964290 0.262399 -0.035947
VERT 2 0.503285 0.902194 0.830325 0.552277 0.074499
TRI 0 0 0 1
VERT 2 0.503285 0.902194 0.830325 0.552277 0.074499
VERT 1 0.435323 0.925295 0.690132 -0.722368 -0.043609
VERT 6 0.399969 0.721943 0.699542 -0.713791 -0.033821
...
  • NUMFACES number of faces in model (face = triangle, quads are not supported!)
    ---
  • TRI description:
    • Number of the object, the triangle belongs to
    • Material number,
    • unknown number
    • 1 (static number? It's rarely 0)
  • VERT description:
    • Vertex number
    • UV texture coords (2x float)
    • Face normal vector, normalized (3x float)

Materials

NUMMATERIALS 7
MATERIAL 0 "[email protected]_chest.tga"
MATERIAL 1 "[email protected]_upperarm.tga"
MATERIAL 2 "[email protected]_forearm.tga"
MATERIAL 3 "[email protected]_upperleg.tga"
MATERIAL 4 "[email protected]_lowerleg.tga"
MATERIAL 5 "[email protected]"
MATERIAL 6 "[email protected]_boots.tga"
...
  • NUMMATERIALS number of materials
    ---
  • MATERIAL description:
    • Material number
    • "texture file name"