→Sample Files: Found two new strange textures.
(It's bgra, not argb) |
(→Sample Files: Found two new strange textures.) |
||
| Line 8: | Line 8: | ||
uint32_t type; // Texture type: 0 = JPG, 1 = S3TC | uint32_t type; // Texture type: 0 = JPG, 1 = S3TC | ||
uint8_t compression; // Compression mode: 1 = raw, 2 = DXTC | uint8_t compression; // Compression mode: 1 = raw, 2 = DXTC | ||
uint8_t alpha_bits; // 0, 1, or 8 | uint8_t alpha_bits; // 0, 1, 4, or 8 | ||
uint8_t alpha_type; // 0, 1, 7 or 8 | uint8_t alpha_type; // 0, 1, 7, or 8 | ||
uint8_t has_mips; // 0 = no mips levels, 1 = has mips (number of levels determined by image size) | uint8_t has_mips; // 0 = no mips levels, 1 = has mips (number of levels determined by image size) | ||
uint32_t width; // Image width in pixels | uint32_t width; // Image width in pixels | ||
| Line 23: | Line 23: | ||
=== RAW compression === | === RAW compression === | ||
If | If <tt>compression</tt> is set to 1, each mipmap is stored as an array of 8-bit values, one per pixel, left to right, top to bottom. Each value is an index to the palette. | ||
If <tt>alpha-depth</tt> is greater than 0, an alpha channel will immediately follow the image data, and comes in 1, 4, and 8 bit varieties. The 1 and 4 bit versions have multiple values packed into a single byte, with the least significant bit belonging to the first packed value. | |||
If | |||
With the <tt>compression</tt> set to 3, each mipmap contains raw color data. There is only one known image using this format, and had 32 bit BGRA pixels with <tt>alpha-depth</tt> set to 8. One might infer that with <tt>alpha-depth</tt> set to 0 the image would use 24 bit BGR pixels, but no such example exists. | |||
=== | === DXTn compression === | ||
=== DXT2 and DXT4 === | If <tt>compression</tt> is set to 2, each mipmap is composed of 4×4 blocks of pixels. The blocks and the pixels within each block are ordered from left to right, top to bottom. | ||
DXT2 and DXT4 are identical to DXT3 and DXT5, respectively, save that pixel data winds up being premultiplied by alpha | |||
See [[Wikipedia:S3TC|Wikipedia's entry on DXT compression]] for the technical details. | |||
==== DXT1 ==== | |||
If <tt>alpha_bits</tt> is set to 0, DXT1 compression is used. | |||
Each block is 64 bits and begins with two 16 bit values, and are used to derived a 4 color palette. | |||
The values are interpreted as 565 RGB colors, with the least significant bits corresponding to blue, to create the first two colors in the palette. | |||
If the first value is less than or equal to the second, the final entry of the palette is reserved for black. | |||
The remaining colors are created by interpolating between the first two colors in the palette. | |||
The remaining 32 bits are 16 2-bit values acting as a lookups to specify the colors in the block. | |||
==== DXT1a ==== | |||
If <tt>alpha_bits</tt> is set to 1, DXT1a compression is used. | |||
Each block is 64 bits and is identical to DXT1, except that transparent is reserved in the palette instead of black. | |||
==== DXT3 ==== | |||
If <tt>alpha_bits</tt> is set to 4 or 8, and <tt>alpha_type</tt> is 0, 1, or 8, then DXT3 compression is used. | |||
Each block is 128 bits and begins identically to DXT1, except that no special color is reserved in the palette. | |||
It is followed by 16 4-bit values corresponding to the alpha values for each of the pixels in the block. | |||
==== DXT5 ==== | |||
If <tt>alpha_type</tt> is 7, then DXT5 compression is used. This format was first used for Burning Crusade images. | |||
Each block is 128 bits and begins with two 8-bit values to create an 8 element lookup table for alpha values. | |||
The first two elements in the lookup table are copies of those values. | |||
If the first value is less than or equal to the second, the final two entries of the lookup table are reserved for transparent and opaque. | |||
The remaining entries are created by interpolating between the first two entries in the lookup table. | |||
The next 48 bits make up 16 3-bit values acting as lookups specifying the alpha values for each of the pixels in the block. | |||
The remaining 64 bits are identical to DXT1, except that no special color is reserved in the palette. | |||
==== DXT2 and DXT4 ==== | |||
DXT2 and DXT4 are identical to DXT3 and DXT5, respectively, save that pixel data winds up being premultiplied by alpha -- that is, each RGBA pixel is not represented by (r, g, b, a) but instead by (ar, ag, ab, a) where all values are normalised to lie between 0 and 1. World of Warcraft does not use these formats. | |||
=== Sample Files === | === Sample Files === | ||
Below is a list of BLP files, each with some unique characteristic. | |||
{| class="darktable" | {| class="darktable" | ||
! File !! Encoding | ! File !! Encoding !! Features | ||
|- | |||
| GLUES\LoadingBar\Loading-BarGlow.blp || RAW1 || No alpha | |||
|- | |||
| Interface\CURSOR\Attack.blp || RAW1 || 1-bit alpha | |||
|- | |- | ||
| | | Interface\CURSOR\Buy.blp || RAW1 || 8-bit alpha | ||
|- | |||
| Icons\Trade_Alchemy.blp || DXT1 || No alpha | |||
|- | |||
| AuctionFrame\BuyoutIcon.blp || DXT1 || 1-bit alpha | |||
|- | |||
| Icons\INV_Fishingpole_02.blp || DXT3 || 4-bit alpha | |||
|- | |||
| Icons\Ability_Rogue_Shadowstep.blp || DXT5 || 8-bit alpha | |||
|- | |||
| BUTTONS\UI-PaidCharacterCustomization-Button.blp || RAW3 || BGRA color | |||
|} | |||
The following files require an MPQ viewer to access, as they aren't exposed by Blizzard's [http://us.blizzard.com/support/article.xml?locale=en_US&articleId=21466 AddOn Kit]. | |||
{| class="darktable" | |||
! File !! Encoding !! Features | |||
|- | |- | ||
| | | Character\Tauren\Female\TAURENFEMALESKIN00_01_EXTRA.blp || RAW1 || 4-bit alpha | ||
|- | |- | ||
| | | Environments\Stars\HellFireSkyNebula03.blp || DXT5 || No alpha | ||
|- | |- | ||
| | | Textures\SunGlare.blp || RAW3 || alpha_bits=136 | ||
|- | |- | ||
| | | TILESET\Terrain Cube Maps\oilslickenvA.blp || RAW3 || alpha_bits=1, width=768 | ||
|} | |} | ||
=== Conversion Tools === | === Conversion Tools === | ||
There exist BLP tools to convert both from and to the BLP format. They can be found in the UI Authors resource list: http://www.wowwiki.com/UI_FAQ/AddOn_Author_Resources#Resources | There exist BLP tools to convert both from and to the BLP format. They can be found in the UI Authors resource list: http://www.wowwiki.com/UI_FAQ/AddOn_Author_Resources#Resources | ||