1Name 2 3 AMD_compressed_3DC_texture 4 5Name Strings 6 7 GL_AMD_compressed_3DC_texture 8 9Contributors 10 11 Aaftab Munshi 12 13Contact 14 15 Benj Lipchak, AMD (benj.lipchak 'at' amd.com) 16 17IP Status 18 19 Please contact AMD regarding any intellectual property questions/issues 20 associated with this extension. 21 22Status 23 24 Complete. 25 26Version 27 28 Last Modified Date: February 26, 2008 29 Revision: 6 30 31Number 32 33 OpenGL ES Extension #39 34 35Dependencies 36 37 Written based on the wording of the OpenGL ES 1.1 specification. 38 39Overview 40 41 Two compression formats are introduced: 42 43 - A compression format for two component textures. When used to store 44 normal vectors, the two components are commonly used with a fragment 45 shader that derives the third component. 46 47 - A compression format for single component textures. The single component 48 may be used as a luminance or an alpha value. 49 50 There are a large number of games that use luminance only and/or alpha only 51 textures. For example, monochrome light maps used in a few popular games 52 are 8-bit luminance textures. This extension describes a compression format 53 that provides a 2:1 compression ratio for 8-bit single channel textures. 54 55 Normal maps are special textures that are used to add detail to 3D surfaces. 56 They are an extension of earlier "bump map" textures, which contained per- 57 pixel height values and were used to create the appearance of bumpiness on 58 otherwise smooth surfaces. Normal maps contain more detailed surface 59 information, allowing them to represent much more complex shapes. 60 61 Normal mapping is one of the key features that makes the current generation 62 of games look so much better than earlier titles. A limitation to the 63 effectiveness of this technique is the size of the textures required. In an 64 ideal case where every surface has both a color texture map and a normal 65 texture map, the texture memory and bandwidth requirements would double 66 compared to using color maps alone. 67 68 In fact, the problem is much worse because existing block based compression 69 methods such as DXTc, ETC, and S3TC are ineffective at compressing normal 70 maps. They tend to have trouble capturing the small edges and subtle 71 curvature that normal maps are designed to capture, and they also introduce 72 unsightly block artifacts. 73 74 Because normal maps are used to capture light reflections and realistic 75 surface highlights, these problems are amplified relative to their impact on 76 color textures. The results are sufficiently poor that game artists and 77 developers would rather not use normal map compression at all on most 78 surfaces, and instead limit themselves to lower resolution maps on selected 79 parts of the rendered scene. 80 81 3DC provides an ideal solution to the normal map compression problem. It 82 provides up to 4:1 compression of normal maps, with image quality that is 83 virtually indistinguishable from the uncompressed version. The technique is 84 hardware accelerated, so the performance impact is minimal. Thus, 85 developers are freed to use higher resolution, more detailed normal maps, 86 and/or use them on all of the objects in a scene rather than just a select 87 few. 88 89New Procedures and Functions 90 91 None. 92 93New Tokens 94 95 Accepted by the <internalFormat> parameter of CompressedTexImage2D and 96 CompressedTexImage3DOES: 97 98 3DC_X_AMD 0x87F9 99 3DC_XY_AMD 0x87FA 100 101Additions to Chapter 3 of the OpenGL 1.3 Specification (Rasterization) 102 103 Add to Table 3.17: Specific Compressed Internal Formats 104 105 Compressed Internal Format Base Internal Format 106 ========================== ==================== 107 3DC_X_AMD RGB 108 3DC_XY_AMD RGB 109 110 111 Add to Section 3.8.3, Alternate Image Specification 112 113 If <internalFormat> is 3DC_X_AMD, the compressed texture is a 114 single channel compressed texture. If <internalFormat> is 3DC_XY_AMD, 115 the compressed textures contains two channels. 116 117 The details of these formats is not disclosed, so refer to AMD's 118 Compressonator tool in order to encode your textures offline: 119 http://ati.amd.com/developer/compressonator.html 120 121 3DC_X_AMD Format 122 ================ 123 124 This format compresses a 128 bit block into 64 bits, representing a 2:1 125 compression ratio. The texture lookup unit will return (x, 0, 0, 1): the 126 decoded X value in the red component, 0.0 in the green and blue components, 127 and 1.0 in the alpha component. 128 129 3DC_XY_AMD Format 130 ================= 131 132 This format compresses a 512 bit block into 128 bits, representing a 4:1 133 compression ratio. The texture lookup unit will return (x, y, 0, 1): the 134 decoded X value in the red component, the decoded Y value in the green 135 component, 0.0 in the blue component, and 1.0 in the alpha component. 136 137 Using 3DC_XY_AMD to compress normal maps requires an additional step. This 138 is because each value in a normal map is actually a 3D vector, consisting of 139 3 components (x, y, z). These values must be reduced to 2-component values 140 in order to work with 3DC_XY_AMD. Fortunately, this can be handled in a 141 simple way by assuming that all of the normal vectors have a length of 1. 142 Given the values of two components of a vector, the value of the third 143 component can be found using the following mathematical relationship: 144 z = sqrt(1 - (x*x + y*y)). This formula can be implemented using just a 145 couple of fragment shader instructions. 146 147Errors 148 149 INVALID_OPERATION is generated by TexImage2D, TexSubImage2D, 150 CompressedTexSubImage2D, or CopyTexSubImage2D if <internalformat> or 151 <format> is 3DC_X_AMD or 3DC_XY_AMD. 152 153New State 154 155 The queries for NUM_COMPRESSED_TEXTURE_FORMATS and 156 COMPRESSED_TEXTURE_FORMATS include 3DC_X_AMD and 3DC_XY_AMD. 157 158Revision History 159 160 02/26/2008 Benj Lipchak Throw INVALID_OPERATION on subimage updates. 161 09/24/2007 Jon Leech Assign extension number. 162 09/05/2007 Benj Lipchak Cosmetic changes. 163 08/01/2007 Benj Lipchak Publication readiness. 164 06/02/2006 Aaftab Munshi Added IP status. 165 05/12/2006 Aaftab Munshi First Draft. 166