CSKR (File Format) and TXTR (Metroid Prime): Difference between pages

From Retro Modding Wiki
(Difference between pages)
Jump to navigation Jump to search
>Embyr 75
m ({{research}})
 
>Aruki
(Created page with "'''TXTR''' is, as the name suggests, the Retro Studios texture format. It's identical from Metroid Prime all the way up to Donkey Kong Country Returns. __TOC__ == Structure...")
 
Line 1: Line 1:
The '''CSKR format''' contains skin bindings for rigged models. It attaches groups of vertices to bones. Note that any model being skinned needs to be exported at the same time as the skin; you can't skin a pre-existing model without modifying it. The reason is because the way the skin format works, the vertices with the same weights need to be grouped together in the model file.
'''TXTR''' is, as the name suggests, the Retro Studios texture format. It's identical from Metroid Prime all the way up to Donkey Kong Country Returns.


{{research|1|The only thing that isn't understood about this format is, why do some CSKR files contain all the vertex coordinates and normals? Also, what's the max number of bones that can be weighted to one vertex?}}
__TOC__


== Format ==
== Structure ==


CSKR is a very simple format. It begins with a 32-bit weight count, followed by a set of vertex groups. Each vertex group assigns a set of weights to a specified number of vertices; these vertices are specified simply through a count value, and are implied to begin after the end of the previous group. The total value of all the weights on all bones in a given vertex group should be 1.0.
TXTR files contain a very short 12-byte header, followed by the image data.


=== Vertex Group ===
=== Header ===


{| class="wikitable"
{| class="wikitable"
! Type
! Offset
! Count
! Size
! Description
! Description
|-
|-
| long
| 0x0
| 1
| 4
| '''Weight count''' (WC)
| '''Image format'''. Possible values range from 0x0 to 0xA; see below for more details.
|-
|-
| Weight
| 0x4
| WC
| 2
| '''Weights'''
| '''Width'''
|-
|-
| long
| 0x6
| 1
| 2
| '''Vertex count'''
| '''Height'''
|-
| 0x8
| 4
| '''Mipmap count'''
|}
|}


=== Weight ===
== Image Formats ==
 
There are 11 different image formats; these are built directly into GX, so they remain the same across all GameCube and Wii games. Rather than storing pixels in a linear left-to-right order, GX textures encode pixels in large blocks. The size of the block varies depending on the image format.
 
For example, suppose you have a format that stores 4x4 blocks. Pixels 1-4 of the image will make up the first row of the first block; pixels 5-8 will make up the second row; 9-12 will make up the third row; 13-16 will make up the fourth row, completing the block; and the 17-20 will begin the first row of the second block, appearing directly to the right of the first row of the first block.


{| class="wikitable"
{| class="wikitable"
! Type
! ID
! Count
! Name
! Bits per pixel
! Block size
! Description
! Description
|-
|-
| long
| 0x0
| 1
| I4
| Bone ID
| 4
| 8x8
| 4-bit greyscale intensity values. Two pixels per byte.
|-
|-
| float
| 0x1
| 1
| I8
| Weight
| 8
| 8x4
| 8-bit greyscale intensity values.
|-
| 0x2
| IA4
| 8
| 8x4
| 4-bit greyscale intensity values with an additional 4-bit alpha channel.
|-
| 0x3
| IA8
| 16
| 4x4
| 8-bit greyscale intensity values with an additional 8-bit alpha channel.
|-
| 0x4
| C4
| 4
| 8x8
| 4-bit palette indices.
|-
| 0x5
| C8
| 8
| 8x4
| 8-bit palette indices.
|-
| 0x6
| C14x2
| 16
| 4x4
| Another palette format. Not used by any official textures.
|-
| 0x7
| RGB565
| 16
| 4x4
| 16-bit colors without alpha.
|-
| 0x8
| RGB5A3
| 16
| 4x4
| 16-bit colors with alpha.
|-
| 0x9
| RGBA8
| 32
| 4x4
| Uncompressed 32-bit colors with alpha.
|-
| 0xA
| CMPR
| 4
| 8x8
| DXT1-compressed textures.
|}
|}


=== Footer ===
== External links ==
 
CSKR files contain a footer after all the weights are assigned. The structure is a little strange; it lists the vertex coordinate and vertex normal counts (which are often the same value). Usually each of these counts will be preceded by a value of 0xFFFFFFFF; however, if they're not, then the entire vertex coordinate/normal array from the model file will be inserted into the skin file. It's a byte-for-byte match with the data from the model. The purpose of this section is unknown.


[[Category:File Formats]]
* [http://wiki.tockdom.com/wiki/Image_Formats Custom Mario Kart Wiiki]: More detailed information on each format, and how to decode them.
[[Category:Metroid Prime]]
[[Category:Metroid Prime 2: Echoes]]
[[Category:Metroid Prime 3: Corruption]]
[[Category:Donkey Kong Country Returns]]

Revision as of 01:14, 23 January 2015

TXTR is, as the name suggests, the Retro Studios texture format. It's identical from Metroid Prime all the way up to Donkey Kong Country Returns.

Structure

TXTR files contain a very short 12-byte header, followed by the image data.

Header

Offset Size Description
0x0 4 Image format. Possible values range from 0x0 to 0xA; see below for more details.
0x4 2 Width
0x6 2 Height
0x8 4 Mipmap count

Image Formats

There are 11 different image formats; these are built directly into GX, so they remain the same across all GameCube and Wii games. Rather than storing pixels in a linear left-to-right order, GX textures encode pixels in large blocks. The size of the block varies depending on the image format.

For example, suppose you have a format that stores 4x4 blocks. Pixels 1-4 of the image will make up the first row of the first block; pixels 5-8 will make up the second row; 9-12 will make up the third row; 13-16 will make up the fourth row, completing the block; and the 17-20 will begin the first row of the second block, appearing directly to the right of the first row of the first block.

ID Name Bits per pixel Block size Description
0x0 I4 4 8x8 4-bit greyscale intensity values. Two pixels per byte.
0x1 I8 8 8x4 8-bit greyscale intensity values.
0x2 IA4 8 8x4 4-bit greyscale intensity values with an additional 4-bit alpha channel.
0x3 IA8 16 4x4 8-bit greyscale intensity values with an additional 8-bit alpha channel.
0x4 C4 4 8x8 4-bit palette indices.
0x5 C8 8 8x4 8-bit palette indices.
0x6 C14x2 16 4x4 Another palette format. Not used by any official textures.
0x7 RGB565 16 4x4 16-bit colors without alpha.
0x8 RGB5A3 16 4x4 16-bit colors with alpha.
0x9 RGBA8 32 4x4 Uncompressed 32-bit colors with alpha.
0xA CMPR 4 8x8 DXT1-compressed textures.

External links