Filetype:MIP Texture Format

From Imagisphere
Revision as of 20:33, 9 January 2024 by Beyley (talk | contribs) (Add basic information about the format)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 a texture format used in LittleBigPlanet Portable.

Format

A MIP file has no file magic, and can only be detected by 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. It is 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 "0" or "1", representing a boolean value of whether or not the image contains alpha.

Color Lookup Table

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.

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. The game expects the image data to be swizzled[2][3][4].

MIP files uploaded to the PSP UGC server are always flipped vertically.