Texel
OpenGL | Index | Contact

.an8 file format from Anim8or
Object Mode
Meshes only

Version française ici


Note: This article has been written a long time ago, when the .an8 file format specification were not avaialble. This specs are now avaialable on the officiel Anim8or web site but incomplet. Maybe, thi article will allow you to understand some bases of how the file format works. You can also try LibAn8, my open source Anim8or file loader..

Download LibAN8

Anim8or is an easy to use 3D modelling program. Try it before going head. (Official web site of Anim8or)
These specs are not complet. But they could allow you to save sevral hours of your time. I advice you to do some test in order to see how the .an8 file is created.
It's easier to load or write .an8 files with meshes only than cubes or shperes. Use "Build -> convert to mesh" in Anim8or to convert all of your primitives into meshes.

An Anim8or file could have several objects. Each object could have several meshes. Here is a file which represent a textured cube:

Légende:
Always present.
Present only if a texture is used in the object.
Present only if a material is used in the object (a material can be color or a texture with diffuse, ambient... properties).
Always present if a material is used.
Present only if the default parameter has been modified.
Present in some conditions

header {
  version { "0.8" }
  build { "2002.08.01" }
}
environment {
  grid { 1 10 50 50 }
  framerate { 24 }
}
texture { "sand"
  file { 
    "D:\\MyProjects\\divers\\anim8or\\an8demo_02-09-06\\Debug\\Data\\sand.bmp" }
}
object { "object01"
  material { "material01"
    surface {
      /* RGB chunk no longer used */
      rgb { 245 208 200 }
      lockambiantdiffuse { }
      ambiant {
        rgb { 245 208 200 }
        factor { 0.30000 }
      }
      diffuse {
        rgb { 245 208 200 }
        factor { 0.70000 }
        texturename { "sand" }
        textureparams {
          blendmode { decal }
          alphamode { none }
        }
      }
      specular {
        rgb { 255 255 255 }
        factor { 0.20000 }
      }
      emissive {
        rgb { 0 0 0 }
        factor { 1 }
      }
      alpha { 127 }
      brilliance { 2 }
      phongsize { 32 }
      map {
        kind { "transparency" }
        texturename { "land" }
        textureparams {
          blendmode { decal }
          alphamode { none }
        }
      }
      map {
        kind { "bumpmap" }
        texturename { "land" }
        textureparams {
          blendmode { decal }
          alphamode { none }
          percent { 40 }
        }
      }
    }
  }
  mesh {
    name { "mesh01" }
    base {
      origin { (0.45147 -0.56433 0) }
      orientation { (0.16159 -0.01033 -0.00169 0.98680) }
    }
    material { "material01" }
    smoothangle { 45 }
    /* 8 points, 6 faces, 8 uvCoords */
    materiallist {
      materialname { "material01" }
    }
    points {
      (-22.799 -20.993 -22.799) (-22.799 -20.993 22.799) 
      (-22.799 20.993 -22.799) (-22.799 20.993 22.799) (22.799 -20.993 -22.799) 
      (22.799 -20.993 22.799) (22.799 20.993 -22.799) (22.799 20.993 22.799)
    }
    normals {
      (0 0 -1) (0 0 1) (-1 0 0) (1 0 0) (0 1 0) (0 -1 0) (0 0 -1) (0 -1 0) 
      (-1 0 0) (0 0 1) (0 -1 0) (-1 0 0) (0 0 -1) (0 1 0) (-1 0 0) (0 0 1) 
      (0 1 0) (-1 0 0) (0 0 -1) (0 -1 0) (1 0 0) (0 0 1) (0 -1 0) (1 0 0) 
      (0 0 -1) (0 1 0) (1 0 0) (0 0 1) (0 1 0) (1 0 0)
    }
    texcoords {
      (0 0) (0 0) (0 1) (0 1) (1 0) (1 0) (1 1) (1 1)
    }
    faces {
      4 4 0 -1 ( (0 0) (4 4) (6 6) (2 2) )
      4 4 0 -1 ( (1 1) (3 3) (7 7) (5 5) )
      4 4 0 -1 ( (0 0) (2 2) (3 3) (1 1) )
      4 4 0 -1 ( (4 4) (5 5) (7 7) (6 6) )
      4 4 0 -1 ( (2 2) (6 6) (7 7) (3 3) )
      4 4 0 -1 ( (0 0) (1 1) (5 5) (4 4) )
    }
  }
}



























































































Chunk: header

version: Number of version of Anim8or which has been used to create the file.
build: Date of creation.


Environment

Chunk: environment

grid: ?
framerate: Number of frame per second.


Texture

Chunk: texture

The name of the texture follows this chunk.
The "file" chunk hold the complete path of the texture file.
It can be:
file {
"D:\\MyProjects\\divers\\anim8or\\an8demo_02-09-06\\Debug\\Data\\sand.bmp" }

or
file { "D:\\MyProjects\\divers\\anim8or\\an8demo_02-09-06\\Debug\\Data\\sand.bmp" }


Object

Chunk: object

The name of the object follows the name of this chunk.
Just one object can be exported in "object" mode, several in the scene mode.

One object can hold one or several groups of meshes. The chunk name of a group is group.


group {
    name { "group01" }
    base {
      origin { (-34.502 8.2121 0) }
      orientation { (-0.20344 0.79545 -0.42652 0.37941) }
    }
    mesh {
		// description of the mesh
    }
    mesh {
		// description of the mesh
    }
	etc...
}
















material

Chunk: material

The name of the material follows the name of this chunk.
This chunk is not writed if you do not create materials in Anim8or.
The surface chunk is alwas present and seems to be the one in this chunk.

Chunk: lockambiantdiffuse

Present if the "=" button has been selected in the material dialogue box of Anim8or.


Chunk: ambiant, diffuse and specular

Always present if a material is created. And always in the same order: (ambiant,diffuse,speculare).
Chunk: "rgb" (color: red,blue, green) and "factor" always present.
Chunk: texturename,textureparams present only if the material is a texture.

Chunk: texturename

The name of the texture.

Chunk: textureparams

Hold the blending mode and alpha mode.

Chunk: phongsize

Always present if the material is present.
Correspond to the "Rough" parameter of Anim8or.


Chunk: emissive

Present if the default parameter has been changed in Anim8or.
Chunk: "rgb" (color r,g,b) and "factor" always present.
Chunk: texturename,textureparams present only if the material has a testure.

Chunk: alpha and brillance

Present if the default parameter has been changed in Anim8or.
Correspond to the "Trans" and "brillance" parameter of Anim8or.


Chunk: map

Present only if a texture is set for transparency or bumpmapping. phongsize for phongsize. The "kind" chunk indicate if the material use transparency or bumpmapping (One can be persent without the other).

Mesh

Chunk: Mesh

Hold a mesh.
Several meshes can be in an object.
Note: A "group" chunk can have several meshes. This chunk has this chunk: "name", "base" followed by the "mesh" chunks.

Chunk: name

Always present
Name of a mesh.


Chunk: base

Use when the mesh has been moved (location or/and orientation)
Chunk: origin: Local origin of the mesh.
Chunk: orientation Quaternion for the orientation of the object (x, y, z, w) (present only if the mesh has been rotated in Anim8or).

Chunk: material

Default material of the mesh ?


Chunk: smoothangle

A vertex can be used in two polygons (A and B). By default, this vertex use the face normal of A for polygon A, and the face normal of B for polygon B. If the angle betweeen the two face noraml of this vertex is smaller than smoothangle, the two face normal are added (and normalized).
By this way, the light smooth the object.


Commentary: /* n points, m faces, k uvCoords */

Number n of points.
Number m of faces.
Number k of texture coordinates.


Chunk: materiallist

List of materials used in the mesh. Listed by name.
One"materialname" per material.
If the mesh do not use any material. A default name is present: (" -- default --").
The materials are hold in a special order which will be used in the face chunk (go to the face description).


Chunk: points

List of points with theirs coordinates (x,y,z).
The number of points per line is not fixed (it could be 1,2,3...).
Note: One point can be use by several faces (Anim8or use vertex indices).


Chunk: texcoords

List of texture coordinates.
Note: Anim8or use texture coordinate indices.


Chunk: normals

Present only if the "Debug->Output Normals" has been checked in the Anim8or menu.
List of normal coordinates.


Chunk: faces

One line per face.
4 numbres are writted before the list of indices of the face.

These 4 numbers corespond to:
_ 1st: Nomber of vertices for each faces (triangle, quad,...).
_ 2nd: Mask.
Binary number converted to decimal. Computed like this:
It has 3 digits.
the first bit (left) is set to 1 by Anim8or if backfaces must be displayed or 0 if not (default value).
the 2nd bit is set to 1 if each vertices have there normal or 0 if not (default value).
the 3rd bit is set to 1 if uv coordinate are used ou 0 if not (default value).
Then, this binary number is converted to decimal.
Some examples:
   0: No uv coords
   1: Show backfaces.
   2: Vertex normal are exported.
   4: UV coords are used by the face.
   6: Normals has been exported with "Debug->Output normal" and UV coords are used.
_ 3ième: Number of the material used by the face. This number correspond to the order the materials are listed in the "materiallist" chunk of the current mesh.
_ 4ième: If >=0, Index of the normal of the face itself (not its vertices)

3 type of indices can be hold: Vertex indices, UVcoord indices, Normal indices.
Inside "(...)", for each vertex 1,2 or 3 indices can be hold inside "(...)":
   _ Index of a vertex (always present and in 1st position).
   _ Index of an UVcoord (present if the mask allow it).
   _ Index of a normal (present if the mask allow it).

Indices are listed following the opposite of the direction of the hand of clock path.
Anim8or computes noramls when it loads an .an8 file.

Warning:
The description of a face is not always writted in one line (when the number of vertex is great). But indices of each vertex (2 or 3 indices for vertex, UVcoord and normal) are always in the same line.

Example:
4 4 0 -1 ( (1 1) (3 3) (7 7) (5 5) )
4 4 0 -1 ( (1 1) (3 3) (7 7) 
(5 5) )
4 4 0 -1 ( (1 1) (3 3) (7 7) (5 5) 
)
4 4 0 -1 ( (1 1) 
(3 3) (7 7) 
(5 5) )














Original version : November 2002
Last update: July 2003
By Grégory Smialek
www.texel.fr.fm