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 text file. Like most JK files, # acts as a comment delimiter
A 3DO file is divided into 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
These are the following sections (in the order they appear in 3DO files):
This section contains version information.
3DO 2.1 # 3DO version
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
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. 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
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.
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.
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] .... material Index to the material to be used type The properties of this face geo Geometry Mode light Lighting Mode tex Texture Mode verts Number 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: 0x00 Normal 0x01 Two-sided (this face will always be drawn no matter which way it points). 0x02 Translucent 0x04 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.
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.
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: (Typical LEC Mesh Name)
Hierarchy Flags are always 0x0 in LEC 3dos.
A single mesh of a 3do can only have 500 triangle faces or less. If a mesh exceeds this limit, the 3do will appear in Jedi Knight as the default cube model. There is no known mesh limit.
First person weapon models, or POV models, are rendered in a different manner than other 3dos. There is a per-face depth limit to POV models. If a face exceeds this limit, it will be rendered on top of any geometry that would normally be visible over it. This can be fixed by subdividing the geometry.
Pivot offsets (pivotx, pivoty, and pivotz in the hierarchy section) are used for weapon orientation. For example, the lightsaber blade comes out of the K_RHAND node of the player model. Instead of coming out of the wrist, the node is provided with a pivot offset, where the mesh rotates during animations. The "real" node is then in the correct position for the lightsaber blade.
Jedi Knight Specs v.4 (Code Alliance)