BLP: Difference between revisions
Hamunaptra (talk | contribs) |
No edit summary |
||
Line 1: | Line 1: | ||
BLP files store textures with precalculated mipmaps. | BLP files store textures with precalculated mipmaps. | ||
BLP files are capable of storing data with a few different formats. The primary variables are palettized/RGB and alpha bit depth. The RGB formats are actually stored using DXT compression (DXT1 for 0-bit alpha and DXT3 for the others), and thus conversion to these formats is somewhat lossy. Here is a list (with my shorthand for the format in parenthesis): | |||
Palettized, 0-bit alpha (P0) - Example: character skins, clothing. | |||
Palettized, 1-bit alpha (P1) - Example:. clothing (relatively rare). | |||
Palettized, 8-bit alpha (P8) - Example: clothing. | |||
RGB, 0-bit alpha (RGB0) - Example: Sansamroot.blp. | |||
RGB, 1-bit alpha (RGB1) - Example: Peaceflower.blp. | |||
RGB, 8-bit alpha (RGB8) - Example: Sungrass.blp. | |||
''From BLPConverter.rtf'' | |||
== Header == | == Header == |
Revision as of 20:25, 18 November 2009
BLP files store textures with precalculated mipmaps. BLP files are capable of storing data with a few different formats. The primary variables are palettized/RGB and alpha bit depth. The RGB formats are actually stored using DXT compression (DXT1 for 0-bit alpha and DXT3 for the others), and thus conversion to these formats is somewhat lossy. Here is a list (with my shorthand for the format in parenthesis):
Palettized, 0-bit alpha (P0) - Example: character skins, clothing.
Palettized, 1-bit alpha (P1) - Example:. clothing (relatively rare).
Palettized, 8-bit alpha (P8) - Example: clothing.
RGB, 0-bit alpha (RGB0) - Example: Sansamroot.blp.
RGB, 1-bit alpha (RGB1) - Example: Peaceflower.blp.
RGB, 8-bit alpha (RGB8) - Example: Sungrass.blp.
From BLPConverter.rtf
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.