Computer systems are utilized extensively to render objects on a display screen. As is well known, typical rendering systems require some form of antialiasing to remove the jagged edges that are present when images are rendered with a single point-sample per pixel. There are two general approaches for antialiasing images.
Supersampling/Multisampling
The simplest approach is to sample the image at multiple sample points per pixel, effectively computing a high resolution image, which is filtered down by averaging the samples within a pixel or using a weighted average of samples based on a filter kernel. This scheme is called supersampling. Supersampling is simple and robust, but has disadvantages of requiring rendering time, frame-buffer storage costs, and frame-buffer bandwidth costs that are proportional to the number of samples per pixel. Typically, between four and 16 samples per pixel are required for acceptable results, so the overall cost of supersampling is roughly four to 16 times that of normal rendering.
Multisampling is a variant of supersampling. As in supersampling, the scheme provides storage for multiple samples per pixel and the final image is computed by filtering the samples per pixel. However, in multisampling, rather than computing the color and depth value for each sample independently, a single color and depth (perhaps including slope information) is computed at the center of each pixel, along with a coverage mask indicating which samples are covered by the primitive being rendered. The sample locations indicated by the mask, and which pass the depth test, are then updated using the single shared color for all samples within the pixel. Multisampling reduces rendering costs to little more than that of normal rendering, but the storage and bandwidth costs are the same as for supersampling.
A-Buffer
The second general scheme for generating antialiased images is referred to as the A-buffer. An A-buffer scheme maintains, for each pixel, a list of “fragments” from surfaces that are potentially visible at the pixel. A fragment generally consists of color information, depth information, and coverage information that describe the contribution of a surface to a pixel. Depth information may consist of a single depth value or a depth value and slopes. Coverage normally consists of a coverage bitmask, indicating which of a set of subpixel sample points the fragment covers, but it may also contain a coverage fraction. In the most general A-buffer scheme, the fragment list stores information for every surface that is potentially visible at a pixel. Since there is no bound to the number of surfaces that can be visible at a pixel, the fragment list can become arbitrarily large. The A-buffer scheme allows for high-quality antialiasing with storage and bandwidth costs that are proportional to the complexity at each pixel. However, supporting variable and potentially unbounded amounts of information per pixel adds significant costs and complexity to the overall system. Furthermore, provisions must be made to handle scenes that are too complex to be represented using the finite resources available in a given system.
Reduced A-buffer algorithms have been proposed which limit the number of fragments per pixel to some small number, typically two to four fragments per pixel, providing many of the advantages of A-buffering with the fixed memory requirements of supersampling/multisampling. Typically, when a fragment is introduced which exceeds the fixed number of fragments that can be stored, the two fragments that are most similar (based on criteria such as coverage, depth, similarity of color, or combinations of these) are merged to form a single fragment.
Reduced A-buffer algorithms are appealing because of their low storage costs. However, artifacts can result from merging fragments. Additional fragments that lie between two fragments that have been merged will be handled incorrectly.
Multi-pass rendering, in which objects are rendered multiple times to apply multiple textures or perform complex shading, can also lead to artifacts. Multipass rendering generally uses a depth-equality test during second and third passes to identify pixels that should participate in the multipass update. If fragments are merged during the initial rendering pass, the depth values of fragments in later passes will not match, so pixel values will not be updated as intended.
Fragment merging effectively changes the subpixel geometry of the scene. As can be understood from the above, a variety of other types of artifacts can result from this changed subpixel geometry. This is a serious limitation of previous reduced A-buffer algorithms.
Accordingly, what is desired is an antialiasing scheme that combines the advantages of the reduced A-buffer algorithm's low fixed-storage requirements, and supersampling/multisampling's robustness for complex images and support for multipass algorithms. The system should be easy to implement, cost-effective, and fit within the framework of existing systems. The present invention addresses this need.