The present invention is related generally to the field of sampled imagery, and more particularly, to systems and methods for generating antialiased, sampled images.
In computer graphics, a sampled image is created from input geometry, mathematical computations, and/or the like, typically representing a scene. A sampled image is one represented by an array of discrete units, referred to as pixels. The pixels are generally arranged along two perpendicular axes corresponding to the horizontal and vertical axes of the image. The color or monochrome values of the pixels are determined by calculated sample values, typically derived from scene data, lighting data, and/or other input data. The image represented by the array of pixels is typically transferred to a visual medium, such as by being printed onto paper or film or displayed upon a computer display monitor. The number of pixels and number of colors or values used in rendering a graphics image limit, to some extent, the visual qualities and characteristics of the viewed image, for example, the image definition, smoothness, and detail. A great amount of effort has been devoted to developing sophisticated graphics processing and rendering methods for higher image quality.
In addition to high-quality static images, high-quality animation, depicting visual effects of motion, is also desirable. The illusion of motion is created by quickly displaying related images. In a sequence of image frames in which an object appears in different positions, the object may appear to move. Although the motion of the object may appear to be continuous, each frame of the animation is a separate image that is displayed momentarily. Thus, the quality of each frame will affect the quality of the animation or illusion of motion. However, depending upon the rendering algorithm, representing motion may result in the creation of motion artifacts. The more noticeable effects include “crawling” and “popping” of pixels on a moving edge, for example, an edge of a moving object having a value that contrasts against a different value background.
For example, consider an object, of a first color and having a straight edge, that appears to be moving across a background of a second color. As the edge of the object moves across a pixel, there must be a determination as to when the color of the pixel changes from the color of the background to the color of the object. If a single sample point within the pixel is taken to determine its color, then, when the edge of the object passes this single, sampling location, the color of the pixel is changed. The location of a single sample point is typically the center of the pixel, and consequently, the value of the pixel is determined by the value calculated for the center of the pixel. As a result of a single sample point determination for the value of a pixel in a sampled image, the edge of an object may extend well into the region represented by the pixel, but the pixel may have the value of the background, because the edge has not reached the sampling point at the center of the pixel.
When multiple images, or frames, are displayed in sequence, to provide the illusion of objects in motion, pixels along the edge of an object may “pop” from one color or value to another. This effect can be distracting for a viewer. The relative motion of an object with respect to the orientation of the pixels of the image may be such that pixels along the edge of the object pop values in a manner and with a regularity that creates a visual effect of the edge of the object “crawling.”
There have been many different approaches to addressing the issue of aliasing. Aliasing includes such static edge-effects as “staircasing” and such motion artifacts as “pixel popping” and crawling. One such approach is to increase the resolution, or the number of pixels used to represent an image. The available resolution of computer graphics displays has increased dramatically, reducing, but not eliminating, aliasing. Similarly, printing devices have been increasing resolution, as well. However, there are practical limitations on the manufacturing of displays and other devices used for forming or recording an image. In addition, there are practical limitations with respect to the computation components which can be devoted to rendering an image. Processing more samples, at the centers of more pixels, takes longer, on a given device. Moreover, no matter how high a (finite) resolution is used to represent a graphics image, so long as the value of each pixel is only approximated from calculated values for discrete, sample points, the image is subject to some degree of aliasing, and a sequence of such images is subject to motion artifacts.
However, aliasing can be “anti-aliased” to some degree, by taking advantage of the number of values available for each pixel. More specifically, multi-sampling systems for anti-aliased rendering use sample values from multiple samples taken from a pixel region in determining the value of the respective pixel. When multi-sampling is applied to our example, above, as the edge of the object passes the first sample point encountered, the pixel is given a value that is a compromise between the value of the object and the disparate value of the background. Let's assume that the size, shape and motion of the object result in the object gradually and completely covering the pixel, one sampling point at a time. The value given to the pixel changes, each time the object covers another sample point of the pixel, until all of the sample points share the color of the object, at which time the pixel takes on the color of the object. The value of the pixel more accurately represents the proportion of the pixel occupied by the object at any moment, and over time.
The multiple samples for each pixel are typically arranged, within a region associated with the pixel, in an ordered pattern, such as in a rectangular grid, or in a pseudo-random fashion. We will refer to any arrangement of samples with respect to a pixel as a “sampling pattern”, or “sample pattern”. Regions associated with neighboring pixels may overlap. Pseudo-random multi-sampling per pixel generally requires a large number of samples per pixel, and considerable computation. Some anti-aliasing methods employ sampling patterns designed to simulate random sampling, and they, too, typically compute a large number of samples.
Although conventional multi-sample anti-aliasing methods generally can reduce motion artifacts and edge effects, aliasing remains. For example, a solid square, with edges parallel to the axes of the image, moving vertically, may create a popping effect by encountering multiple sample points within a pixel, simultaneously, if the sample points are arranged in a rectangular grid, within the pixel. Taking more samples per pixel may reduce the severity of motion artifacts, but processing overhead and economic considerations will place practical limits on the maximum number of samples that can be reasonably taken per pixel.
Therefore, there is a need for an alternative system and method for rendering an image, while reducing aliasing, such as motion artifacts and edge effects.
The present invention relates to a method and system for performing multi-sample, anti-aliased rendering of images. The value of a pixel of an image is computed from one or more sample values, each computed at a respective sample point, position, or location, the sampling points, positions, or locations for a pixel being arranged in a sampling pattern. We will refer to “sampling point,” “sample point,” “sampling location,” “sample location,” “sampling position,” or “sample position” interchangeably. Different sampling patterns may apply to different pixels. An alternate sampling pattern may be applied to alternate pixels along lines parallel to a first axis and/or along lines parallel to a perpendicular second axis. A repeating sequence of sampling patterns may be applied to consecutive pixels along a row or column. Also, a sampling pattern may have four sample locations within the region of a pixel. The four samples are arranged within the pixel region such that were the pixel region divided into a four-by-four array of sub-regions, the four sample locations would be arranged within the pixel region in a manner such that no two samples are located in the same row, column, or diagonal of sub-regions. A sampling pattern may use only two or three of these four potential positions. A sampling pattern may be applied repeatedly to a pixel. Sample values taken for a pixel may be combined and cumulated with previously calculated and stored values. Within a frame the same sampling pattern and the same sampling locations may be used each time a pixel is sampled in order to avoid introducing artifacts. Sample values for a pixel are combined to calculate a value for the pixel.
a and 5b are a diagram of a multi-sample pattern according to another embodiment of the present invention.
Embodiments of the present invention render anti-aliased images by reducing artifacts in both static images and also in motion pictures or animation. The systems and methods described herein perform anti-aliased rendering through a process of taking multiple samples, or “over-sampling,” for calculating values of pixels such ascolor or depth values in forming a resulting computer graphics image. Certain details are set forth below to provide a sufficient understanding of the invention. However, it will be clear to one skilled in the art that the invention may be practiced without these particular details. In other instances, well-known circuits, control signals, timing protocols, and software operations have not been shown in detail in order to avoid unnecessarily obscuring the invention.
The computer system 100 further includes a graphics processing system 132 coupled to the processor 104 through the expansion bus 116 and memory/bus interface 112. Optionally, the graphics processing system 132 may be coupled to the processor 104 and the memory 108 through other types of architectures. For example, the graphics processing system 132 may be coupled through the memory/bus interface 112 and a high speed bus 136, such as an accelerated graphics port (AGP), to provide the graphics processing system 132 with direct memory access (DMA) to the memory 108. That is, the high speed bus 136 and memory bus interface 112 allow the graphics processing system 132 to read and write memory 108 without the intervention of the processor 104. Thus, data may be transferred to, and from, the memory 108 at transfer rates much greater than over the expansion bus 116. A display 140 is coupled to the graphics processing system 132 to display graphics images. The display 140 may be any type of display, such as those commonly used for desktop computers, portable computers, and workstations, for example, a cathode ray tube (CRT), a field emission display (FED), a liquid crystal display (LCD), or the like.
A pixel engine 212 is coupled to receive the graphics data generated by the triangle engine 208. The pixel engine 212 contains circuitry for performing various graphics functions, such as, but not limited to, texture application or mapping, bilinear filtering, fog, blending, and color space conversion. A memory controller 216 coupled to the pixel engine 212 and the graphics processor 204 handles memory requests to and from a local memory 220. The local memory 220 stores graphics data, such as pixel values. A display controller 224 is coupled to the memory controller 216 to receive processed values for pixels that are to be displayed. The output values from the display controller 224 are subsequently provided to a display driver 232 that includes circuitry to provide digital signals, or convert digital signals to analog signals, to drive the display 140 (
Although the anti-aliasing circuitry 214 is illustrated in
As previously mentioned briefly, the anti-aliasing circuitry 214 facilitates anti-aliasing by over-sampling for at least some pixels of a graphics image. The sample values for the multiple samples for a pixel are calculated for each triangle or other primitive covering, or partially covering, the pixel. The sample value for a given sample position within a given pixel may be stored and/or altered, for example by well-known z-buffer techniques, in accordance with the processing of other data, such as other primitives touching the same sample position in the same pixel. Later, the final sample values for a given pixel are then combined, in the pixel engine or texture engine (not shown) or blend unit (not shown), to determine a sample value for the pixel in the resulting image. Anti-aliased rendering by taking multiple samples is known in the art. However, as described in the Background of the Invention, conventional methods of anti-aliased rendering nevertheless still suffer, for example, from motion artifacts related to moving objects having edges aligned with the axes of the pixel coordinate system. Embodiments of the present invention use a more sophisticated over-sampling method than in conventional anti-aliasing rendering methods. Simply increasing the number of sampling points per pixel would suffer from the shortcomings previously described. Instead, the number and positions of samples taken for a pixel, according to each particular sampling pattern to be used, as well as the selection of the particular pattern of samples to be applied to a given pixel, are arranged to improve processing efficiency and/or perceived visual quality.
It will be appreciated that the sample values may represent values such as color values or grayscale values and/or depth values, etc., at a sample location. It will be further appreciated that the sample values for the samples may consist of several different components. For example, a sample value may represent not only a pixel color, as a combination of red, green, and blue color components, but also a depth value. Another example includes sample values representing pixel colors which are combinations of luma and chroma components. Consequently, because it is well understood in the art, although circuitry to perform graphics operation for each of the components is not expressly shown or described herein, embodiments of the present invention include circuitry, control signals, and the like necessary to perform operations on each component for multi-component sample values.
Illustrated in
a and 5b illustrate sampling patterns resulting from modifications of the alternating 2 Queens pattern shown in
The sampling patterns illustrated in
The sampling patterns illustrated in
Illustrated in
The 4 Queens pattern is repeated for each pixel of the graphics image. Although the 4 Queens sampling pattern uses twice as many samples as the alternating 2 Queens sampling patterns previously discussed, and consequently, will require more processing, partial coverage of a pixel is more faithfully depicted, because the value computed for a pixel is based on the contribution of sample values from two additional samples. Thus, sub-pixel-stepped motion through a pixel, and/or objects half the width of a pixel, are more accurately portrayed.
The sampling pattern described with respect to
The 4 Queens and alternating 4 Queens sampling patterns illustrated in
It will be appreciated that many of the previously described methods can be more generally described as using more than one sampling pattern to calculate values for pixels of an image. For example, the alternating 2 Queens and alternating 4 Queens methods both have at least two different sampling patterns that are used in calculating values for a pixel. It will be further appreciated that many other techniques using multiple sampling patterns can be developed as well. Additionally, it should be noted that to avoid a “boiling” effect, the same pattern is typically used in the same pixel position in successive frames. A “cut” to a different scene is a general exception to this rule of thumb. However, in most cases, the pattern applied should be the same for the same pixel, in subsequent frames, whatever the embodiment of the invention. It will be appreciated, however, that changing the sampling pattern for a pixel in successive frames nevertheless remains within the scope of the present invention. The following sampling patterns and sampling methods are provided by way of example, and are not intended to limit the scope of the present invention.
In one embodiment, the sampling patterns for a first group of pixels (e.g., pixels 1-4) may repeat, in the same order, for a second group of pixels (e.g., pixels 5-8). The patterns of the first and second groups of pixels are repeated in the same sequence along either or both axes. For example, pixels 9-12, pixels 13-16, and so on, have the same sequence of sampling patterns as pixels 1-4. Thus, rather than having two sampling patterns alternate from pixel to pixel, a group of sampling patterns will repeat periodically from one group of pixels to the next. Two alternating patterns comprise a periodically repeating group, namely a group of 2 patterns.
In an alternative embodiment, a set of sampling patterns can be defined for use, and, on a per-pixel basis, one of the sampling patterns can be selected for use when calculating a value for a pixel. The selection process may be predetermined, or, may actually occur as calculation of the sample values proceeds. The sampling patterns can have various numbers of samples and have several arrangements of sample locations. Moreover, the method by which a sampling pattern is selected for a pixel can be made by various techniques. For example, five different sampling patterns S0-S4 may be programmed into memory for the set of sampling patterns. The memory into which the sampling patterns are programmed is a conventional memory device such as a read-only memory (ROM), dynamic random access memory (DRAM), or a static random access memory (SRAM), or the like. Such a memory may be included in the local memory 220 (
When values for a pixel are to be calculated, a selection method is employed to determine which of the five sampling patterns will be used for the pixel. In one embodiment, the sampling patterns are selected in the same sequence as they are stored in memory. Each successive pixel, e.g., along a row, is sampled according the pattern stored in memory following the pattern applied to the predecessor pixel. In another embodiment, the selection of the sampling pattern is made by use of a pseudo-random technique where a selection algorithm attempts to simulate a random selection of the sampling pattern. In another embodiment, the selection of a sampling pattern from the set of five is made using a random selection. It will be appreciated that there are many well-known techniques for implementing the selection techniques described herein, and, although a more detailed description of the various techniques has not been provided, those of ordinary skill in the art have sufficient understanding to practice embodiments of the present invention.
In an alternative embodiment of the present invention, rather than having pre-defined sampling patterns from which one is selected when calculating sample values for a pixel, a deterministic technique is used to compute the sample locations from which values for a pixel are calculated. For example, a pixel region may be thought of as divided into sixteen different sub-regions arranged in a four-by-four array as previously mentioned. The center of each of the sub-regions represents a location at which a sample can be calculated. Determination of which of the sixteen potential locations will be sampled can be made using a deterministic selection technique. A simple example of such a selection technique is to increment through a four-bit value where each binary value represents a different sample location of the sixteen available. It will be appreciated that other deterministic selection techniques can be developed by those of ordinary skill in the art. It will be further appreciated that although the selection of a sample location within a pixel has been described with respect to a single sample location, a plurality of samples may be calculated for a pixel as well, each of the sample locations determined in accordance with a deterministic selection technique. It will be appreciated that the embodiments previously described may be implemented either by the deterministic scheme of this paragraph, or by the “patterns-in-memory” regime of the previous paragraph, or by some combination of both, or by other means.
In another embodiment of the present invention, the various sampling patterns described herein may be used in a sampling method where the sampling positions of a sampling pattern are “jittered” when calculating the sample values for a pixel in the image. That is, a sampling pattern is defined, and, prior to calculating sampling values, its sampling positions are altered at the sub-pixel level. In effect, when a pattern is applied to a pixel, different pseudo-random or random offsets, varying independently in x and y, are added to the coordinates of each sample position, before the samples are calculated. Conventional methods do such jittering for patterns comprising regular grids of samples. (Different offsets may be used for the same pixel, from frame to frame, although generally, the same pattern should be used before the offsets are applied.) In this manner, correlation of sample locations is diminished, and consequently, the occurrence of artifacts such as staircasing, pixel popping, and pixel crawling, will be reduced. Typically, the same offsets would be used for a given pixel for all sampling within a frame, as above.
In another embodiment, a linear transformation including a rotation of the sampling pattern may also be used for shifting, on a per pixel basis, the sampling locations of a sampling pattern.
As previously discussed, a value for a pixel is calculated from the respective sample values. Many well known calculation techniques for calculating values for pixels from the respective sample values may be used in embodiments of the present invention. For example, combinations of sample values can be cumulated from and to stored sample values for finally calculating a value for a pixel from respective stored cumulated sample values. For example, this is done in z-buffer methods, where z is depth.
Selection of which sampling patterns or combinations or sequences of patterns to employ may be based on the type of image being represented by the pixel information. For example, one sampling pattern may be better suited for a particular game with animation, whereas another sampling pattern may be better suited for some particular still images. One game may include sequences optimized by different patterns, and embodiments of the present invention permit re-programming. Patterns may be used in various combinations and sequences, even within a frame or single image, as warranted by the image content. Thus, a system or method may use more than one sampling pattern to optimize image quality.
It will be appreciated that embodiments of the present invention may be practiced using conventional software language and conventional hardware circuitry well understood by those of ordinary skill in the art. In either case, the description provided herein is sufficient to allow those of ordinary skill in the art to practice the present invention without the need for undue experimentation. Moreover, as previously mentioned, certain details have been set forth above to provide a sufficient understanding of the invention. However, it will be clear to one skilled in the art that the invention may be practiced without these particular details. In other instances, well-known circuits, control signals, timing protocols, and software operations have not been shown in detail in order to avoid unnecessarily obscuring the invention.
Thus, from the foregoing it will be appreciated that, although specific embodiments of the invention have been described herein for purposes of illustration, various modifications may be made without deviating from the spirit and scope of the invention. For example, embodiments of the present invention have been described as being implemented in a computer system, and more specifically, a graphics processing system included in the computer system. However, embodiments of the present invention may be implemented in other systems where graphics processing is desirable, such as gaming systems, set-top boxes for cable television, printing devices, and the like. More generally, embodiments of the present invention may be implemented in general processing environments, where the sampling techniques described herein are carried out by a general purpose computer. Additionally, although embodiments of the present invention have been described herein for application with 3D computer graphics, it will be appreciated that the present invention is also applicable to 2D graphics, where the sample values are calculated from scenes or other two-dimensional (2D) representations, and to the visualization of higher dimensional mathematics, image processing and so forth. Accordingly, the invention is not limited except as by the appended claims.
Number | Date | Country | |
---|---|---|---|
Parent | 09823935 | Mar 2001 | US |
Child | 11417749 | May 2006 | US |