DKRDS Model (File Format): Difference between revisions
(Created page with "{{under-construction}} '''DKRDS Model''' is the nameless file format used in ''[https://en.wikipedia.org/wiki/Diddy_Kong_Racing_DS Diddy Kong Racing DS]'' that stores models and textures. = File Format = The file byte order is always little endian. == Header == The file starts with a header that is 48 bytes long. {|class=wikitable ! Offset !! Type !! Description |- | 0x00 || Byte[8] || {{unknown-left|'''Unknown flags'''.}} |- | 0x08 || Int32 || '''Number of textures''...") |
mNo edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
'''DKRDS Model''' is the nameless file format used in ''[https://en.wikipedia.org/wiki/Diddy_Kong_Racing_DS Diddy Kong Racing DS]'' that stores models and textures. Its type identifier in [[assets.bin]] is '''0x18''', although it has also been seen in some '''0x00'''-type files. | |||
'''DKRDS Model''' is the nameless file format used in ''[https://en.wikipedia.org/wiki/Diddy_Kong_Racing_DS Diddy Kong Racing DS]'' that stores models and textures. | |||
= File Format = | = File Format = | ||
Line 6: | Line 5: | ||
== Header == | == Header == | ||
The file starts with a header that is 48 bytes long. | The file starts with a header that is 48 bytes long. Unused models that might use an older version of the format have been seen with a 44-byte long header. | ||
{|class=wikitable | {|class=wikitable | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
| 0x00 || | | 0x00 || UInt16 || '''Size flag'''. This flag indicates how much the vertex data is divided by in the short-to-float conversion: | ||
* 0 = Divided by 16 (?) | |||
* 1 = Divided by 4096 (?) | |||
|- | |- | ||
| | | 0x02 || UInt16 || {{unknown-left|'''Unknown various flags'''. Each bit seems to correspond to a different flag:}} | ||
* 0 = If 1, bone IDs are attached to each vertex | |||
|- | |- | ||
| | | 0x04 || UInt16 || '''Number of models''' ('''M'''). | ||
|- | |- | ||
| | | 0x06 || UInt16 || {{unknown-left|'''Unknown'''.}} | ||
|- | |- | ||
| 0x20 || Int32 || '''[[#Texture | | 0x08 || UInt16 || '''Number of textures'''. | ||
|- | |||
| 0x0A || UInt16 || {{unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x0C || Int32 || {{unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x10 || Byte[12] || {{unknown-left|'''Unknown'''. Padding? In earlier versions this would be an 8-byte padding instead}} | |||
|- | |||
| 0x1C || Int32 || '''[[#Model Group|Model Group]]''' offset. | |||
|- | |||
| 0x20 || Int32 || '''[[#Texture Group|Texture Group]]''' offset. | |||
|- | |- | ||
| 0x24 || Int32 || '''[[#Texture Reference Table|Texture Reference Table]]''' offset. | | 0x24 || Int32 || '''[[#Texture Reference Table|Texture Reference Table]]''' offset. | ||
|- | |- | ||
| 0x28 || Int32 || {{unknown-left|'''Unknown'''. | | 0x28 || Int32 || {{unknown-left|'''Unknown'''.}} | ||
|- | |- | ||
| 0x2C || Int32 || {{unknown-left|'''Unknown'''. | | 0x2C || Int32 || {{unknown-left|'''Unknown'''.}} | ||
|- | |- | ||
| 0x30 || colspan=2 {{unknown|End of header}} | | 0x30 || colspan=2 {{unknown|End of header}} | ||
|} | |} | ||
== Model | == Model Group == | ||
'' | The model group consists of '''M''' model entries. | ||
== | {|class=wikitable | ||
! Offset !! Type !! Description | |||
|- | |||
| 0x00 || Model Entry['''M'''] || '''Model entries'''. | |||
|} | |||
=== Model Entry === | |||
Each model entry starts with a 16-byte header. All offsets are relative to the start of this entry. | |||
{|class=wikitable | {|class=wikitable | ||
|+ Model Entry Header | |||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
| 0x00 | | 0x00 || UInt16 || '''Number of vertices''' ('''V'''). | ||
|- | |- | ||
| 0x02 || UInt16 | | | 0x02 || UInt16 || '''Number of triangles''' ('''T'''). | ||
|- | |- | ||
| 0x04 || colspan=2 {{unknown|End of | | 0x04 || Int32 || '''[[#Vertex Data|Vertex Data]]''' offset. | ||
|- | |||
| 0x08 || Int32 || '''[[#Triangle Data|Triangle Data]]''' offset. | |||
|- | |||
| 0x0C || UInt16 || {{unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x0E || UInt16 || {{unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x10 || colspan=2 {{unknown|End of header}} | |||
|} | |} | ||
=== | === Vertex Data === | ||
Vertex data is stored as either 6-byte or 8-byte groups per vertex '''V''', depending on the file header's flags. | |||
{|class=wikitable | {|class=wikitable | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
| 0x00 | | 0x00 || Vertex Entry['''V'''] || '''Vertex entries'''. | ||
|} | |||
{|class=wikitable | |||
|+ Vertex Entry | |||
! Offset !! Type !! Description | |||
|- | |- | ||
| | | 0x00 || Int16[3] || '''Vertex XYZ position'''. | ||
|- bgcolor="#AAFFAA" | |||
| colspan="4" align="center" | '''If [[#Header|Unknown various flag]] 0 = 1''' | |||
|- bgcolor="#DDFFDD" | |||
| 0x06 || UInt16 || '''Bone ID'''. | |||
|} | |||
=== Triangle Data === | |||
Triangle data is stored as 26-byte groups per triangle '''T'''. | |||
{|class=wikitable | |||
! Offset !! Type !! Description | |||
|- | |- | ||
| | | 0x00 || Triangle Entry['''T'''] || '''Triangle entries'''. | ||
|} | |||
{|class=wikitable | |||
|+ Triangle Entry | |||
! Offset !! Type !! Description | |||
| | |||
|- | |- | ||
| | | 0x00 || UInt16 || '''Texture ID'''. References the index from the [[#Texture Reference Table|Texture Reference Table]]. | ||
|- | |- | ||
| | | 0x02 || UInt16[3] || '''Vertex indices'''. | ||
|- | |- | ||
| | | 0x08 || UInt16[3] || '''Vertex colors'''. One per vertex, in RGBA5551 format. | ||
|- | |- | ||
| | | 0x0E || UInt16[2][3] || '''UVs'''. One set per vertex. | ||
|} | |} | ||
== Texture Group == | |||
See '''[[DKRDS Texture Group]]'''. | |||
== Texture Reference Table == | == Texture Reference Table == | ||
This section lists each 4-byte texture UID directly, in order. | This section lists each 4-byte texture UID directly, in order. The index of each reference is used in the model data to know which texture corresponds to which triangle. | ||
{|class=wikitable | |||
! Offset !! Type !! Description | |||
|- | |||
| 0x00 || Byte[4]['''Number of Textures in [[#Texture Group|Texture Group]]'''] || '''Texture UID'''. | |||
|} | |||
= Tools = | = Tools = |
Latest revision as of 13:58, 22 June 2024
DKRDS Model is the nameless file format used in Diddy Kong Racing DS that stores models and textures. Its type identifier in assets.bin is 0x18, although it has also been seen in some 0x00-type files.
File Format
The file byte order is always little endian.
Header
The file starts with a header that is 48 bytes long. Unused models that might use an older version of the format have been seen with a 44-byte long header.
Offset | Type | Description |
---|---|---|
0x00 | UInt16 | Size flag. This flag indicates how much the vertex data is divided by in the short-to-float conversion:
|
0x02 | UInt16 | Unknown various flags. Each bit seems to correspond to a different flag:
|
0x04 | UInt16 | Number of models (M). |
0x06 | UInt16 | Unknown. |
0x08 | UInt16 | Number of textures. |
0x0A | UInt16 | Unknown. |
0x0C | Int32 | Unknown. |
0x10 | Byte[12] | Unknown. Padding? In earlier versions this would be an 8-byte padding instead |
0x1C | Int32 | Model Group offset. |
0x20 | Int32 | Texture Group offset. |
0x24 | Int32 | Texture Reference Table offset. |
0x28 | Int32 | Unknown. |
0x2C | Int32 | Unknown. |
0x30 | End of header |
Model Group
The model group consists of M model entries.
Offset | Type | Description |
---|---|---|
0x00 | Model Entry[M] | Model entries. |
Model Entry
Each model entry starts with a 16-byte header. All offsets are relative to the start of this entry.
Offset | Type | Description |
---|---|---|
0x00 | UInt16 | Number of vertices (V). |
0x02 | UInt16 | Number of triangles (T). |
0x04 | Int32 | Vertex Data offset. |
0x08 | Int32 | Triangle Data offset. |
0x0C | UInt16 | Unknown. |
0x0E | UInt16 | Unknown. |
0x10 | End of header |
Vertex Data
Vertex data is stored as either 6-byte or 8-byte groups per vertex V, depending on the file header's flags.
Offset | Type | Description |
---|---|---|
0x00 | Vertex Entry[V] | Vertex entries. |
Offset | Type | Description | |
---|---|---|---|
0x00 | Int16[3] | Vertex XYZ position. | |
If Unknown various flag 0 = 1 | |||
0x06 | UInt16 | Bone ID. |
Triangle Data
Triangle data is stored as 26-byte groups per triangle T.
Offset | Type | Description |
---|---|---|
0x00 | Triangle Entry[T] | Triangle entries. |
Offset | Type | Description |
---|---|---|
0x00 | UInt16 | Texture ID. References the index from the Texture Reference Table. |
0x02 | UInt16[3] | Vertex indices. |
0x08 | UInt16[3] | Vertex colors. One per vertex, in RGBA5551 format. |
0x0E | UInt16[2][3] | UVs. One set per vertex. |
Texture Group
See DKRDS Texture Group.
Texture Reference Table
This section lists each 4-byte texture UID directly, in order. The index of each reference is used in the model data to know which texture corresponds to which triangle.
Offset | Type | Description |
---|---|---|
0x00 | Byte[4][Number of Textures in Texture Group] | Texture UID. |
Tools
The following tools can handle DKRDS Model:
- (none)