The field of the present invention relates to computer graphics. More particularly, the present invention relates to rendering operations in a computer graphics processing pipeline.
Recent advances in computer performance have enabled graphic systems to provide more realistic graphical images using personal computers and home video game computers. In such graphic systems, some procedure must be implemented to “render” or draw graphic primitives to the screen of the system. A “graphic primitive” is a basic component of a graphic picture, such as a polygon, e.g., a triangle, or a vector. All graphic pictures are formed with combinations of these graphic primitives. Many procedures may be utilized to perform graphic primitive rendering.
Early graphic systems displayed images representing objects having extremely smooth surfaces. That is, textures, bumps, scratches, or other surface features were not modeled. In order to improve the quality of the image, texture mapping was developed to model the complexity of real world surface images. In general, texture mapping is the mapping of an image or a function onto a surface in three dimensions.
With the early graphic systems, textures on surfaces consisted of color information only. For example, the texture would be a picture of whatever material the designer was trying to convey (e.g., brick, stone, vegetation, wood, etc.) and would contain shading information as well as the texture and color to create the impression of a complex, dimensional surface. In more recent graphic systems, a light map is often combined with the color map to create a more realistic sense of shading and soft shadowing. The trouble with this technique is that the shading on a particular texture would often be at variance with the perceived sources of light in the scene in which they were used. For example, a texture might be drawn as if it were lit from the upper left, but in a particular scene, the actual light source may be from the right, or below the texture.
To overcome these limitations, a new technique was developed, generically called “bump mapping”. In its simplest form, a texture on a surface contains two textures, for example, a color map and a second map that contains the height information for the surface. This information enables the rendering of highlights and shadows on the surface according to where the lights in the scene are located, resulting in a vastly improved surface realism. The problem with prior art bump mapping techniques is the fact that the graphic system is restricted to portraying transitions in elevation only, resulting in a flattened appearance of the actual height information the designer is trying to convey.
Normal maps were developed to overcome the limitations of bump mapping. While a height map only contains 1 component of information (e.g., the “Z” height or direction), the vectors of a normal map contains 3 components of information (e.g., “X” direction, “Y” direction and “Z” direction). Thus, each pixel in a normal map encodes which direction that particular point is facing (e.g., the “normal vector” of the surface). Each pixel in a normal map has meaningful information, so details can be rendered more crisply than with bump maps alone.
The problem with real-time rendering using normal maps is that there is an excessively large amount of data to manipulate for each rendered frame. For example, normal maps typically use three channels of information in their coding, mapped to a standard RGB image. Generally, for each pixel, the red channel can be used to encode normal vectors in the X direction. Similarly, the green channel encodes normal vectors in the Y direction, and the blue channel encodes normal vectors in the Z direction, or the like.
To improve the performance of real-time rendering graphics systems, several prior art normal map compression schemes have been developed. The objective of these prior art compression schemes is to compress normal maps (e.g., texture maps where each pixel is a normalized vector) so that their storage consumes less space and their processing consumes less bandwidth.
One prior art compression scheme uses a hemispherical normal map data structure, where 16 bits per pixel were used to represent any point on a hemisphere. In a typical case, 65,536 points on the surface of the hemisphere would each be described by a respective 16 bits. Thus, the normal for any point on the surface would be described by selecting its corresponding normal, or point, on the hemisphere data structure. A significant degree of compression can be obtained with this prior art compression scheme. The compression results in some degree of quantization loss.
The problem with this prior art compression scheme, however, is that there still remains a very large amount of data that must be manipulated and processed in real-time. This large amount of data still presents a significant burden on even the most modern graphics rendering pipelines.
Embodiments of the present invention provide a method and system for implementing compressed normal maps. Embodiments of the present invention significantly reduce the amount of data that must be manipulated and processed in real-time. Embodiments of the present invention provide an improved normal map compression ratio in comparison to the prior art, thereby significantly reducing the processor and storage burden on graphics rendering pipelines.
In one embodiment, the present invention is implemented as a GPU (graphics processor unit) based method for compressing normal maps in a computer system. The method includes accessing a map of input normals. A memory block having a first portion and a second portion is defined. A table of indices is stored in the first portion of the memory block and a table of normals is stored in the second portion of the memory block. The indices of the first portion of the memory block reference the normals of the second portion. The normals in the second portion of the memory block are unit normals of a sphere defined to represent the map of input normals.
In one embodiment, the memory block is a 64-byte memory block having a first 256-bit portion and a second 256-bit portion for storing a first table of 64 4-bit indices and a second table of 16 entries, wherein each entry comprises a 16 bit encoded normal. In one embodiment, 16 optimally selected normals in the second table are used to represent 64 input normals.
The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements.
Reference will now be made in detail to the preferred embodiments of the present invention, examples of which are illustrated in the accompanying drawings. While the invention will be described in conjunction with the preferred embodiments, it will be understood that they are not intended to limit the invention to these embodiments. On the contrary, the invention is intended to cover alternatives, modifications and equivalents, which may be included within the spirit and scope of the invention as defined by the appended claims. Furthermore, in the following detailed description of embodiments of the present invention, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be recognized by one of ordinary skill in the art that the present invention may be practiced without these specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail as not to unnecessarily obscure aspects of the embodiments of the present invention.
Embodiments of the present invention provide a method and system for implementing compressed normal maps. Embodiments of the present invention significantly reduce the amount of data that must be manipulated and processed in real-time. Embodiments of the present invention provide an improved normal map compression ratio in comparison to the prior art, thereby significantly reducing the processor and storage burden on graphics rendering pipelines. Embodiments of the present invention and their benefits are further described below.
Notation and Nomenclature
Some portions of the detailed descriptions, which follow, are presented in terms of procedures, steps, logic blocks, processing, and other symbolic representations of operations on data bits within a computer memory. These descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art. A procedure, computer executed step, logic block, process, etc., is here, and generally, conceived to be a self-consistent sequence of steps or instructions leading to a desired result. The steps are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated in a computer system. It has proven convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, or the like.
It should be borne in mind, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the following discussions, it is appreciated that throughout the present invention, discussions utilizing terms such as “compressing” or “accessing” or “executing” or “storing” or “rendering” or the like, refer to the action and processes of a computer system (e.g., computer system 100 of
Computer System Platform
With reference now to
In general, computer system 100 comprises at least one CPU 101 coupled to a system memory 115 and a graphics processor unit (GPU) 110 via one or more busses as shown. The GPU 110 is coupled to a display 112. As shown in
Additionally, it should be appreciated that although the GPU 110 is depicted in
Thus, the normals 202 can provide a normal map that describes the orientation of the surface 210. For example, in the same manner as a texture map can give a color at every point on the surface 210, a normal map can give a normal orientation at every point on the surface 210. Once applied to the surface 210, the resulting normals 203 enabled the rendering of very realistic lighting effects.
As shown in the
Embodiments of the present invention function by choosing the most optimal 16 normals 306 from the 65,536 points on the quantized sphere 305 to represent these 64 original normals of the block 304. In other words, the compression process 310 reduces the 64 original normals to 16 quantized sphere normals that most optimally represent these original normals.
It should be noted that the also note that the meaning of term “most optimally represent” is generally application dependent. For example, in one application, it may be most optimal to minimize the average angular deviation of the selected normals 306 with respect to the original normals 304. In other words, an examination is made as to the degree to which each of the original normals 304 has had to deviate (e.g., how far it has had to move on the sphere 305) and the selected normals 306 are chosen in such a manner as to minimize the mean deviation.
In another application, one may wish to minimize the average error of the dot product of the quantized normal with several possible light vectors compared to the dot product of the original normal and the same set of light vectors.
In one embodiment, a table of indices is stored in the first portion 402 of the memory block 401 and a table of normals is stored in the second portion 403 of the memory block 401. The indices of the first portion 402 of the memory block 401 reference the normals of the second portion 403. The normals in the second portion 403 of the memory block 401 are unit normals of a sphere (e.g., sphere 305 of
In one embodiment, the first portion 402 stores a first table of 64 4-bit indices and the second portion 403 stores a second table of 16 entries, wherein each entry comprises a 16 bit encoded normal. In one embodiment, 16 optimally selected normals in the second table 403 are used to represent 64 input normals (e.g., block of input normals 304). The resulting 64 input normals are thus compressed and stored using only 8 bits/pixel.
It should be noted that the compression method of the present embodiment results in both a quantization loss (e.g., fewer bits per normal) and selection loss (e.g., fewer normals). This is due to the fact that a compression algorithm must down-select the most optimal resulting normals from the 65,536 normals on the unit sphere. For example, in the scenario described above in
It should also be noted that embodiments of the present invention are suited to different encoding mechanisms for the resulting 16 output normals. In the example described above, 16 bits represent each output normal. Embodiments of the present invention can encode the 16 bits in a number of different ways. For example, in one embodiment, 8 bits can be used for “x”, 7 bits can be used for “y”, and 1 bit can be used for “z”. Alternatively, 6 bits can be used for “x”, 5 bits can be used for “y”, and 5 bits can be used for “z”. For example, in one embodiment, a logic block (e.g., within the GPU) is specifically adapted to convert the 16 bit representation to a 3 component vector (X,Y,Z) representing that same point on a sphere. This vector is directly usable by graphics hardware (e.g., a GPU shader), whereas the original 16 bit representation is not. It should be noted that other representations (e.g., 12 bit, 24 bit, etc.) can be implemented while remaining within the scope of the present invention.
Process 600 begins in step 601, where a normal map of input normals (e.g., input normals 302 of
The foregoing descriptions of specific embodiments of the present invention have been presented for purposes of illustration and description. They are not intended to be exhaustive or to limit the invention to the precise forms disclosed, and obviously many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, to thereby enable others skilled in the art to best utilize the invention and various embodiments with various modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the claims appended hereto and their equivalents.
Number | Name | Date | Kind |
---|---|---|---|
4791403 | Mitchell et al. | Dec 1988 | A |
4803477 | Miyatake et al. | Feb 1989 | A |
5109417 | Fielder et al. | Apr 1992 | A |
5227789 | Barry et al. | Jul 1993 | A |
5495542 | Shimomura et al. | Feb 1996 | A |
5495545 | Shimomura et al. | Feb 1996 | A |
5644524 | Van Aken et al. | Jul 1997 | A |
5736987 | Drucker et al. | Apr 1998 | A |
5793371 | Deering | Aug 1998 | A |
5801708 | Alcorn et al. | Sep 1998 | A |
5801975 | Thayer et al. | Sep 1998 | A |
5831640 | Wang et al. | Nov 1998 | A |
5835097 | Vaswani et al. | Nov 1998 | A |
5841442 | Einkauf et al. | Nov 1998 | A |
5963744 | Slavenburg et al. | Oct 1999 | A |
6052127 | Vaswani et al. | Apr 2000 | A |
6055000 | Okada | Apr 2000 | A |
6078334 | Hanaoka et al. | Jun 2000 | A |
6184893 | Devic et al. | Feb 2001 | B1 |
6433789 | Rosman | Aug 2002 | B1 |
6501851 | Kondo et al. | Dec 2002 | B1 |
6546409 | Wong | Apr 2003 | B1 |
6580828 | Li | Jun 2003 | B1 |
6700581 | Baldwin et al. | Mar 2004 | B2 |
6876362 | Newhall, Jr. et al. | Apr 2005 | B1 |
7109999 | Lindholm et al. | Sep 2006 | B1 |
7126604 | Purcell et al. | Oct 2006 | B1 |
7224838 | Kondo et al. | May 2007 | B2 |
7916149 | Donovan et al. | Mar 2011 | B1 |
8078656 | Rogers et al. | Dec 2011 | B1 |
20020147753 | Rao et al. | Oct 2002 | A1 |
20030023646 | Lin et al. | Jan 2003 | A1 |
20030105788 | Chatterjee | Jun 2003 | A1 |
20030169265 | Emberling | Sep 2003 | A1 |
20030206177 | Hoppe et al. | Nov 2003 | A1 |
20030223490 | Kondo et al. | Dec 2003 | A1 |
20040027358 | Nakao | Feb 2004 | A1 |
20040151372 | Reshetov et al. | Aug 2004 | A1 |
20040207631 | Fenney et al. | Oct 2004 | A1 |
20050110790 | D'Amora | May 2005 | A1 |
Entry |
---|
Mark Adler, Gzappend, Nov. 4 2003, http://svn.ghostscript.com/ghostscript/tags/zlib-1.2.3/examples/gzappend.-c. |