A Painter's Algorithm
The painter's algorithm, sometimes called depth-sorting, gets its name from the process
which an artist renders a scene using oil paints. First, the artist will paint the
background colors of the sky and ground. Next, the most distant objects are painted,
then the nearer objects, and so forth. Note that oil paints are basically opaque,
thus each sequential layer completely obscures the layer that its covers.
A very similar technique can be used for rendering objects in a three-dimensional scene.
First, the list of surfaces are sorted according to their distance from the viewpoint.
The objects are then painted from back-to-front.
While this algorithm seems simple there are many subtleties. The first issue is
which depth-value do you sort by? In general a primitive is not entirely at a single
depth. Therefore, we must choose some point on the primitive to sort by.
|