[TOC] [Prev] [Next]

3DO Files


General Description

They contain the "3D" objects. (samples : MOUSEBOT, the DEATH STAR HOLOGRAM)

They are text files containing a geometric description of a full 3D object, and are converted from 3D Studio .ASC format. They accept # comments.

Note: Underscore ("_") in the 3DO name makes other objects behind it show improperly - they get shown as if they are in front of the object rather than behind it (that excludes other 3DOs with underscore in their names for some reason). Underscore somehow changes sorting order, Z-buffering or some other rendering parameter probably giving a benefit in speed on older machines.

[by Michael Taylor (adapted)]


3DO Format: Header

| 3DO 1.2

Magic and Version Number: this is the word "3DO" followed by a version #, either 1.2, 1.20, or 1.30.

Next comes several lines of header data.
Included is the 3DO name, number of objects in the file, total number of vertices, total number of polygons, palette used.

| 3DONAME  cube
| OBJECTS  00001
| VERTICES 00008
| POLYGONS 00006
| PALETTE  METAL.PAL

The palette file doesn't appear to relate to any PAL file found in the GOB directory.
[Could this be the type of rendering (metal, phong, ...) used in 3DS ? [Yves]]

After the header comes a table of textures that are used.

| TEXTURES 0

or

| TEXTURES 1
|   TEXTURE: IPDTENGR.BM

If any textures are used then below the TEXTURES # line is additional lines defining each texture file. It creates a zero based array of textures for later usage by the objects.


Object Definitions

[by Michael Taylor (adapted)]

After the header data comes each object's definition. A 3DO consists of one or more "object". Each object can have one texture associated with it.

Each one starts with an object header and then the data. The object header is the word "OBJECT" followed by the object's name in double quotes. The object names seem irrelevant provided they are unique within the 3DO file.

Next is the word "TEXTURE" followed by the texture used for this object. If no texture is used then the value of -1 is used, else an index into the texture table defined in the header data is given.

| OBJECT "shuttle"
| TEXTURE 0    # Index into texture array
|              # IFOCTGR.BM

After the texture information, starts the actual geometric description of the object.

First comes the vertices. The initial line is the word VERTICES followed by the number of vertices defined. Then the vertices are listed starting with 0 and going up to the number of vertices listed on the VERTICES line. Each vertex is defined by 3 numbers; x, y, and z. They represent relative locations on a 3-D graph. They are taken to 3 decimal places.

| VERTICES 8
|    0:   0.000   2.000  -0.050
|    1: -10.000   2.000  -5.550
| ...

After the vertex information, comes the polygonal information. Each object may be made up of either triangles or quads. The appropriate header and number of polygons defined are listed, TRIANGLES for triangles and QUADS for quadrilaterals. The polygons are described with a number starting at 0, then the vertex number for each end point is given (3 for triangles and 4 for quadrilaterals). Then a color is given to each polygon (0 to 255), referencing the currently loaded level's PAL. Finally comes the shading used for each polygon.

| TRIANGLES 12
| # Num  V1  V2  V3  Color  Shading
|   0:   1   2   3     0     PLANE
|   1:   0   1   3     0     PLANE
|   2:   5   1   0    62     FLAT
| ...  

Also note that the vertices are listed in clockwise order if you are facing directly at the polygon.
[This simplifies hidden lines/surfaces algorithm, as you may determine the facet orientation with 3 of them [Yves]]

Note that in order to use a texture for a polygon, you must set its shading to TEXTURE.

[end of Michael's section]

Shading types

FLAT Normal, flat surface filled uniformly with the designated color
GOURAUD As for FLAT, but with gouraud shading
VERTEX Draw only vertexes of polygon (like Death Star holo), remainder will not be drawn
TEXTURE Texture mapped
GOURTEX Texture mapped plus gouraud shading
PLANE Texture on a horizontal plane. Rendered the same as floor and ceiling textures -- must be 64*64, affected by flr and ceil txoffsets, and scrolled by elevators scroll_floor and scroll_ceiling

Texture mapping

Here is a description of TEXTURE VERTICES and TEXTURE QUADS/TRIANGLES, which Michael didn't fully cover.

If textures are used (TEXTURE, GOURTEX or PLANE shading), then texture vertices and texture triangles/quads also need to be defined.

TEXTURE VERTICES:

Each texture vertex is a U-V coordinate on the texture which is being mapped to the current object. Values are between 0.000 and 1.000 where (0,0) is the bottom left corner of the texture and (1,1) is the top-right corner of the texture.

TEXTURE QUADS / TEXTURE TRIANGLES:

These link texture vertices into a 3 or 4 sided polygon, hence designating which portion of the texture is to be mapped onto the polygon. The texture polygons correspond to the previously defined object polygons. TEXTURE TRIANGLE 0 maps to TRIANGLE 0; TEXTURE TRIANGLE 1 maps to TRIANGLE 1; and so on.

For example, if you have an 16 x 8 texture

with the following 4 texture vertices

TEXTURE VERTICES:
| 0:0.000.00
| 1:0.000.50
| 2:1.000.50
| 3:1.000.00

and the following texture quad

TEXTURE QUAD:
| 0:012 3

...the bottom half of the texture will be mapped onto QUAD 0 of the object with the first vertex of the TEXTURE QUAD mapping to the first vertex of the QUAD, the second vertex on the second, and so on.

You can orientate the portion of texture on the polygon differently by shifting the sequence of the texture vertices (eg. 2,3,0,1 instead of 0,1,2,3 represents a rotation of 180 degrees). You can flip the texture by reversing the order of texture vertices (eg. 3,2,1,0). You can even deform the texture by varying the order of the texture vertices (eg. 0,2,1,3).

The mapped section of the texture will be scaled and stretched by the game engine to cover the whole polygon face.

Texture vertices can be re-used as many times as you want, for example, if you wish to map the same section of a texture to multiple polygons.

Note: TEXTURE VERTICES and TEXTURE QUADS / TRIANGLES are also defined for PLANE fill, but the game engine ignores the values. Polygons with PLANE shading will have the selected texture rendered on them as a repeating (tiled) 64x64 image exactly like a sector floor or ceiling. The texture will always be rendered on the horizontal (X-Z) plane, therefore for a correct appearance the 3DO's polygons must remain oriented parallel to the X-Z plane. (Rotating the 3DO with a VUE, for instance, will cause strange looking results...)