MODL: Difference between revisions
No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
* geoset - a collection of meshes | * geoset - a collection of meshes | ||
* string - character array padded with zeros (one or more) at the end | * string - character array padded with zeros (one or more) at the end | ||
* fields marked with "(?)" have not been verified. this should not be confused with an ordinary question mark "?", which is a valid part of a field's description. | |||
== Layout == | == Layout == | ||
Line 71: | Line 72: | ||
===== Notes ===== | ===== Notes ===== | ||
* Illumination values are used to as additional brightness values that are added to their corresponding vertex. This way, for example, for a given vertex v, an illumination value of 0.5 will increase v's brightness by 0.5. Illumination values (are floats, and) are in the range [0, 1]. All encountered models so far have all illumination values of 0.00. | * Illumination values are used to as additional brightness values that are added to their corresponding vertex. This way, for example, for a given vertex v, an illumination value of 0.5 will increase v's brightness by 0.5. Illumination values (are floats, and) are in the range [0, 1]. All encountered models so far have all illumination values of 0.00. | ||
===== Faces ===== | |||
face id (?) |4 bytes | |||
face type |4 bytes | |||
geometry mode |4 bytes | |||
lighting mode |4 bytes | |||
texture mode |4 bytes | |||
number of vertices|4 bytes | |||
unknown |4 bytes | |||
has texture? |4 bytes | |||
has material? |4 bytes |
Revision as of 15:10, 17 September 2006
This page attempts to document the LucasArts MODL mesh format, file extension ".3do". Work is ongoing, so no guarantees are made regarding any information on this page.
Variants
The MODL format comes in two flavours: binary, and ASCII. The ASCII flavour is used in the Grim Fandango demo, and the binary one is used in the full version. It follows that the demo version contains ASCII-versions of models that appear in the full version. Such models should be approached with care, because it's not unlikely that corresponding models from the two versions contain slightly different data.
This document is concerned with the binary flavour of the mesh files.
TODO -- add more games that use MODL, if there are any; upload samples.
Conventions/Terminology
This document employs several terms and conventions for convenience. Most of these are concerned with data types, of course.
- float - IEEE floating point value
- vectorN - an N-dimensional array that consists of N floats
- All values are little-endian unless otherwise specified
- geoset - a collection of meshes
- string - character array padded with zeros (one or more) at the end
- fields marked with "(?)" have not been verified. this should not be confused with an ordinary question mark "?", which is a valid part of a field's description.
Layout
The MODL format, at the highest level, has the following layout:
header geoset(s) \mesh(es) \face(s) node(s) footer
That is, mesh primitives with no relational information is specified first through geosets, meshes, and faces. Relations between mesh primitives are represented through nodes, which are specified last.
Header
The header is formatted as follows:
"MODL" FOURCC |4 bytes number of materials used|4 bytes
This is followed by material name fields, one per material:
material name|32 bytes, string
Followed the rest of the header:
3d model name|32 bytes, string
Geoset
The geoset header is formatted as follows:
unknown |4 bytes number of geosets|4 bytes
This is followed by (not very interesting) geoset structures, one per geoset:
number of meshes|4 bytes
Mesh
A mesh is formatted as follows:
mesh name |32 bytes, string unknown |4 bytes geometry mode |4 bytes lighting mode |4 bytes texture mode |4 bytes number of mesh vertices |4 bytes number of texture vertices |4 bytes number of faces |4 bytes mesh vertex data |..., vector3 texture vertex data |..., vector2 illumination vertex data (see notes) |..., float unknown |4 bytes * number of mesh vertices face data (see below) |... mesh vertex normal data |..., vector3 has shadow |4 bytes unknown |4 bytes mesh radius |4 bytes unknown |vector3 unknown |vector3
Notes
- Illumination values are used to as additional brightness values that are added to their corresponding vertex. This way, for example, for a given vertex v, an illumination value of 0.5 will increase v's brightness by 0.5. Illumination values (are floats, and) are in the range [0, 1]. All encountered models so far have all illumination values of 0.00.
Faces
face id (?) |4 bytes face type |4 bytes geometry mode |4 bytes lighting mode |4 bytes texture mode |4 bytes number of vertices|4 bytes unknown |4 bytes has texture? |4 bytes has material? |4 bytes