CMDL (Donkey Kong Country Returns): Difference between revisions

Jump to navigation Jump to search
m
imported>Antidote
No edit summary
>Aruki
 
(12 intermediate revisions by 2 users not shown)
Line 3: Line 3:
The '''CMDL format''' is DKCR's model format. It's similar to the CMDL format found in the Metroid Prime trilogy, but with a lot of additions and changes, and some layout changes.
The '''CMDL format''' is DKCR's model format. It's similar to the CMDL format found in the Metroid Prime trilogy, but with a lot of additions and changes, and some layout changes.


{{todo|WIP, will finish soon}}
{{research|moderate|The visibility group data in the header has a lot of unknown values.}}
{{research|moderate|Where to begin? Materials need a lot of research (they're very similar if not the same as Metroid Prime 3). A lot of the visibility group data is unknown. The submesh headers contain a lot of unknowns, and the possible vertex format settings are unknown. Geometry should be split off into a separate article if it's confirmed that it's the same format that's used in MREA (which is fairly likely). Materials should also be split off once more is known about them.}}


__TOC__
__TOC__
Line 17: Line 16:
! Offset
! Offset
! Type
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| 0x0
| u32
| u16
| 4
| 1
| {{unknown|'''Unknown'''; always 0x9381000A - likely either magic value or 16-bit magic/version}}
| '''Magic'''
| Always <code>0x9381</code>
|-
| 0x2
| u16
| 1
| '''Version'''
| Always 0xA. See [[CMDL (File Format)|hub article]] for a list of possible version numbers.
|-
|-
| 0x4
| 0x4
| u32
| u32
| 4
| 1
| '''Flags'''; see blow
| '''Flags'''
| [[#Flags|See below]]
|-
|-
| 0x8
| 0x8
| float[6]
| float
| 0x18
| 6
| '''Model Bounding Box'''
| '''Model Bounding Box'''
|
|-
|-
| 0x20
| 0x20
| u32
| u32
| 4
| 1
| '''Section count''' (SC)
| '''Section Count'''
| Count of data sections in the file.
|-
|-
| 0x24
| 0x24
| u32
| u32
| 4
| 1
| '''Material set count'''
| '''Material Set Count'''
| Count of material sets in the model.
|-
|-
| 0x28
| 0x28
| -
| [[#Visibility Groups|Visibility Groups]]
| -
| 1
| '''Visibility group data'''; present if flag 0x10 is set. See below for structure.
| '''Visibility Group Data'''
| Only present if flag 0x10 is set.
|-
|-
| -
| {{none}}
| u32[]
| u32
| 4 &times; SC
| ''Section Count''
| '''Section sizes'''
| '''Section Sizes'''
|
|-
|-
| colspan=4 {{unknown|End of header; pad to multiple of 32 before first section starts}}
| colspan=5 {{unknown|End of header; pad to multiple of 32 before first section starts}}
|}
|}


Line 69: Line 82:
| 0
| 0
| 0x1
| 0x1
| {{unknown|Unknown}}
| Indicates the model is skinned
|-
|-
| 1
| 1
Line 94: Line 107:
==== Visibility Groups ====
==== Visibility Groups ====


This section is present in the header if bit 0x10 is set, after the material set count and before the section sizes.
Visibility group data is present in the header if bit 0x10 is set, after the material set count and before the section sizes. Visibility groups are used to toggle the visibility of certain surfaces on or off during animations; for instance, Diddy's jetpack is part of his model but doesn't render in most of his animations.


{| 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
| '''Visibility Group count'''
| '''Visibility Group Count'''
|}
|  
 
|-
The following structure repeats for each group:
| 0x8
 
| [[#Visibility Group Name|Visibility Group Name]]
{| class="wikitable"
| ''Visibility Group Count''
! Offset
| '''Visibility Group Name Array'''
! Type
|
! Size
! Description
|-
|-
| 0x0
| {{none}}
| u32
| u32
| 4
| 1
| '''Name length'''
| {{unknown|'''Unknown'''}}
|
|-
|-
| 0x4
| {{none}}
| string
| -
| '''Visibility Group name'''
|}
 
Finally, it ends with this before the sizes begin:
 
{| class="wikitable"
! Offset
! Type
! Size
! Description
|-
| 0x0
| u32
| u32
| 4
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|'''Unknown'''}}
|
|-
|-
| 0x4
| {{none}}
| u32
| u32
| 4
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|'''Unknown'''}}
|
|-
|-
| 0x8
| {{none}}
| u32
| u32
| 4
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|'''Unknown'''}}
|
|-
|-
| 0xC
| {{none}}
| u32
| u32
| 4
| 1
| {{unknown|'''Unknown'''}}
| {{unknown|'''Unknown'''}}
|
|}
===== Visibility Group Name =====
{| class="wikitable"
! Offset
! Type
! Count
! Name
! Notes
|-
|-
| 0x10
| 0x0
| u32
| u32
| 4
| 1
| {{unknown|'''Unknown'''}}
| '''Name Length'''
|
|-
| 0x4
| char
| ''Name Length''
| '''Visibility Group Name'''
| Zero-terminated.
|}
|}


=== Materials ===
=== Materials ===


There's not much known about the material format currently; DKCR seems to use the same material format as Metroid Prime 3. The main difference in DKCR compared to Prime 3 is that in Prime 3, each material set would get its own section. In DKCR, every material set is in the same section. Each material set begins with a material count, and each material begins with its own size. The main thing that's needed to read geometry is the vertex attribute flags, which are located at 0xC in the material structure (not counting the size).
''See [[Materials (Metroid Prime 3)]]''
 
DKCR uses the same material format as Metroid Prime 3, with the main differences being what pass types and UV animation modes are supported (a few have been added/removed). The only other significant difference in DKCR compared to Prime 3 is that in Prime 3, each material set would get its own section. In DKCR, every material set is in the same section. Each material set begins with a material count, and each material begins with its own size.
 
=== Geometry ===
 
''See [[Geometry (Donkey Kong Country Returns)]]''
 
[[Category:File Formats]]
[[Category:Donkey Kong Country Returns]]
[[Category:Donkey Kong Country Returns]]
Anonymous user

Navigation menu