A-Buffer Method in C/C++?


A-Buffer technique in computer graphics is a simple hidden face detection mechanism used to medium scale virtual memory computers. This technique is also known as anti-aliased or area-averaged or accumulation buffer. This technique extends the algorithm of depth-buffer (or Z Buffer) technique. As the depth buffer technique can only be implemented for opaque object but not for transparent object, the A-buffer technique provides advantage in this scenario. Though the A buffer technique requires more memory, but different surface colors can be correctly composed implementing it. Being a descendent of the Z-buffer algorithm, each position in the buffer can locate or reference a linked list of surfaces. The key data structure in the A buffer is treated as the accumulation buffer.

Each position in the A buffer contains 2 fields −

  • Intensity field or Surface data field

  • Depth field

A depth field stores a negative or positive real number. A surface data field can stores a pointer to a linked list of surfaces that contribute to that pixel position or surface intensity information.

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 second field, i.e, the intensity field then stores the RGB components of the surface color at that point and the percent of pixel coverage.

By depth < 0, multiple-surface contributions to the pixel intensity is indicated. The second field, that means, the intensity field then is able to store a pointer to a linked list of surface data.

A buffer technique is slightly costly than Z-buffer technique because it needs more memory in comparison to the Z-buffer technique. Here, the depth and opacity are implemented to determine the final color of the pixel.

The surface buffer in the A buffer method consists of −

  • Surface Identifier

  • Depth

  • Percent of area coverage

  • Opacity Parameter

  • Pointer to the next surface

  • RGB intensity components

The other advantage of A buffer technique is that it provides anti-aliasing in addition to what Z-buffer performs.

Updated on: 29-Jan-2020

965 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements