Difference between revisions of "CMDL (Metroid Prime)"
m (→Tools) |
|||
Line 100: | Line 100: | ||
== Tools == | == Tools == | ||
− | * [https://drive.google.com/file/d/0B9MLV21H7SDvYXRtTWlFRGQ3ZjA/edit?usp=sharing Parax's CMDL Maxscript | + | * [https://drive.google.com/file/d/0B9MLV21H7SDvYXRtTWlFRGQ3ZjA/edit?usp=sharing Parax's CMDL Maxscript] will import CMDL files into 3DS Max. |
[[Category:File Formats]] | [[Category:File Formats]] |
Revision as of 11:34, 28 January 2015
See CMDL (File Format) for the other revisions of this format.
The CMDL format is the model format used in the Metroid Prime series. The format's stayed relatively consistent throughout the trilogy, with modifications only really being made to the materials section.
Format
CMDL files are split up into a number of 32-byte aligned sections. Every section both starts and ends on a 32-byte boundary. These are used to separate different parts of the file; different types of sections typically indicate different sets of data. The header declares the section count and the size of each one; using these is the only way to navigate the file.
Header
Offset | Size | Description |
---|---|---|
0x0 | 4 | Magic; always 0xDEADBABE |
0x4 | 4 | Version; see below |
0x8 | 4 | Flags; see below |
0xC | 0x18 | Axis-aligned bounding box |
0x24 | 4 | Section count (SC) |
0x28 | 4 | Material set count |
0x2C | 4 × SC | Section sizes |
Following the end of the header, the file is padded to 32 bytes before the first section starts.
Version
Version | Game |
---|---|
2 | Metroid Prime |
3 | Metroid Prime 2 Demo |
4 | Metroid Prime 2 |
5 | Metroid Prime 3 |
Flags
Bit | Hex | Description |
---|---|---|
0 | 0x1 | Appears to do nothing |
1 | 0x2 | Toggle short normals |
2 | 0x4 | Enable short UV array |
Materials
CMDL files can have multiple material sets; each set will get its own section. The main catch with reading materials is to mind the version number; extra values were added starting in version 3 (Echoes Demo).
Geometry
There are a couple little catches when reading the CMDL geometry format. First, the short UV array will always be completely empty (size of 0) whenever it's present; however, if the corresponding flag isn't set in the header, then the short UV section will be omitted entirely. Second, even though the header has a flag to indicate the format of the normals, the vertex format setting in the primitive data is what actually controls how the normals are read. Finally, an extra vertex attribute was added starting in version 4 that you'll need to watch out for; it precedes the position attribute.
Tools
- Parax's CMDL Maxscript will import CMDL files into 3DS Max.