Difference between revisions of "FTEX (File Format)"
Jump to navigation
Jump to search
m (→Header (FTEX): That's not always that) |
|||
Line 1: | Line 1: | ||
− | {{Under-construction | + | {{Under-construction}} |
− | + | The '''FTEX''' texture format is a format for textures which appears as a subfile of a '''[[BFRES (File Format)|BFRES file]]'''. It appears in the '''1:st''' [[index group]] in a [[BFRES (File Format)|BFRES file]]. Unless otherwise noted, all offsets in the file are relative to themselves. | |
− | The '''FTEX''' texture format is a format for textures which appears as a subfile of a '''[[BFRES (File Format)|BFRES file]]'''. | ||
== Header (FTEX) == | == Header (FTEX) == | ||
+ | A FTEX file begins with an 0xC0 byte header that starts with the file identifier, followed by info about the image. | ||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
− | ! Offset | + | ! Offset !! Size !! Description |
− | ! Size | + | |- |
− | ! Description | + | | 0x00 || 4 || "'''FTEX'''" File identifier, ASCII string. |
+ | |- | ||
+ | | 0x04 || 4 || '''Dimension'''. Indicates the "shape" of a given surface or texture (see line 849 [http://pastebin.com/DCrP1w9x here]). | ||
+ | |- | ||
+ | | 0x08 || 4 || '''Texture Width'''. Width of the texture in pixels. | ||
|- | |- | ||
− | | | + | | 0x0C || 4 || '''Texture Height'''. Height of the texture in pixels. |
− | | 4 | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x10 || 4 || '''Depth'''. |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x14 || 4 || '''Number of Mipmaps'''. |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x18 || 4 || '''Texture Format'''. Go to line 589 on [http://pastebin.com/DCrP1w9x this page] for explanation and format values. |
− | | 4 | ||
− | | '''Texture | ||
|- | |- | ||
− | | | + | | 0x1C || 4 || '''AA Mode'''. Indicates the AA mode (number of samples) for the surface (see line 865 [http://pastebin.com/DCrP1w9x here]). |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x20 || 4 || '''Usage'''. Indicates how the given surface may be used (see line 823 [http://pastebin.com/DCrP1w9x here]). |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x24 || 4 || '''Data Length'''. Length of texture data in bytes. |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x28 || 4 || '''Data Pointer?''' |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x2C || 4 || '''Mipmaps Data Length'''. Length of mipmaps data in bytes. |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x30 || 4 || '''Mipmaps Pointer?''' |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x34 || 4 || '''Tile Mode'''. Indicates the desired tiling mode for the surface (see line 795 [http://pastebin.com/DCrP1w9x here]). |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x38 || 4 || '''Swizzle Value'''. |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x3C || 4 || '''Alignment'''. Always 512 * bytes per pixel. |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x40 || 4 || '''Pitch'''. |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x44 || 0x0D || '''Mip Offset'''. Offset for each mipmap? |
− | | | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x51 || 0x2B || Unknown. Mipmaps related. (Always 0 in textures with no mipmaps) |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x7C || 4 || '''Number of Mipmaps'''. Again... |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x80 || 4 || '''Unknown'''. Always 0. |
− | | | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x84 || 4 || '''Unknown'''. Always 1. |
− | | | ||
− | | Unknown. | ||
|- | |- | ||
− | | | + | | 0x88 || 4 || '''Unknown'''. |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0x8C || 0x1C || Unknown. |
− | | | ||
− | | Unknown | ||
|- | |- | ||
− | | | + | | 0xA8 || 4 || Offset to the '''name of this file'''. |
− | | 4 | ||
− | | | ||
|- | |- | ||
− | | | + | | 0xAC || 4 || Offset to the '''end of the [[BFRES (File Format)#String Table|string table]]'''. |
− | | 4 | ||
− | | | ||
|- | |- | ||
− | | | + | | 0xB0 || 4 || '''Data Offset'''. Offset to the texture data. |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0xB4 || 4 || '''Mipmap Offset'''. Offset to the mipmap texture data. |
− | | 4 | ||
− | | ''' | ||
|- | |- | ||
− | | | + | | 0xB8 || 4 || Offset to the '''[[#User Data|user data]]'''. |
− | | 4 | ||
− | | | ||
|- | |- | ||
− | | | + | | 0xBC || 2 || Number of '''[[#User Data|user data]]'''. |
− | | | ||
− | | | ||
|- | |- | ||
− | | 0xC0 | + | | 0xBE || 2 || '''Unknown'''. |
− | | colspan="2" {{Unknown|End of '''FTEX''' header}} | + | |- |
+ | | 0xC0 || colspan="2" {{Unknown|End of '''FTEX''' header}} | ||
|} | |} | ||
− | + | == Image Data == | |
+ | The image and mipmap data is not present after the header. It comes after the [[BFRES (File Format)#String Table|BFRES string table]] instead. This seems to be a caching optimization, since the CPU generally don't need to handle the image data. Instead it is sent directly to the GPU. | ||
+ | |||
+ | == User Data == | ||
+ | {{NW4F User Data}} | ||
[[Category:File Format]] | [[Category:File Format]] |
Revision as of 13:04, 2 May 2017
Under Construction
This article is not finished. Help improve it by adding accurate information or correcting grammar and spelling.
The FTEX texture format is a format for textures which appears as a subfile of a BFRES file. It appears in the 1:st index group in a BFRES file. Unless otherwise noted, all offsets in the file are relative to themselves.
Header (FTEX)
A FTEX file begins with an 0xC0 byte header that starts with the file identifier, followed by info about the image.
Offset | Size | Description |
---|---|---|
0x00 | 4 | "FTEX" File identifier, ASCII string. |
0x04 | 4 | Dimension. Indicates the "shape" of a given surface or texture (see line 849 here). |
0x08 | 4 | Texture Width. Width of the texture in pixels. |
0x0C | 4 | Texture Height. Height of the texture in pixels. |
0x10 | 4 | Depth. |
0x14 | 4 | Number of Mipmaps. |
0x18 | 4 | Texture Format. Go to line 589 on this page for explanation and format values. |
0x1C | 4 | AA Mode. Indicates the AA mode (number of samples) for the surface (see line 865 here). |
0x20 | 4 | Usage. Indicates how the given surface may be used (see line 823 here). |
0x24 | 4 | Data Length. Length of texture data in bytes. |
0x28 | 4 | Data Pointer? |
0x2C | 4 | Mipmaps Data Length. Length of mipmaps data in bytes. |
0x30 | 4 | Mipmaps Pointer? |
0x34 | 4 | Tile Mode. Indicates the desired tiling mode for the surface (see line 795 here). |
0x38 | 4 | Swizzle Value. |
0x3C | 4 | Alignment. Always 512 * bytes per pixel. |
0x40 | 4 | Pitch. |
0x44 | 0x0D | Mip Offset. Offset for each mipmap? |
0x51 | 0x2B | Unknown. Mipmaps related. (Always 0 in textures with no mipmaps) |
0x7C | 4 | Number of Mipmaps. Again... |
0x80 | 4 | Unknown. Always 0. |
0x84 | 4 | Unknown. Always 1. |
0x88 | 4 | Unknown. |
0x8C | 0x1C | Unknown. |
0xA8 | 4 | Offset to the name of this file. |
0xAC | 4 | Offset to the end of the string table. |
0xB0 | 4 | Data Offset. Offset to the texture data. |
0xB4 | 4 | Mipmap Offset. Offset to the mipmap texture data. |
0xB8 | 4 | Offset to the user data. |
0xBC | 2 | Number of user data. |
0xBE | 2 | Unknown. |
0xC0 | End of FTEX header |
Image Data
The image and mipmap data is not present after the header. It comes after the BFRES string table instead. This seems to be a caching optimization, since the CPU generally don't need to handle the image data. Instead it is sent directly to the GPU.