Prerequisite : depth-buffer (or Z Buffer) method
A-Buffer method in computer graphics is a general hidden face detection mechanism suited to medium scale virtual memory computers. This method is also known as anti-aliased or area-averaged or accumulation buffer. This method extends the algorithm of depth-buffer (or Z Buffer) method. As the depth buffer method can only be used for opaque object but not for transparent object, the A-buffer method provides advantage in this scenario. Although the A buffer method requires more memory, but different surface colors can be correctly composed using it. Being a descendant of the Z-buffer algorithm, each position in the buffer can reference a linked list of surfaces. The key data structure in the A buffer is the accumulation buffer.
Each position in the A buffer has 2 fields :
1) Depth field
2) Surface data field or Intensity field
A depth field stores a positive or negative real number. A surface data field can stores surface intensity information or a pointer to a linked list of surfaces that contribute to that pixel position.
As shown in the above figure, if the value of depth is >= 0, the number stored at that position is the depth of single surface overlapping the corresponding pixel area. The 2nd field, i.e, the intensity field then stores the RGB components of the surface color at that point and the percent of pixel coverage.
As shown in the above figure, multiple-surface contributions to the pixel intensity is indicated by depth < 0. The 2nd field, i.e, the intensity field then stores a pointer to a linked list of surface data.
A buffer method is slightly costly than Z-buffer method because it requires more memory in comparison to the Z-buffer method. It proceeds just like the depth buffer algorithm. Here, the depth and opacity are used to determine the final color of the pixel. As shown in the figure below, the A buffer method can be used to show the transparent objects.
The surface buffer in the A buffer method includes :
- Surface Identifier
- Opacity Parameter
- Percent of area coverage
- RGB intensity components
- Pointer to the next surface
The other advantage of A buffer method is that it provides anti-aliasing in addition to what Z-buffer does. The usage of A-buffer algorithm for the transparent surfaces is as shown below :
On applying the A-buffer method on all the six surfaces indicated below, the corresponding colors are as :
In A-buffer method, each pixel is made up of a group of sub-pixels. The final color of a pixel is computed by summing up all of its sub-pixels. Due to this accumulation taking place at sub-pixel level, A-buffer method gets the name accumulation buffer.