Nomad 3D Model Format

From ModdingWiki
Jump to navigation Jump to search
Nomad 3D Model Format
Format type3D Model
Model typePolygon
Maximum number of polygons65,536
Maximum number of vertices127
Games

The Nomad 3D Model Format is a binary file format that uses the file extension .BIN. These files can be found packed into the DAT archives used by Nomad, although they do not have a unique file extension even within the game; other files such as fonts and some data tables share the .BIN extension.

The 3D models are rendered untextured, and with flat shading. Each polygon face is assigned one of eight base colors, and up to eight tints/shades of each base color are used during rendering for a maximum of 64 colors on screen for 3D model rendering. Other game elements (such as sprites and other raster images) make use of different regions of the VGA palette.

The .BIN format was reverse engineered by cmb.

Format

Data type Description
UINT16LE pCount Total number of polygons used in the model
POLYRECORD Array of polygon definitions; see POLYRECORD description below. Array size is pCount.
UINT16LE vCount Total number of vertices used in the model
VERTRECORD Array of vertex definitions; see VERTRECORD description below. Array size is vCount.

POLYRECORD structure

This is a struct of variable size, but it will be a minimum of 18 bytes (corresponding to the minimum vertex count of three.) This struct is two bytes larger for each additional vertex used by this polygon.

Data type Description
INT16LE Possibly an X coordinate of a direction vector?
INT16LE Possibly a Y coordinate of a direction vector?
INT16LE Possibly a Z coordinate of a direction vector?
INT16LE Unknown
INT16LE Unknown
UINT8LE vCount 7-bit count of the number of vertices used by this polygon (stored in the lower 7 bits). The high bit is also sometimes set, but its purpose is unknown.
UINT8LE Color for this polygon surface. This will be an index 00 through 07, which happens to match up to the first eight colors of the EGA palette. In reality, each of the these base colors will be one of eight shades when it is rendered on screen (as the 3D engine selects the appropriate one for highlights/shadows.) The 64 total colors that are used for drawing 3D models to the screen are provided by the palette SHIP.PAL.
UINT16LE Array of 16-bit words, each one a 0-based index into the VERTRECORD structure that follows in the file. Array size is vCount.

VERTRECORD structure

Data type Description
INT16LE 3D X coordinate
INT16LE 3D Y coordinate
INT16LE 3D Z coordinate