CMDL (Tropical Freeze): Difference between revisions

Jump to navigation Jump to search
no edit summary
>Aruki
No edit summary
>Aruki
No edit summary
Line 11: Line 11:
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.
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.


=== HEAD ===
=== Model Header ===


{| class="wikitable"
{| class="wikitable"
Line 53: Line 53:
If the ending flag is 1, then a large chunk of extra data follows before the next section begins; otherwise, the HEAD section ends.
If the ending flag is 1, then a large chunk of extra data follows before the next section begins; otherwise, the HEAD section ends.


=== MTRL ===
=== Materials ===


The MTRL section has a 32-bit material count, then lays out its materials one after the other. The material structure is somewhat complicated; each material has a name, something that wasn't present in Retro's previous material formats, as well as a shader ID. The rest of the material structure appears to be defining parameters to pass to the shader. This needs a lot more research to determine what the parameters are and what the different data is.
The MTRL section has a 32-bit material count, then lays out its materials one after the other. The material structure is somewhat complicated; each material has a name, something that wasn't present in Retro's previous material formats, as well as a shader ID. The rest of the material structure appears to be defining parameters to pass to the shader. This needs a lot more research to determine what the parameters are and what the different data is.
Line 59: Line 59:
{| class="wikitable"
{| class="wikitable"
! Type
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| string
| string
| -
| 1
| '''Name''' (zero-terminated)
| '''Material Name'''
| Zero-terminated string
|-
|-
| [[MTRL (File Format)|MTRL]]
| Asset ID ([[MTRL (File Format)|MTRL]])
| 16
| 1
| '''Shader ID'''
| '''Material Shader Asset ID'''
| Points to the MTRL file containing the shader for this material.
|-
|-
| char[4]
| char
| 4
| 4
| '''Shading type fourCC'''; can be PHNG, LAMB, SURF, or FURM
| '''Material Type'''
| Can be <code>PHNG</code> (Phong), <code>LAMB</code> (Lambert), <code>SURF</code> (Surface), <code>FURM</code> (Fur), or <code>REFL</code> (Reflect). <code>REFL</code> may be unused.
|-
|-
| u32
| u32
| 4
| 1
| {{unknown|'''Unknown'''}}
| '''Material Flags'''
| Bitfield used to toggle various settings on the material. None of the flags are known.
|-
|-
| u32
| u32
| 4
| 1
| '''Subsection count'''
| '''Parameter Count'''
| Count of parameters in this material definition.
|-
| [[#Material Parameter|Material Parameter]]
| ''Parameter Count''
| '''Parameter Array'''
|
|}
|}


Material subsections each have a fourCC name and a type identifer, followed by a set of parameters. The type and number of parameters is dependent on the subsection type; there are five known types currently.
==== Material Parameter ====
 
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.


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Type
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| 0x0
| char[4]
| char
| 4
| 4
| '''Section name fourCC'''
| '''Parameter ID'''
|
|-
|-
| 0x4
| 0x4
| u32
| u32
| 4
| 1
| '''Section type'''
| '''Parameter Type'''
| Determines what type of data this parameter contains. Can be either 0, 1, 2, 4, or 5. (Note: 3 is an invalid value, not an unused type.)
|-
|-
| 0x8
| 0x8
| struct
| {{none}}
| -
| {{none}}
| '''Section data struct'''; type varies based on the section type value
| '''Parameter Data'''
|-
| Structure and size varies depending on ''Parameter Type''. See below.
| colspan=4 {{unknown|End of subsection; next one begins}}
|}
|}


==== Type 0: Texture Map ====
==== Type 0: Texture Token Data ====


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Type
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| 0x0
| [[TXTR (Tropical Freeze)|TXTR]]
| Asset ID ([[TXTR (Tropical Freeze)|TXTR]])
| 0x10
| 1
| '''Texture ID'''
| '''Texture ID'''
| Texture asset ID.
|-
|-
| 0x10
| 0x10
| u32
| [[#Texture Usage Info|Texture Usage Info]]
| 4
| 1
| {{unknown|'''Unknown'''}}
| '''Texture Usage Info'''
| '''Note:''' Not present if the TXTR asset ID is invalid.
|-
|-
| 0x14
| colspan=5 {{unknown|End of Texture Token Data}}
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x18
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x1C
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x20
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x24
| colspan=3 {{unknown|End of struct}}
|}
|}


==== Type 1: Unknown ====
==== Type 1: Color Data ====


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Type
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| 0x0
| float
| float
| 4
| 4
| {{unknown|'''Unknown'''}}
| '''Color Value'''
|-
| 4-float RGBA color value.
| 0x4
| float
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x8
| float
| 4
| {{unknown|'''Unknown'''}}
|-
| 0xC
| float
| 4
| {{unknown|'''Unknown'''}}
|-
|-
| 0x10
| 0x10
| colspan=3 {{unknown|End of struct}}
| colspan=4 {{unknown|End of Color Data}}
|}
|}


==== Type 2: Unknown ====
==== Type 2: Scalar Data ====


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Type
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| 0x0
| float
| float
| 4
| 1
| {{unknown|'''Unknown'''}}
| '''Scalar Value'''
|
|-
|-
| 0x4
| 0x4
| colspan=3 {{unknown|End of struct}}
| colspan=4 {{unknown|End of Scalar Data}}
|}
|}


==== Type 4: Unknown ====
==== Type 4: Layered Texture Data ====


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Type
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| 0x0
| u32
| u32
| 4
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|Unknown}}
|
|-
|-
| 0x4
| 0x4
| float
| float
| 4
| 4
| {{unknown|'''Unknown'''}}
| {{unknown|Unknown Color}}
|-
|  
| 0x8
| float
| 4
| {{unknown|'''Unknown'''}}
|-
| 0xC
| float
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x10
| float
| 4
| {{unknown|'''Unknown'''}}
|-
|-
| 0x14
| 0x14
| float
| float
| 4
| 4
| {{unknown|'''Unknown'''}}
| {{unknown|Unknown Color}}
|
|-
|-
| 0x18
| 0x24
| float
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x1C
| float
| float
| 4
| 4
| {{unknown|'''Unknown'''}}
| {{unknown|Unknown Color}}
|-
|  
| 0x20
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x24
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x28
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x2C
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x30
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
|-
| 0x34
| 0x34
| u8
| u8
| 1
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|Unknown}}
|
|-
|-
| 0x35
| 0x35
| [[TXTR (Tropical Freeze)|TXTR]]
| [[#Type 0: Texture Token Data|Texture Token Data]]
| 0x10
| 1
| {{unknown|'''Unknown Texture ID'''}}
| {{unknown|Unknown Texture Token Data}}
|
|-
|-
| 0x45
| {{none}}
| u32
| [[#Type 0: Texture Token Data|Texture Token Data]]
| 4
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|Unknown Texture Token Data}}
|
|-
|-
| 0x49
| {{none}}
| u32
| [[#Type 0: Texture Token Data|Texture Token Data]]
| 4
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|Unknown Texture Token Data}}
|
|-
|-
| 0x4D
| colspan=5 {{unknown|End of Layered Texture Data}}
| u32
|}
| 4
 
| {{unknown|'''Unknown'''}}
==== Type 5: Int4 Data ====
 
{| class="wikitable"
! Offset
! Type
! Count
! Name
! Notes
|-
|-
| 0x51
| 0x0
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x55
| u32
| u32
| 4
| 4
| {{unknown|'''Unknown'''}}
| '''Int4 Value'''
|
|-
|-
| 0x59
| [[TXTR (Tropical Freeze)|TXTR]]
| 0x10
| 0x10
| {{unknown|'''Unknown Texture ID'''}}
| colspan=4 {{unknown|End of Int4 Data}}
|-
| 0x69
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x6D
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x71
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x75
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x79
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x7D
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x81
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x85
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x89
| u32
| 4
| {{unknown|'''Unknown'''}}
|-
| 0x8D
| colspan=3 {{unknown|End of struct}}
|}
|}


==== Type 5: Unknown ====
==== Texture Usage Info ====


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Type
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| 0x0
| u32
| u32
| 4
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|Unknown}}
|
|-
|-
| 0x4
| 0x4
| u32
| u32
| 4
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|Unknown}}
|
|-
|-
| 0x8
| 0x8
| u32
| u32
| 4
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|Unknown}}
|
|-
|-
| 0xC
| 0xC
| u32
| u32
| 4
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|Unknown}}
|
|-
|-
| 0x10
| 0x10
| colspan=3 {{unknown|End of struct}}
| u32
| 1
| {{unknown|Unknown}}
|
|-
| 0x14
| colspan=4 {{unknown|End of Texture Usage Info}}
|}
|}


=== MESH ===
=== Meshes ===


The MESH section does what the name suggests: it defines submeshes. The MESH section header is as follows:
The MESH section does what the name suggests: it defines submeshes. The MESH section header is as follows:
Line 458: Line 372:
|}
|}


=== VBUF ===
=== Vertex Buffers ===


The VBUF section defines vertex buffers; each buffer can have different vertex types, with different strides and attributes.
The VBUF section defines vertex buffers; each buffer can have different vertex types, with different strides and attributes.
Line 534: Line 448:
|}
|}


=== IBUF ===
=== 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.
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.
Line 572: Line 486:
|}
|}


=== GPU ===
=== GPU Data ===


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 Compression|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.
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 Compression|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.
Anonymous user

Navigation menu