Tropical Freeze features a new model format (necessitated by the hardware jump from Wii to Wii U) that bears little-to-no resemblance to the CMDL format of past games. There are three extensions used for models:
CMDL: Generic models
SMDL: Skinned models (ie. animated characters)
WMDL: World models (ie. level geometry)
All three share the same basic format, with SMDL and WMDL each containing an extra data chunk at the start of the file.
This file format needs more research There's a lot of unknown data.
After the RFRM Header, the first section of the file is SKHD in SMDL, and WDHD in WMDL. Following those extra sections, all three formats start with a header.
The MTRL section has a 32-bit material count, then lays out its materials one after the other. Materials are composed of basically a MTRL asset ID which contains the shader the material is rendered with, then per-instance material parameters (textures, scalar/color parameters, etc).
Each parameter has a fourCC parameter ID as well as a parameter type enum. There are five possible parameter types that each have a different layout in the file.
Distance in bytes between elements of this component within the vertex buffer. (This is equivalent to the full size of a single vertex.)
0xC
u32
1
Unknown
0x10
u32
1
Unknown
Likely component type/format
0x14
End of Vertex Component
Index Buffers
Just like how the VBUF section defines vertex buffers, the IBUF section defines index buffers. Each index buffer only has one value associated with it, so it's fairly simple, and you generally will only see one or two index buffers per file (as there's only two possible index buffer configurations).
The GPU section contains raw buffer data that's fed to the GPU. It's essentially just a giant blob with all the vertex and index buffers laid out next to each other. The tricky part is, all the buffer data is LZSS-compressed, and the metadata needed to decompress it is stored in the pak rather than in the files themselves; not only that, but that metadata is also the only way to distinguish the different buffers from each other.
As such, this section can't be read correctly if the model file is unpacked and completely left as-is; it needs to be either read directly from the pak, or the metadata needs to be added to the file in some way. A good unpacker should append the metadata to the end of the file; a pre-decompressed file needs the buffer sizes or offsets inserted into the file data somewhere.
PAK Metadata
The PAK metadata for the model formats contains mainly information related to the size and layout of the GPU section, and the metadata required to locate and decompress specific buffers within it.
Array containing all data needed to decompress each index buffer.
Read Buffer Info
For large models, the GPU section may be split into multiple read buffers. All offsets into the GPU section will be relative to the beginning of the chosen buffer.
Offset
Type
Name
Notes
0x0
u32
Size
Size of the buffer.
0x4
u32
Offset
Offset of the buffer within the GPU section.
0x8
End of Read Buffer Info
Buffer Info
This structure is used for both vertex and index buffers.
Offset
Type
Name
Notes
0x0
u32
Read Buffer Index
The read buffer that this buffer is inside of.
0x4
u32
Start Offset
Starting offset of this buffer, relative to the start of the chosen read buffer.