Introduction to .Map files for the 3D Artist

Any Torque artist has most likely landed up having to work with DIFs at some point in the lives. DIFs are basically BSP files generated from .map files.
Recently we have been working some old .map files generated in Quark (from another company) These .map files however cannot be used ‘as is’ and thus require either reloading into Quark (or Constructor) to make the changes needed or we need to figure out a new method for making our changes.
With that said, it has lead to an interesting investigation into the .map format that has proven valuable to me and our programmers. I thought I would share those findings here!

Lets start by pointing out that the .map format only store Tri’s (or 3D co-ordinates for 3 verts per polygon), the format does not actually store all the data needed for a quad (or single surface of a brush)

So how then does the .map format store a cube, do I hear you asking?!
Its actually pretty clever! The format, by only storing Tri’s has enough ‘vert position’ information to easily calculate where the extra verts for the missing Tri’s go. It allows the format to store only 6 polygons (Tri’s) to create a Brush, instead of 12 polygons.

Lets look at a visual representation of this!

map_interpretted
Image showing a simple cube ‘recreation’ within Max.
This image only shows the tri’s stored within the .map format.

As you can see from the image there is a vert at every corner of the cube, thus there is sufficient data to generate the missing Tri’s to complete the cube.

Below is the .map representation of the brush pictured above.

“index” “Brush 1”
“primitive” “B03[D]126”
{
(18 18 13) (18 -18 13) (-18 -18 13) GENHS [ 8 0 0 16 ] [ 0 -4 0 8 ] 0 1 1 -> TopFace (Pos Z)
(18 18 0) (-18 18 0) (-18 -18 0) GENHS [ -8 0 0 16 ] [ 0 -4 0 8 ] 0 1 1 -> BotFace (Neg Z)
(18 -18 0) (-18 -18 0) (-18 -18 13) GENHS [ 8 0 0 16 ] [ 0 0 -2 16 ] 0 1 1 -> Down (Neg Y)
(18 18 0) (18 -18 0) (18 -18 13) GENHS [ 0 8 0 16 ] [ 0 0 -2 16 ] 0 1 1 -> Right (Pos X)
(-18 18 0) (18 18 0) (18 18 13) GENHS [ -8 0 0 16 ] [ 0 0 -2 16 ] 0 1 1 -> Top (Pos Y)
(-18 -18 0) (-18 18 0) (-18 18 13) GENHS [ 0 -8 0 16 ] [ 0 0 -2 16 ] 0 1 1 -> Left (Neg X
}

The .map format is broken down as such

(18 18 13) (18 -18 13) (-18 -18 13) GENHS04 [ 8 0 0 16 ] [ 0 -4 0 8 ] 0 1 1 -> TopFace (Pos Z)

  • Green = The 3 verts listed via thier specific location in 3D Space, XYZ
  • Blue = The Texture Name mapped to that specific face.
  • Red = Texture Offset (x_off, y_off), Floating Point Value indicating Texture Rotation (rot_angle) & Texture Scales (x_sclae, y_scale).
  • Pink = My added comment (this does not appear in the actual .map file) however this tells you which face this line represents.

Basically that’s all I am going to cover, as this was never meant to be an in depth look at the .map format. It is simply intended to point out to the artists how the format functions and stores geometry. See the Quake MAP Specs for a much deeper explanation of the .map format

~C 🙂

Tweet about this on TwitterShare on FacebookShare on Google+Share on TumblrPin on Pinterest

Leave a Reply