.3DO File Format - Primitives
by P.A.Flack 1999
last revised 7/June/1999

003 004 005 006007 008 00900A 00B 00D00E 00F 010011 013 014016 017 019A03
01F 020 021 815 81B81C 81D 81E81F 820 821
This part of the 3DO file is the most complicated and consists of many different runs of data which shall be referred to as Types, or T-xxx (hexadecimal).  The header of this section is the same as all the others:
Bytes Values Notes
0-3 
4-7 
8-11 
12-
"MIRP" 
0x00000000 
data size 
data...
Section Type (reversed) 
Seems to be a zero all the time 
Size of data in bytes 
Data, grouped into Types

The first four bytes of the data section (e.g. bytes 12-15 in the table above) give the starting point of the first Type in the data section.  I.e. if bytes 12-15 give the number 5,000, this would equate to byte 5,012 including the header.

From this point on, the 32-bit numbers will be referred to in the 'correct' order.  I.e. not like the "MIRP" in the above table.  If you're looking at a 3DO file with a hex editor, the 4 bytes for each number will be in the 'incorrect', or network order: b3 b2 b1 b0.

Some numbers are 32bit integers, others are 32bit floats.  The floats are generally used for coordinates (vertex & texture), and can be identified by their huge values if you read them in as an integer :-)

Most of the Types point to other Types.  Those that don't are the T-8XX's which define polygons and a couple of others.  Basically, the PRIM structure can be drawn as a tree.  (Sometimes a recursive tree - track.3do's).

Some more notes:



Notation Used

These images mean: general node; leaf node (primitive or other); car-specific; finished!

General format is T-x (where x is hexadecimal); brief description; list of components that make up the type (nearly all 32bit integers/floats, where entries end with ..., it means there are a variable number of them); Long description

For the quick look table below, these images signify the different components:
=offset (i.e. pointer to a child node)
=colour
=string offset
=scale (float)
=integer
=float
=vertex number
=plane number
=normal number
= texture x,y pairing (2 floats)
number = this number appears
count = there are this many 'things' to follow - where a thing is in brackets and followed by ...



Quick Reference Table
(for you editor people with a busy life...)
 
Type (hex) Format Description
003 3, , , , SRB Chooser & Placer & Scaler
004 4,count,  's... Multi child node
005-1 5, ,1, Selector: mip file without display class
005-4 5, ,4, Selector: ? display class ?
005-5 5, ,5, , Selector: mip file with display class
005-8 5, ,8, , , Selector: ?
005-C 5, ,C, , , , Selector: ?
005-D 5, ,D, , , , Selector: ?
005-11 5, ,11,count, 's... Selector: ?
005-20 5, ,20, Selector: ?
005-24 5, ,24, , Selector: ?
005-2C 5, ,2C, , , , Selector: ?
006 6, , Plane, single child node
007 7, , , Plane, double child node
008 8, , , , , Plane, quad child node
009 9, , , , Plane, triple child node
00A A, , , , Plane, triple child node
00B B, , , Plane, double child node
00D D, (dx), (dy), (dz), , , , , Positioner
00E E, ,0 3DO File Chooser
00F F, , , , , ,-1, 0,0,0,0, count, ( , , , )'s... Track visibility box
010 10,count, 's... ?Chooser of some description?
011 11, , , ,count, ( , )'s... Trk relation?
013 13, (dx),  (dy),  (dz),  Positioner (3DO)
014 14, , ?
016 16, (dx),  (dy),  (dz),  Positioner
017 17,count, 's... Room?
019 19, , , , , , , , , Bounding cuboid - seen lots of places
01F 1F,0, ,count,  's...,  's... Car Polygon, textured
020 20,0,0, ,count,  's...,  's...,  's... Car Polygon, textured, smooth shading
021 21,0, ,count,  's...,  's...,  's... Car Polygon, textured, smooth shading, normals
815 815, , , Line
81B 81B, ,count, 's... Polygon, flat shading
81C 81C, ,count, 's..., 's... Polygon, smooth shading
81D 81D, ,count, 's..., 's... Polygon, normals
81E 81E, ,count, 's..., 's..., 's... Polygon, smooth shading, normals
81F 81F,0, ,count, 's..., 's... Polygon, textured
820 820,0, ,count, 's..., 's..., 's... Polygon, textured, smooth shading
821 821,0, ,count, 's..., 's..., 's... Polygon, textured, normals
A03 A03, , , , , SRB Selector


Display Classes
These are used (I think exclusively) by the texture selection nodes, T-5xx.  They define classes of texture, and thus polygon, so the graphics detail level can be reduced.  Some are car only.
 
Number Type of thing in class Menu option that affects the class
0 Track Track Textures
1 Grass, curb, edge, bank Terrain Textures
2 Fence, armco Wall Textures
4 (external)Engine Car Textures
8 Trees? ??
10 Startline, starting grid boxes ?Track Textures?
13 Face, rim, shock, etraymap ?Car Textures?
17 Steering ?Cockpit Texture?
18 ???insidelf ??
19 Knees, driver, arms, neck Driver Textures
20 Racing groove Racing Groove



Detailed Descriptions

General Nodes

T-3  .SRB File

3, vertex number, colour, string offset, float, int

T-4  Multi-child node
T-51,4,5,8,c,d,11,1c,20,24,2c  Texture Selection

A side note:
Plane calculations:
To calculate which side of a plane a point (i.e. viewer) is on, find d (d=Ax+By+Cz+D), where ABCD are the coefficients of the plane equation (i.e. X,Y,Z,S) and xyz are the coordinates of the point.
If d<0, point is 'below' the plane
If d=0, point is 'on' the plane
If d>0, point is 'above' the plane

Where 'above' is taken from the plane in the direction of X,Y,Z, and below is in the opposite direction.


T-6    Single child with plane

6, plane number, offset
The plane number references the PLAN section.  The offset contains the polygons visible when the viewer is 'above' the plane.

T-7    Double child with plane
7, plane number, offset, offset
A dual child node, with a plane.  Each offset is followed only if the contents can be seen.

(almost)  T-8    Bi-directional version of T-9/T-A
8, plane number, offset1, offset2, offset3, offset4
This behaves like T-9 and T-A, in that the first and last offsets are the sub-trees 'above' and 'beneath' the plane.  The second and third offsets are the sub-trees 'on' the plane, one viewed from above, the other when viewed from beneath.
This node is used in places like a fence bordering the track, where the fence can be viewed from both sides.

T-9    Three child with plane
9, plane number, offset1, offset2, offset3
The plane number references into the PLAN section.  One or more of the offsets is often NULL (i.e. 0xffffffff).
The first offset is for things that can be seen 'below', the second for 'above', and the third is always followed, as far as I can tell (above/below, that is).

T-A    Three child with plane
Same as T-9
No idea why T-A and T-9 are the same, so there must be some difference.  Possibly to do with the plane number, but more likely to do with the context they appear, i.e. what Types do they point at and are pointed at from?  Or maybe, T-A and T-9 are the same, but the sub-trees are the opposite way around - i.e. above=below, below=above?.

T-B    Double child with plane
T-D    Positioner
D, dx, dy, dz, rotx?, roty?, rotz?, scale, offset
7 floats, suggesting 3 for xyz, 3 for rotations & 1 for a scale (usually 1.0 - i.e. not scaled).  The three rotations are usually in the range -6.28 to 6.28, i.e. -1radian to +1radian.

This type seems to be a general transformation node - that is, all children of this node are changed by this node.


T-E    3DO file
T-F    Track visibility box T-10    Chooser?
T-11    Distance Switch
T-13:  Place a 3DO object
T-14    Unknown
Found in lotus/lotus.3do & presumably other cars.

14, number, number.

So this Type looks like T-10 with unknown numbers


T-16    Positioner
16, float, float, float, float, float, float, float, offset
Found in lotus/lotus.3do.  Almost identical to T-D & T-13, with 7 floats and an offset

T-17    Room?
17, no. of vertices, vertices...
Found in lotus/lotus.3do & other cars.  Seems to define an area via vertices.

T-19    Room?
T-A03    SRB file?
A03, vertex number, colour, string offset, float, int3
Looks like T-3 but for the cars.  Untested.


Lines/Polygons

T-1f    Polygon - Textured

1f, 0, number (hex 05000000 or 0a000000), no. of vertices, texture x,y pairs..., vertex numbers...

Looks remarkably like T-81f, just with an extra number at the start.  Only found in car 3do's.


T-20   Polygon - Textured, Gouraud
20, 0, 0, number (hex 01000000), no. of vertices, texture x,y, pairs..., vertex numbers..., vertex colours...

Looks remarkably like T-820, just with a few more numbers at the start.  Only found in car 3do's.


T-21   Polygon - Textured, Gouraud, Specular
21, 0, number (hex 02000000), no. of vertices, texture x,y, pairs..., vertex numbers..., vertex normals...

Looks remarkably like T-821, just with an extra number at the start.  Only found in car 3do's.  The last set of numbers are normals for lighting effects.


T-815   Line
815, colour, vertex1, vertex2
Probably the simplest primitive, 815's define lines.  These are used for things like telegraph wires and don't appear very often.

T-81B  Polygon - Flat
T-81C  Polygon - Gouraud, No Texture
T-81D Polygon - Specular
T-81E Polygon - Gouraud & Specular
T-81F  Polygon - Textured
T-820  Polygon - Textured, Gouraud
T-821  Polygon - Textured, Specular
821, 0, colour, no. of vertices, x,y pairings..., vertex numbers..., vertex normals...
This looks like a polygon with texture mapping, flat shading, specular shading.

(did that make sense?  yes?  blimey!)

last revised 7/June/1999