- 2072 Kartik · 10 marks
Compare Z-buffer, A-buffer; scan-line
Short answer
Z-buffer stores one surface per pixel, lacks transparency and anti-aliasing, while A-buffer stores a linked list per pixel with opacity and area coverage for blending. The scan-line method processes each scan line, maintaining an active edge list and polygon in/out flags; when multiple polygons are active, depths are computed to fill with the nearest colour.
Compare Z-buffer and A-Buffer algorithm. Also write algorithm to find visible surfaces using scan-line method.
Z-buffer vs A-buffer
| Point | Z-buffer | A-buffer |
|---|---|---|
| Surfaces kept per pixel | One (nearest) | Many (linked list) |
| Buffer fields | Depth value only (plus frame buffer) | Depth field and intensity/pointer field |
| Transparency | Not supported | Supported using opacity |
| Anti-aliasing | No | Yes, by area coverage (subpixel masks) |
| Memory | Less | More |
| Speed | Faster | Slower |
| Complexity | Simple | Complex |
| Application | Real-time rendering | High-quality offline rendering |
Scan-line algorithm to find visible surfaces
Data: edge table (end points, slope, polygon id), polygon table (plane coefficients A, B, C, D, colour, in/out flag), active edge list.
Initialise: build edge table and polygon table, set all flags to OUT.
for each scan line y from top to bottom:
add edges that start at y to the active edge list;
remove edges that end; update x of each edge (x = x - 1/m, since y decreases by 1);
sort active edges by x;
for each x-interval between consecutive edges:
toggle (IN/OUT) the flag of the polygon owning the edge crossed
count = number of polygons with flag IN in the interval
if count == 0:
fill interval with the background colour
else if count == 1:
fill interval with the colour of that polygon
else:
for each polygon IN, compute depth z = (-A*x - B*y - D)/C
fill interval with the colour of the polygon of smallest z
next scan line
Optimisation: if the polygons do not intersect, depth is computed only at the start of the interval, and scan-line coherence reuses the previous scan line's data.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Scan-line method of visible surface · Computer Graphics, chapter 7 · asked 3×
- A-buffer method · Computer Graphics, chapter 7 · asked 2×
- Z-buffer method with limitation · Computer Graphics, chapter 7 · asked 3×
- VSD factors, classes, Z/A-buffer · Computer Graphics, chapter 7
- DDA versus Bresenham line algorithm · Computer Graphics, chapter 2 · asked 6×
- Write Bresenham's line algorithm · Computer Graphics, chapter 2 · asked 3×