BLP: Difference between revisions

From wowdev
Jump to navigation Jump to search
Line 21: Line 21:
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.
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
Detailed description of the DXTC formats can be found on MSDN or on Wikipedia (http://en.wikipedia.org/wiki/.BLP)


== Uncompressed textures ==
== Uncompressed textures ==

Revision as of 15:17, 19 April 2009

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)

Alpha channel bit depth = 4 are found in Interface\Glues\Credits\*.blp. Most BLP converters are not compatible with this.

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 or on Wikipedia (http://en.wikipedia.org/wiki/.BLP)

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.