When is painter's algorithm required with Z-buffer algorithm?

473 views Asked by At

According to my teacher, in some situations, Z-buffer algorithm needs the painter's algorithm to render a 3D scene in a 2D image.

I thought Z-buffer algorithm as an extension, an enhancement of painter's one : for me, Z-buffer algorithm can do all what painter's one is able to do, and even more (intersection of polygons and cyclic overlaps).

However, in some situations, Z-buffer algorithm can't work correctly if painter's one isn't used... What are these situations ?

2

There are 2 answers

1
Iłya Bursov On

At least one reason from wiki

These and other flaws with the algorithm led to the development of Z-buffer techniques, which can be viewed as a development of the painter's algorithm, by resolving depth conflicts on a pixel-by-pixel basis, reducing the need for a depth-based rendering order. Even in such systems, a variant of the painter's algorithm is sometimes employed. As Z-buffer implementations generally rely on fixed-precision depth-buffer registers implemented in hardware, there is scope for visibility problems due to rounding error. These are overlaps or gaps at joints between polygons. To avoid this, some graphics engine implementations "overrender", drawing the affected edges of both polygons in the order given by painter's algorithm. This means that some pixels are actually drawn twice (as in the full painter's algorithm) but this happens on only small parts of the image and has a negligible performance effect.

0
thewhiteambit On

The only situation I can imagine is when using transparency, because the Z-Buffer does not work when the transparency method used requires sorting. Imagine an upfront primitive already being drawn and the Z-Buffer being filled already, then primitives drawn later would be skipped. When drawing sorted, you can draw from back to front.