BLP

From wowdev
Revision as of 01:36, 21 July 2007 by Malu05 (talk | contribs) (New page: = BLP Files = BLP files store textures with precalculated mipmaps. Most of the textures are compressed with DXTC, except for a few palettized detail textures. == Header == '''Offset ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

BLP Files

BLP files store textures with precalculated mipmaps. Most of the textures are compressed with DXTC, except for a few palettized detail textures.


Header

Offset 	Type 	Description
0x00 	char[4] 	always 'BLP2'
0x04 	uint32 	Version, always 1
0x08 	uint8 	Compression: 1 for uncompressed, 2 for DXTC
0x09 	uint8 	Alpha channel bit depth: 0, 1 or 8
0x0A 	uint8 	Something about alpha? (compressed, alpha:0 or 1): 0, (compressed, alpha:8): 1, uncompressed: 2,4 or 8 (mostly 8)
0x0B 	uint8 	when 0 there is only 1 mipmaplevel. compressed: 0, 1 or 2, uncompressed: 1 or 2 (mostly 1)
0x0C 	uint32 	X resolution (power of 2)
0x10 	uint32 	Y resolution (power of 2)
0x14 	uint32[16] 	offsets for every mipmap level (or 0 when there is no more mipmap level)
0x54 	uint32[16] 	sizes for every mipmap level (or 0 when there is no more mipmap level)


Compressed textures

For compressed textures, DXT1 or DXT3 (possibly DXT5 depending on the header values) data follows, for every mipmap level. Unused mipmap levels have an offset and size of 0.

Detailed description of the DXTC formats can be found on MSDN


Uncompressed textures

After the header, 256 32-bit BGRA values make up the palette. The image data (for each mipmap level) consists of 8-bit indices into this palette.

If there is an alpha channel, then transparency data follows the image data in each mipmap level. If the Alpha bit depth is 0, there is no alpha channel. If the Alpha bit depth is 1, the alpha data is 8 alpha bits backed into each byte. If the Alpha big depth is 8, there is one byte per alpha value.