Textures with Alpha Channels 带阿尔法通道的纹理

There are two ways to encode texture maps that exhibit more complex transparency.可以用有两种方法对具有更为复杂的透明度的纹理贴图进行编码。 In each case, a block that describes the transparency precedes the 64-bit block already described. 每种方法都包含一个描述透明度的块,位于前述的64位块之前。The transparency is either represented as a 4x4 bitmap with 4 bits per pixel (explicit encoding), or with fewer bits and linear interpolation that is analogous to what is used for color encoding.透明度要么用4x4位图表示,位图中每像素占用4位(直接编码),要么占用更少的位(译注:3位)并进行线性插值,这与颜色编码相似。

    The transparency block and the color block are arranged as shown in the following table.透明度块和颜色块中数据的排列如下表所示。

Word address64-bit block
3:0Transparency block
7:4Previously described 64-bit block

字地址

64位块

3:0

透明度块

7:4

前述64位块

Explicit Texture Encoding 直接纹理编码

For explicit texture encoding (DXT2 and DXT3 formats), the alpha components of the texels that describe transparency are encoded in a 4x4 bitmap with 4 bits per texel. 对于直接纹理编码(DXT2和DXT3格式),描述texel的透明度的阿尔法分量被编码在一个4x4位图中,每个texel占用4位。These four bits can be achieved through a variety of means such as dithering or by using the four most significant bits of the alpha data. 这四位阿尔法值可以通过各种方法得到,诸如抖动或使用阿尔法数据的最高四位。However they are produced, they are used just as they are, without any form of interpolation.但无论它们是如何产生的,都只按原样使用,不做任何形式的插值。

The following diagram shows a 64-bit transparency block.下图显示了一个64位的透明度块。

64-bit transparency block

The compression method of Direct3D uses the four most significant bits. Microsoft® Direct3D®的压缩方法使用最高四位。

The following tables illustrate how the alpha information is laid out in memory, for each 16-bit word.

 

下面这些表描述了在每个16位字中,阿尔法信息的内存布局。

This table contains the layout for word 0.

BitsAlpha
3:0 (LSB*)[0][0]
7:4[0][1]
11:8[0][2]
15:12 (MSB*)[0][3]

*least-significant bit, most significant bit (MSB)

This table contains the layout for word 1.

BitsAlpha
3:0 (LSB)[1][0]
7:4[1][1]
11:8[1][2]
15:12 (MSB)[1][3]

This table contains the layout for word 2.

BitsAlpha
3:0 (LSB)[2][0]
7:4[2][1]
11:8[2][2]
15:12 (MSB)[2][3]

This table contains the layout for word 3.

BitsAlpha
3:0 (LSB)[3][0]
7:4[3][1]
11:8[3][2]
15:12 (MSB)[3][3]
The difference between DXT2 and DXT3 are that, in the DXT2 format, it is assumed that the color data has been premultiplied by alpha.In the DXT3 format, it is assumed that the color is not premultiplied by alpha. DXT2 和DXT3之间的区别在于,在DXT2格式中,我们认为颜色数据已经预乘了阿尔法,而在DXT3格式中,我们认为颜色数据没有预乘阿尔法。These two formats are needed because, in most cases, by the time a texture is used, just examining the data is not sufficient to determine if the color values have been multiplied by alpha. 之所以需要这两种是格式是因为大多数情况下,在使用一个纹理时,仅检查数据并不足以确定颜色数据是否已经预乘了阿尔法。Because this information is needed at run time, the two FOURCC codes are used to differentiate these cases. 因为运行的时候需要这样的信息,所以就用两个四字符码(FOURCC)来区分这两种情况。However, the data and interpolation method used for these two formats is identical.

    The color compare used in DXT1 to determine if the texel is transparent is not used in this format. 为了检测texel 是否是透明的,在DXT1中要对颜色进行比较. It is assumed that without the color compare the color data is always treated as if in 4-color mode. 我们认为在不需要颜色比较的情况下,颜色数据总是以四色模式进行处理。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值