Difference between revisions of "Red Green Texture Compression"

From OpenGL.org
Jump to: navigation, search
(making a stub.)
 
m (Linking)
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
''Red Green Texture Compression'' is a texture compression scheme specifically for one and two channel textures.
+
''Red Green Texture Compression'' is a image compression scheme specifically for one and two channel textures. These are [[Image Format]]s used with [[Texture|texture objects]].
  
{{stub}}
+
== Compression Format ==
  
[[Category:Textures]]
+
There are 4 RG compression formats: unsigned red, signed red, unsigned red/green and signed red/green.
 +
 
 +
All of these basically work the same. They use compression identical to the alpha form of [[S3 Texture Compression#DXT5 Format|DXT5]]. So for red only formats, you have 1 64-bit block of the format used for DXT5's alpha; this represents the red color. For red/green formats you have 2 64-bit blocks, so that red and green can vary independently of one another.
 +
 
 +
The signed formats are almost identical. The two control colors are simply considered to be two's compliment 8-bit signed integers rather than unsigned integers, and all arithmetic is signed rather than unsigned. Also, rather than having 0.0 and 1.0 in the table, you have -1.0 and 1.0. Also, the comparison between alpha0 and alpha1 (red and green, depending on which block it is) is undefined if alpha0 is -127 and alpha1 is -128. That is because the comparison logic for two's compliment integers is slightly different from unsigned integers when comparing -128 to -127. The specification says that the result is undefined, so the resulting color values will be undefined.
 +
 
 +
Therefore, when compressing your signed texture formats, make sure you do not have a block that makes the first color -127 and the second -128.
 +
 
 +
[[Category:Texture Compression]]

Revision as of 01:44, 2 July 2012

Red Green Texture Compression is a image compression scheme specifically for one and two channel textures. These are Image Formats used with texture objects.

Compression Format

There are 4 RG compression formats: unsigned red, signed red, unsigned red/green and signed red/green.

All of these basically work the same. They use compression identical to the alpha form of DXT5. So for red only formats, you have 1 64-bit block of the format used for DXT5's alpha; this represents the red color. For red/green formats you have 2 64-bit blocks, so that red and green can vary independently of one another.

The signed formats are almost identical. The two control colors are simply considered to be two's compliment 8-bit signed integers rather than unsigned integers, and all arithmetic is signed rather than unsigned. Also, rather than having 0.0 and 1.0 in the table, you have -1.0 and 1.0. Also, the comparison between alpha0 and alpha1 (red and green, depending on which block it is) is undefined if alpha0 is -127 and alpha1 is -128. That is because the comparison logic for two's compliment integers is slightly different from unsigned integers when comparing -128 to -127. The specification says that the result is undefined, so the resulting color values will be undefined.

Therefore, when compressing your signed texture formats, make sure you do not have a block that makes the first color -127 and the second -128.