Filetype:MIP Texture Format: Difference between revisions
(Add basic information about the format) |
m (Grammar pass) |
||
Line 4: | Line 4: | ||
==Format== | ==Format== | ||
A MIP file has no file magic, and can only be detected by heuristics. It is stored within an [[Encrypted PSP Container]]. | A MIP file has no file magic, and can only be detected by blindly reading the header and performing some heuristics. It is stored within an [[Encrypted PSP Container]]. | ||
=== Header<sup>[https://github.com/LittleBigRefresh/Refresh/blob/eae66b71158531f07a37dbacbabe79b6ff692348/Refresh.GameServer/Importing/Mip/MipHeader.cs]</sup> === | === Header<sup>[https://github.com/LittleBigRefresh/Refresh/blob/eae66b71158531f07a37dbacbabe79b6ff692348/Refresh.GameServer/Importing/Mip/MipHeader.cs]</sup> === | ||
Line 28: | Line 28: | ||
|} | |} | ||
Only 4bpp and 8bpp are known to be valid. It is unknown what Number of Blocks and Texture mode are used for | Only '4bpp' and '8bpp' are known to be valid bits per pixel values. It is currently unknown what 'Number of Blocks' and 'Texture mode' are used for. They can be ignored when reading and set to '2' and '1' respectively when writing. Alpha is either '0' or '1', representing a boolean value of whether or not the image contains alpha. | ||
=== Color Lookup Table === | === Color Lookup Table (CLUT) === | ||
The Color Lookup Table is a 16 (if 4bpp) or 256 (if 8bpp) entry table containing all the colors used in the image. Each entry is 4 bytes wide, using a simple RGBA8888 layout. Each entry is tightly packed. It is located at the offset specified in the header. | The Color Lookup Table is a 16 (if 4bpp) or 256 (if 8bpp) entry table containing all the colors used in the image. Each entry is 4 bytes wide, using a simple RGBA8888 layout. Each entry is tightly packed. It is located at the offset specified in the header. | ||
Line 49: | Line 49: | ||
=== Image Data === | === Image Data === | ||
Image data is stored uncompressed in the file at the offset specified in the header. In an 8bpp file, every byte is an index into the color lookup table, representing a single pixel. In a 4bpp file, every byte represents a two pixel horizontal strip, with the 4 least significant bits representing the color lookup table offset for the leftmost pixel, and the most significant 4 bits representing the color lookup table offset for the rightmost pixel | Image data is stored uncompressed in the file at the offset specified in the header. In an 8bpp file, every byte is an index into the color lookup table, representing a single pixel. In a 4bpp file, every byte represents a two pixel horizontal strip, with the 4 least significant bits representing the color lookup table offset for the leftmost pixel, and the most significant 4 bits representing the color lookup table offset for the rightmost pixel. | ||
MIP files uploaded to the | In all cases, the game expects the image data to be swizzled<sup>[http://homebrew.pixelbath.com/wiki/PSP_texture_swizzling]</sup><sup>[https://github.com/LittleBigRefresh/Refresh/blob/eae66b71158531f07a37dbacbabe79b6ff692348/Refresh.GameServer/Importing/Mip/MipDecoder.cs#L29]</sup><sup>[https://github.com/ennuo/lbparc/blob/16ad36aa7f4eae2f7b406829e604082750f16fe1/src/resources/texture.js#L6]</sup>. | ||
MIP files uploaded to the game server are always flipped vertically. | |||
[[Category:File Formats|I]] | [[Category:File Formats|I]] | ||
[[Category:LittleBigPlanet (PlayStation Portable) File Formats|I]] | [[Category:LittleBigPlanet (PlayStation Portable) File Formats|I]] |
Revision as of 21:43, 9 January 2024
This page is a work in progress. As a result, the layout and/or content herein may be subject to change. |
About
MIP is a texture format used in LittleBigPlanet Portable.
Format
A MIP file has no file magic, and can only be detected by blindly reading the header and performing some heuristics. It is stored within an Encrypted PSP Container.
Header[1]
Offset | Name | Data Type |
---|---|---|
0x00 | Color Lookup Table Offset | u32 |
0x04 | Image Width | u32 |
0x08 | Image Height | u32 |
0x0C | Bits per pixel | u8 |
0x0D | Number of Blocks | u8 |
0x0E | Texture mode | u8 |
0x0F | Alpha | u8 |
0x10 | Data Offset | u32 |
Only '4bpp' and '8bpp' are known to be valid bits per pixel values. It is currently unknown what 'Number of Blocks' and 'Texture mode' are used for. They can be ignored when reading and set to '2' and '1' respectively when writing. Alpha is either '0' or '1', representing a boolean value of whether or not the image contains alpha.
Color Lookup Table (CLUT)
The Color Lookup Table is a 16 (if 4bpp) or 256 (if 8bpp) entry table containing all the colors used in the image. Each entry is 4 bytes wide, using a simple RGBA8888 layout. Each entry is tightly packed. It is located at the offset specified in the header.
Name | Data Type |
---|---|
R | u8 |
G | u8 |
B | u8 |
A | u8 |
Image Data
Image data is stored uncompressed in the file at the offset specified in the header. In an 8bpp file, every byte is an index into the color lookup table, representing a single pixel. In a 4bpp file, every byte represents a two pixel horizontal strip, with the 4 least significant bits representing the color lookup table offset for the leftmost pixel, and the most significant 4 bits representing the color lookup table offset for the rightmost pixel.
In all cases, the game expects the image data to be swizzled[2][3][4].
MIP files uploaded to the game server are always flipped vertically.