Filetype:MIP Texture Format

From Imagisphere
Jump to navigation Jump to search
Safety first!
This page is a work in progress. As a result, the layout and/or content herein may be subject to change.

About

MIP is the 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 to use the alpha information contained within the file.

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 alpha field of each entry does nothing if Alpha is set to 0 in the header, but the information is still there.

Color Entry
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.