TXTR (Tropical Freeze): Difference between revisions

From Retro Modding Wiki
Jump to navigation Jump to search
>Aruki
No edit summary
>Aruki
No edit summary
Line 14: Line 14:
! Offset
! Offset
! Type
! Type
! Size
! Count
! Description
! Name
! Notes
! Notes
|-
|-
| 0x0
| 0x0
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]
| 0x18
| 1
| '''HEAD Chunk Descriptor'''
| '''HEAD Chunk Descriptor'''
|  
|  
Line 26: Line 26:
| 0x18
| 0x18
| u32
| u32
| 4
| 1
| {{unknown|Unknown}}
| [[#Texture Type|'''Texture Type''']]
|  
|  
|-
|-
| 0x1C
| 0x1C
| u32
| u32
| 4
| 1
| '''Image Format'''
| [[#Texture Format|'''Texture Format''']]
|  
|  
|-
|-
| 0x20
| 0x20
| u32
| u32
| 4
| 1
| '''Width'''
| '''Width'''
|  
|  
Line 44: Line 44:
| 0x24
| 0x24
| u32
| u32
| 4
| 1
| '''Height'''
| '''Height'''
|  
|  
Line 50: Line 50:
| 0x28
| 0x28
| u32
| u32
| 4
| 1
| '''Depth'''
| '''Depth'''
|  
|  
Line 56: Line 56:
| 0x2C
| 0x2C
| u32
| u32
| 4
| 1
| {{unknown|Unknown}}
| {{unknown|Unknown}}
|  
|  
Line 62: Line 62:
| 0x30
| 0x30
| u32
| u32
| 4
| 1
| '''Swizzle'''
| '''Swizzle'''
|  
|  
Line 68: Line 68:
| 0x34
| 0x34
| u32
| u32
| 4
| 1
| {{unknown|Unknown}}
| '''Mipmap Count'''
| Mipmap count? (MC)
|  
|-
|-
| 0x38
| 0x38
| u32[MC]
| u32
| 4 × MC
| ''Mipmap Count''
| {{unknown|Unknown array}}
| {{unknown|Unknown array}}
| Appears to be mipmap sizes, but it doesn't match the size of the image data (unless there's 1)...
| Appears to be mipmap sizes, but it doesn't match the size of the image data (unless there's 1)...
|-
|-
| -
| {{none}}
| u32
| u32
| 4
| 1
| {{unknown|Unknown}}
| {{unknown|Unknown}}
|  
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)
|-
|-
| -
| {{none}}
| u8
| u8
| 1
| 1
| {{unknown|Unknown}}
| [[#Texture Filter|'''Texture Filter''']]
|  
|  
|-
|-
| -
| {{none}}
| u8
| u8
| 1
| 1
| {{unknown|Unknown}}
| [[#Texture Wrap|'''Texture Wraps X''']]
|  
|  
|-
|-
| -
| {{none}}
| u8
| u8
| 1
| 1
| {{unknown|Unknown}}
| [[#Texture Wrap|'''Texture Wrap Y''']]
|  
|  
|-
|-
| -
| {{none}}
| u8
| u8
| 1
| 1
| {{unknown|Unknown}}
| [[#Texture Wrap|'''Texture Wrap Z''']]
|  
|  
|}
|}


== Image Formats ==
=== Texture Type ===
 
This enum basically maps directly to a GX2SurfaceDim enum.


{| class="wikitable"
{| class="wikitable"
! ID
! ID
! Name
! GX2SurfaceType
|-
| 0
| GX2_SURFACE_DIM_1D
|-
| 1
| GX2_SURFACE_DIM_2D
|-
| 2
| GX2_SURFACE_DIM_3D
|-
| 3
| GX2_SURFACE_DIM_CUBE
|-
| 4
| GX2_SURFACE_DIM_1D_ARRAY
|-
| 5
| GX2_SURFACE_DIM_2D_ARRAY
|-
| 6
| GX2_SURFACE_DIM_2D_MSAA
|-
| 7
| GX2_SURFACE_DIM_2D_MSAA_ARRAY
|}
 
=== Texture Format ===
 
{| class="wikitable"
! ID
! GX2SurfaceFormat
|-
| 0x00
| GX2_SURFACE_FORMAT_TC_R8_UNORM
|-
| 0x01
| GX2_SURFACE_FORMAT_TC_R8_SNORM
|-
| 0x02
| GX2_SURFACE_FORMAT_TC_R8_UINT
|-
| 0x03
| GX2_SURFACE_FORMAT_TC_R8_SINT
|-
| 0x04
| GX2_SURFACE_FORMAT_TCD_R16_UNORM
|-
| 0x05
| GX2_SURFACE_FORMAT_TC_R16_SNORM
|-
| 0x06
| GX2_SURFACE_FORMAT_TC_R16_UINT
|-
| 0x07
| GX2_SURFACE_FORMAT_TC_R16_SINT
|-
| 0x08
| GX2_SURFACE_FORMAT_TC_R16_FLOAT
|-
| 0x09
| GX2_SURFACE_FORMAT_TC_R32_UINT
|-
| 0x0A
| GX2_SURFACE_FORMAT_TC_R32_SINT
|-
| 0x0B
| GX2_SURFACE_FORMAT_INVALID
|-
| 0x0C
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM
|-
| 0x0D
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB
|-
| 0x0E
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT
|-
| 0x0F
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT
|-
| 0x10
| GX2_SURFACE_FORMAT_TCD_R16_UNORM
|-
| 0x11
| GX2_SURFACE_FORMAT_TCD_R16_UNORM
|-
| 0x12
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM
|-
|-
| 0xC
| 0x13
| RGBA8888
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT
|-
|-
| 0x14
| 0x14
| DXT1
| GX2_SURFACE_FORMAT_T_BC1_UNORM
|-
| 0x15
| GX2_SURFACE_FORMAT_T_BC1_SRGB
|-
| 0x16
| GX2_SURFACE_FORMAT_T_BC2_UNORM
|-
| 0x17
| GX2_SURFACE_FORMAT_T_BC2_SRGB
|-
|-
| 0x18
| 0x18
| DXT5
| GX2_SURFACE_FORMAT_T_BC3_UNORM
|-
| 0x19
| GX2_SURFACE_FORMAT_T_BC3_SRGB
|-
| 0x1A
| GX2_SURFACE_FORMAT_T_BC4_UNORM
|-
| 0x1B
| GX2_SURFACE_FORMAT_T_BC4_SNORM
|-
|-
| 0x1C
| 0x1C
| ATI2
| GX2_SURFACE_FORMAT_T_BC5_UNORM
|-
| 0x1D
| GX2_SURFACE_FORMAT_T_BC5_SNORM
|-
| 0x1E
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT
|-
| 0x1F
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT
|-
| 0x20
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT
|-
| 0x21
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM
|}
 
=== Texture Filter ===
 
Invalid values default to 1 (linear).
 
{| class="wikitable"
! ID
! GX2TexMipFilterType
|-
| 0
| GX2_TEX_MIP_FILTER_POINT
|-
| 1
| GX2_TEX_MIP_FILTER_LINEAR
|}
 
=== Texture Wrap ===
 
Invalid values default to 0 (clamp).
 
{| class="wikitable"
! ID
! GX2TexClamp
|-
| 0
| GX2_TEX_CLAMP_CLAMP
|-
| 1
| GX2_TEX_CLAMP_WRAP
|-
| 2
| GX2_TEX_CLAMP_MIRROR
|-
| 3
| GX2_TEX_CLAMP_MIRROR_ONCE
|}
|}


Line 135: Line 294:
! Offset
! Offset
! Type
! Type
! Size
! Count
! Description
! Name
! Notes
! Notes
|-
|-
| 0x0
| 0x0
| u32
| u32
| 4
| 1
| {{unknown|Unknown}}
| {{unknown|Unknown}}
|  
|  
Line 147: Line 306:
| 0x4
| 0x4
| u32
| u32
| 4
| 1
| {{unknown|Unknown}}
| {{unknown|Unknown}}
|  
|  
Line 153: Line 312:
| 0x8
| 0x8
| u32
| u32
| 4
| 1
| '''GPU section offset'''
| '''GPU Section Offset'''
| Relative to the start of the file
| Relative to the start of the file
|-
|-
| 0xC
| 0xC
| u32
| u32
| 4
| 1
| {{unknown|Unknown}}
| {{unknown|Unknown}}
|  
|  
Line 165: Line 324:
| 0x10
| 0x10
| u32
| u32
| 4
| 1
| '''GPU data start'''
| '''GPU Data Start'''
| This is the offset to the start of the GPU data, immediately after the GPU section header.
| This is the offset to the start of the GPU data, immediately after the GPU section header.
|-
|-
| 0x14
| 0x14
| u32
| u32
| 4
| 1
| '''GPU section size'''
| '''GPU Section Size'''
| Matches the size from the GPU section header.
| Matches the size from the GPU section header.
|-
|-
| 0x18
| 0x18
| u32
| u32
| 4
| 1
| '''Compressed buffer count''' (BC)
| '''Compressed Buffer Count'''
|  
|  
|-
|-
| 0x1C
| 0x1C
| [[#Compressed Buffer|Compressed Buffer]][BC]
| [[#Compressed Buffer|Compressed Buffer]]
| 0xC × BC
| ''Compressed Buffer Count''
| '''Compressed buffer metadata'''
| '''Compressed Buffer Array'''
|  
|  
|}
|}
Line 195: Line 354:
! Offset
! Offset
! Type
! Type
! Description
! Name
! Notes
! Notes
|-
|-

Revision as of 16:54, 26 November 2017

See TXTR (File Format) for the other revisions of this format.

The TXTR format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using LZSS compression.


This file format needs a lot of research
Most everything in the header + image compression formats needs to be cracked + documented.


Format

The format starts with the typical form descriptor found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:

Offset Type Count Name Notes
0x0 Chunk Descriptor 1 HEAD Chunk Descriptor
0x18 u32 1 Texture Type
0x1C u32 1 Texture Format
0x20 u32 1 Width
0x24 u32 1 Height
0x28 u32 1 Depth
0x2C u32 1 Unknown
0x30 u32 1 Swizzle
0x34 u32 1 Mipmap Count
0x38 u32 Mipmap Count Unknown array Appears to be mipmap sizes, but it doesn't match the size of the image data (unless there's 1)...
u32 1 Unknown This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)
u8 1 Texture Filter
u8 1 Texture Wraps X
u8 1 Texture Wrap Y
u8 1 Texture Wrap Z

Texture Type

This enum basically maps directly to a GX2SurfaceDim enum.

ID GX2SurfaceType
0 GX2_SURFACE_DIM_1D
1 GX2_SURFACE_DIM_2D
2 GX2_SURFACE_DIM_3D
3 GX2_SURFACE_DIM_CUBE
4 GX2_SURFACE_DIM_1D_ARRAY
5 GX2_SURFACE_DIM_2D_ARRAY
6 GX2_SURFACE_DIM_2D_MSAA
7 GX2_SURFACE_DIM_2D_MSAA_ARRAY

Texture Format

ID GX2SurfaceFormat
0x00 GX2_SURFACE_FORMAT_TC_R8_UNORM
0x01 GX2_SURFACE_FORMAT_TC_R8_SNORM
0x02 GX2_SURFACE_FORMAT_TC_R8_UINT
0x03 GX2_SURFACE_FORMAT_TC_R8_SINT
0x04 GX2_SURFACE_FORMAT_TCD_R16_UNORM
0x05 GX2_SURFACE_FORMAT_TC_R16_SNORM
0x06 GX2_SURFACE_FORMAT_TC_R16_UINT
0x07 GX2_SURFACE_FORMAT_TC_R16_SINT
0x08 GX2_SURFACE_FORMAT_TC_R16_FLOAT
0x09 GX2_SURFACE_FORMAT_TC_R32_UINT
0x0A GX2_SURFACE_FORMAT_TC_R32_SINT
0x0B GX2_SURFACE_FORMAT_INVALID
0x0C GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM
0x0D GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB
0x0E GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT
0x0F GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT
0x10 GX2_SURFACE_FORMAT_TCD_R16_UNORM
0x11 GX2_SURFACE_FORMAT_TCD_R16_UNORM
0x12 GX2_SURFACE_FORMAT_D_D24_S8_UNORM
0x13 GX2_SURFACE_FORMAT_TCD_R32_FLOAT
0x14 GX2_SURFACE_FORMAT_T_BC1_UNORM
0x15 GX2_SURFACE_FORMAT_T_BC1_SRGB
0x16 GX2_SURFACE_FORMAT_T_BC2_UNORM
0x17 GX2_SURFACE_FORMAT_T_BC2_SRGB
0x18 GX2_SURFACE_FORMAT_T_BC3_UNORM
0x19 GX2_SURFACE_FORMAT_T_BC3_SRGB
0x1A GX2_SURFACE_FORMAT_T_BC4_UNORM
0x1B GX2_SURFACE_FORMAT_T_BC4_SNORM
0x1C GX2_SURFACE_FORMAT_T_BC5_UNORM
0x1D GX2_SURFACE_FORMAT_T_BC5_SNORM
0x1E GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT
0x1F GX2_SURFACE_FORMAT_TCD_R32_FLOAT
0x20 GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT
0x21 GX2_SURFACE_FORMAT_TC_R8_G8_UNORM

Texture Filter

Invalid values default to 1 (linear).

ID GX2TexMipFilterType
0 GX2_TEX_MIP_FILTER_POINT
1 GX2_TEX_MIP_FILTER_LINEAR

Texture Wrap

Invalid values default to 0 (clamp).

ID GX2TexClamp
0 GX2_TEX_CLAMP_CLAMP
1 GX2_TEX_CLAMP_WRAP
2 GX2_TEX_CLAMP_MIRROR
3 GX2_TEX_CLAMP_MIRROR_ONCE

PAK Metadata

The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.

Offset Type Count Name Notes
0x0 u32 1 Unknown
0x4 u32 1 Unknown
0x8 u32 1 GPU Section Offset Relative to the start of the file
0xC u32 1 Unknown
0x10 u32 1 GPU Data Start This is the offset to the start of the GPU data, immediately after the GPU section header.
0x14 u32 1 GPU Section Size Matches the size from the GPU section header.
0x18 u32 1 Compressed Buffer Count
0x1C Compressed Buffer Compressed Buffer Count Compressed Buffer Array

Compressed Buffer

This is a small struct that defines a compressed data buffer within the GPU section.

Offset Type Name Notes
0x0 u32 Decompressed Size
0x4 u32 Compressed Size
0x8 u32 Offset Relative to after the GPU section header