ArgDocs

Object Shapes (Track File Format)

This data contains the 3D representation of various track-side objects such as buildings, billboards and grandstands.

Position Description
$100E Number of object shapes
$1010 Offset of first internal object
+4*n Offset of n'th internal object

The shape data for each object starts at the offsets specified. For each item in the list of offsets, data goes from offset position to last byte before next offset.

For the last item, the shape data ends when we reach the $100A object list data offset.

Object Shape Details

Object shapes contain the data that represents the points, polygons and vectors of the 3D object.

Type Comment
short Unique header value, meaning unknown
short Offset to the Scale value data
short Header value "2", see Header values below
short Offset to the Graphical elements data
short Header value "3", see Header values below
short Offset to the Point data
short Header value "4", see Header values below
short Offset to the Vector data
short Header value "5", see Header values below
bytes (always 10) Unknown data, always 10 bytes long (possibly related to the following graphical element data)
short Offset to graphical element list data (?)
short Header value "6", see Header values below
byte (0 or 10) Unknown data. 10 bytes long if it exists. The only tracks that have objects where this data exists are Hockenheim, Spa, Monza and Adelaide
bytes (length varies) Scale value data.
bytes (length varies) Graphical elements data.
bytes (length varies) Point data.
bytes (length varies) Vector data.
bytes (length varies) Graphical element list data

Header values

HeaderValue2, HeaderValue3, HeaderValue4, HeaderValue5 and HeaderValue6 are always identical.

Interestingly, they are also identical to the Unknown2 and Unknown4 values in the general track offset data.

This value increases for each track, i.e. Phoenix has the lowest value and Adelaide has the highest.

Scale values

This is a list of values (short) that are used in the point data declarations below.

One or more points can refer to the same scale value, meaning that it is easy to resize an object by simply changing a single scale value.

Graphical Elements data

A graphical element is either a polygon, a bitmap or a line.

NB: This data is still being investigated and understood, it is possible that some of the info here is incorrect, and/or will be amended soon.

After a small header which contains which points to calculate, then comes one byte equal to 0xFF, and after that each element in itself.

To figure out if the upcoming data is a polygon, a bitmap or a line, first read the byte.

Value Type
0x80
0x88
0xD0
Bitmap
0x82
0x86
Bitmap (extended)
0xA0 (160) Line
Any other value Polygon, value indicates color (see below)

Polygon

Each polygon has the same structure, and can contain between 3 and 12 sides (plus twinned polygons).

Sides are read until the end of the list is reached (at 0x00).

Item Size Comment
Color unsigned byte The color in the palette. May be affected by the Unknown value in the object setting that implements the object shape.
Side n signed byte
End unsigned byte Always zero

Each side points to a vector, so to obtain the points that make the polygon, according to sign you just pick the start point (+ sign) or the end point (- sign) for each.

Bitmap

Bitmap images can be placed in the 3D objects.

For example, each pillar in the tunnel in Monaco is a bitmap.

The purpose of the initial value of the bitmap (0x80, 0x88, 0xD0 or - for extended bitmaps - 0x82 and 0x86) is not known.

The total length of a bitmap element (including the initial flag) is either 4 (“normal” bitmaps) or 6 bytes (“extended” bitmaps).

Item Size Comment
Flag byte 0x80, 0x88 or 0xD0 for "normal" bitmaps, 0x82 or 0x86 for extended bitmaps
Point byte The point where the bitmap is placed.
Unknown flag byte Various values, e.g. 0xFF
Bitmap index byte The index of the bitmap
Additional data 1 byte Purpose unknown, only exists in extended bitmaps
Additional data 2 byte Purpose unknown, only exists in extended bitmaps

Line

A line is a single black line from one point to another.

The length of a line definition is always 3 bytes.

Item Size Comment
Flag byte Always 0xA0
Unknown flag byte Always 8, except for a single object where it is 0.
Vector? Point? byte Indicates a line

After an element has been read and parsed, read the next byte to identify the next kind of element, and so on.

Point data

There are two types of points. Those that use scale values for their X and Y coordinates, and those that simply reference another point to use the same X and Y coordinates as the original point.

The Z coordinate can always be set separately for each point, both for scale points and reference points.

This section will be expanded

Vector data

This is a list of point “pairs”, defining the point that a vector goes from and to.

Objects that have no 3D content (such as the pit crew) do not have any vector data.

Graphical Elements list data

Not much is known about this yet.

Examples

Object Shape Examples

Misc

Related: http://www.grandprix2.de/Anleitung/tutus/3D_Object_Editing/3d_object_editing.htm

For a list of the 3D objects in the game, see the Track-side 3D objects list

Back to F1GP Track File Format