3DO Files



3DO Files General

3DO Files contain 3D Objects that can be placed in a level. Such objects can be characters, scenery, or structures (bridges, doors, lifts).

A 3DO File is a simple DOS text file. Like JKL Files, comments are accepted - everything from the character '#' to the end of the line is ignored.

For example:
# version and global constant settings

A 3DO file is made up of sections. The start of a section is marked by the "SECTION:" keyword at the beginning of a line, followed by the name of the section.


3DO General Structure

Model
   Materials
   GeoSet
      Mesh
         Vertices
         Texture Vertices
         Vertex Normals
         Faces
         Face Normals
   Hierarchy

These are the following sections (in the order they appear in 3DO files):


SECTION: HEADER

This section contains version information.

3DO                    2.1              # 3DO version


SECTION: MODELRESOURCE

This section contains the global list of materials used in the 3DO.

MATERIALS N
N is number of materials in the model.

0:     mx4arm.mat
1:     mxarm.mat


SECTION: GEOMETRYDEF

This section contains the information about all vertices, texture vertices, faces, and normals of the 3DO. It contains multiple GeoSets, and each GeoSet can contain multiple Meshes.

It begins with general information:

RADIUS   0.120330
INSERT OFFSET   0.000000   0.000000   0.058420

The Radius is used to test if this object has collided with another object. When an object's distance to this 3DO is less than this radius, JK will begin testing the Mesh radii to see if it collides with any of them.

The Insert Offset seems to be ignored.

GEOSETS N
N is number of GeoSets in the model.

GeoSets create levels of detail for 3DOs. There are usually 4. Number 0 is used for closeups and #3 is used for distance views. Only 1 GeoSet is needed. The JKL file defines how many LODs are used. Every GeoSet should contain the same number of meshes in the same order.

MESHES N
N is the number of meshes in the GeoSet.

Each mesh contains this general info:

MESH            0               # Mesh Index
NAME            mx4arm          # Name of Mesh
RADIUS          0.059488        # Spherical radius of Mesh
GEOMETRYMODE    4               # Geometry Mode
LIGHTINGMODE    3               # Lighting Mode
TEXTUREMODE     0               # Texture Mode

The Geometry, Lighting, and Texture Modes tell JK how to draw the 3DO.
Possible Geometry modes are: 0: Do not draw 1: Draw only the vertices 2: Draw only the edges (wireframe) 3: Draw it with filled faces 4: Draw it textured
Possible Lighting modes are: 0: Fully lit 1: Not lit 2: "Good" 3: "Better"
Possible Texture modes are: 0: Linear (causes some distortion) 1: Perspective Corrected (interpolates between projected points) 2: Perspective

VERTICES N
N is the number of vertices in the Mesh.

# num:     x:         y:         z:         i: 
    0:   0.000929   0.000000  -0.005314   0.000000
    1:   0.005769  -0.000105   0.005595   0.000000
....
x, y, and z are the coordinates of the vertices.
i is the intensity of the light at the vertices. These are always 0.0.

TEXTURE VERTICES N
N is the number of texture vertices in the Mesh.

    0:  14.603445  -9.554900	# Coordinate of Vertex
    1:  12.314912 -31.749504
....

The texture vertex coordinate system is based on "texels" where one unit can be thought of as one pixel. The origin (0,0) is the top-left corner of the material file. +U travels to the right, while +V travels downward. -U travels to the left, while -V travels upward.

VERTEX NORMALS

There are the same number of Vertex Normals as there are Vertices.

Vertex Normals are found by averaging the Normals of each Face that references the Vertex.

# num:     x:         y:         z:
    0:   0.770196  -0.279341  -0.573382	# Normal
    1:   0.913539  -0.008882  -0.406654
....

x, y, and z can be thought of as the A, B, C coefficients in the plane equation.

FACES N
N is the number of faces in the Mesh

#  num:  material:   type:  geo:  light:   tex:  extralight:  verts:
     0:         0  0x0000     4       3      0       0.0000       4 [vs]
....
materialIndex to the material to be used
typeThe properties of this face
geo Geometry Mode
lightLighting Mode
texTexture Mode
vertsNumber of vertices that make-up face
extralight Float representing light intensity
Vertices are defined as: [vertex], [tex vertex]

A Face can have any combination of these types:
0x0000 Normal
0x0001 Two-sided (this face will always be drawn no matter which way it points).
0x0002 Translucent
0x0004 Collides with other objects
NOTE: 0x4 might be ignored or is superceded

The Geometry, Lighting, and Texture Modes are the same as their Mesh counterparts.

Extralight may also be ignored.

FACE NORMALS

There are the same number of Face Normals as there are Faces.

# num:     x:         y:         z:
    0:   0.668400   0.682697  -0.295238	# Normal
    1:  -0.637082   0.676373   0.369657
....

x, y, and z can be thought of as the A, B, C coefficients in the plane equation scaled to 1.0 length.


SECTION: HIERARCHYDEF

This section organizes the 3DO into a hierarchy for use in animations.

HIERARCHY NODES N
N is the number of nodes in the Hierarchy.

flags           Hexadecimal Integer
type            Hexadecimal Integer
mesh            Reference to Mesh
parent          Parent Node
child           First Child Node
sibling         Sibling Node
numChildren     Number of Child Nodes
x y z           Offset of this node from Parent node
pitch           Starting Rotation
yaw             Starting Rotation
roll            Starting Rotation
pivotx          Amount to offset node before rotating
pivoty          Amount to offset node before rotating
pivotz          Amount to offset node before rotating
hnodename       Name of node referenced by animations

Types:
0x10 or 0x00010 This node is apart of the lower body (hip).
0x1 or 0x00001 This node is apart of the upper body (torso).
0x20 or 0x00020 This node is apart of the left leg (lcalf,lfoot,lthigh).
0x2 or 0x00002 This node is apart of the left arm (lforearm,lhand,lshoulder).
0x40 or 0x00040 This node is apart of the right leg (rcalf,rfoot,rthigh).
0x4 or 0x00004 This node is apart of the right arm (rforearm,rhand,rshoulder).
0x8 or 0x00008 This node is apart of the head (head,neck).

If you create a 3DO that is not "humanoid" then you should use 0x1 for each node. I do not believe type 0x0 Nodes are supported.

Hierarchy Flags are always 0x0.