Correct alpha_type for DXT5
(Correct alpha_type for DXT5) |
|||
| Line 1: | Line 1: | ||
{{uiaddon}} | {{uiaddon}}A [[BLP file]] is a texture file format known to be used for games, including many Blizzard games such as ''World of Warcraft''. | ||
A [[BLP file]] is a texture file format known to be used for games, including many Blizzard games such as ''World of Warcraft''. | |||
The BLP file structure consists of a header including the palette, and up to 16 pre-rendered 'mipmaps'. Texture sizes must be powers of two, though the two dimensions do not have to be equal; 512x256 is valid, but 512x200 is not. The first mipmap ('mipmap' level 0) is the full size image; each subsequent mipmap halves both dimensions. The final 'mipmap' should normally be 1x1. | The BLP file structure consists of a header including the palette, and up to 16 pre-rendered 'mipmaps'. Texture sizes must be powers of two, though the two dimensions do not have to be equal; 512x256 is valid, but 512x200 is not. The first mipmap ('mipmap' level 0) is the full size image; each subsequent mipmap halves both dimensions. The final 'mipmap' should normally be 1x1. | ||
| Line 21: | Line 19: | ||
uint32_t palette[265]; // A set of 256 ARGB values used as a color palette | uint32_t palette[265]; // A set of 256 ARGB values used as a color palette | ||
} blp2header; | } blp2header; | ||
==== Notes ==== | ==== Notes ==== | ||
* The actual number of 'mip' levels determined by image size | * The actual number of 'mip' levels determined by image size | ||
| Line 27: | Line 24: | ||
* '''WoW''' has shipped with a small number of BLPs with dimensions that are not powers of two; 768x128 is used for many cube map textures, for example. In this case, the final stored mipmap may not be 1x1. (this last part may not be accurate) | * '''WoW''' has shipped with a small number of BLPs with dimensions that are not powers of two; 768x128 is used for many cube map textures, for example. In this case, the final stored mipmap may not be 1x1. (this last part may not be accurate) | ||
* Compression type 3 'Uncompressed' appeared in Cataclysm, and data layout is canonical A8R8G8B8, which is essentially uncompressed 24-bit color with 8-bit alpha. | * Compression type 3 'Uncompressed' appeared in Cataclysm, and data layout is canonical A8R8G8B8, which is essentially uncompressed 24-bit color with 8-bit alpha. | ||
* The header always includes a 256-entry color table. | * The header always includes a 256-entry color table. Each entry a 32-bit BGRA 8888 value. This table is only used for BLP format image data, but is present in all BLPs regardless. | ||
== Compression == | == Compression == | ||
| Line 35: | Line 32: | ||
=== BLP compression === | === BLP compression === | ||
This is the BLP specific image format, where the 'compression' is via the use of a palette, and the use of alpha flags where 'alpha' data is omitted if flags indicate that there is no alpha data at the end of the regular image data for a given 'mip' level. | This is the BLP specific image format, where the 'compression' is via the use of a palette, and the use of alpha flags where 'alpha' data is omitted if flags indicate that there is no alpha data at the end of the regular image data for a given 'mip' level. | ||
If 'compression' is 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 'compression' is 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. | ||
| Line 69: | Line 66: | ||
==== DXT5 ==== | ==== DXT5 ==== | ||
If 'alpha_type' is | If 'alpha_type' is 8, 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. | 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. | ||