ETC1压缩纹理图片格式

参考:

https://www.khronos.org/registry/DataFormat/specs/1.1/dataformat.1.1.html#ETC1
https://www.khronos.org/registry/OpenGL/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt

ETC1每4x4像素块编码为64位的字节数据,每一个像素块又分为两个2x4子块(由一个“flip”位控制水平或竖直划分),每个子块包含一个3位的修饰表索引(modifier table index)和一个基本颜色值,这两个颜色值要么是2*RGB444要么是RGB555+RGB333(由一个“ diff”位控制是哪一种)。

  • bit63-40,用于保存基础24位颜色值,具体使用哪种颜色值,参考bit33

  • bit39-37,被subblock1使用;

  • bit36-34,被subblock2使用;

 

重点:
Modifier table从左到右应该为:-b,-a,+a,+b值,使用像素颜色索引值来计算像素颜色值会用到.

  • bit33=0,即diff(erential)=0时, RGB444+RGB444

  • bit33=1,即diff(erential)=1时, RGB555+RGB333

  • bit32=0,即flip=0时

 

  • bit32=1,即flip=1时

 

  • bit31-0,像素索引值,其索引表如下:

 

每个像素均由两位确定像素颜色索引值

举个例子:

for instance, if the table code word is 010b = 2, then the modifier table [-29, -9, 9, 29] is selected. ; the pixel index bits are 01b = 1, and the modifier table [-29, -9, 9, 29] is used, then the modifier value selected for that pixel is 29 (see Table 62). This modifier value is now used to additively modify the base color. For example, if we have the base color (231, 8, 16), we should add the modifier value 29 to all three components: (231+29, 8+29, 16+29) resulting in (260, 37, 45). These values are then clamped to [0..255], resulting in the color (255, 37, 45), and we are finished decoding the texel.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值