## Painter AlgorithmIt came under the category of list priority algorithm. It is also called a Objects are arranged in increasing order to z coordinate. Rendering is done in order of z coordinate. Further objects will obscure near one. Pixels of rear one will overwrite pixels of farther objects. If z values of two overlap, we can determine the correct order from Z value as shown in fig (a). If z objects overlap each other as in fig (b) this correct order can be maintained by splitting of objects. Depth sort algorithm or painter algorithm was developed by Newell, sancha. It is called the painter algorithm because the painting of frame buffer is done in decreasing order of distance. The distance is from view plane. The polygons at more distance are painted firstly. The concept has taken color from a painter or artist. When the painter makes a painting, first of all, he will paint the entire canvas with the background color. Then more distance objects like mountains, trees are added. Then rear or foreground objects are added to picture. Similar approach we will use. We will sort surfaces according to z values. The z values are stored in the refresh buffer. ## Steps performed in-depth sort- Sort all polygons according to z coordinate.
- Find ambiguities of any, find whether z coordinate overlap, split polygon if necessary.
- Scan convert each polygon in increasing order of z coordinate.
## Painter Algorithm
- Does A is behind and non-overlapping B in the dimension of Z as shown in fig (a)
- Does A is behind B in z and no overlapping in x or y as shown in fig (b)
- If A is behind B in Z and totally outside B with respect to view plane as shown in fig (c)
- If A is behind B in Z and B is totally inside A with respect to view plane as shown in fig (d)
The success of any test with single overlapping polygon allows F to be painted. Next TopicScan Line Algorithm |