Mail Archives: djgpp/1997/04/04/01:13:14
On 3 Apr 1997 20:49:05 GMT, ellman AT xs4all DOT nl () wrote:
>In article <33419DA2 DOT 544FE8A1 AT caldera DOT com>, Tim Bird <tbird AT caldera DOT com> wrote:
>>Tudor wrote:
>>>ellman AT xs4all DOT nl wrote:
>>>> Alternative approaches are to use the Painter's algorithm or Z buffering.
>>>What is the Painter's algorithm, if you don't mind?
>>
>>Painting the items back-to-front. All you have to do is order
>>the things to be drawn by distance and draw everything. If
>>there are lots of overlaps, this gets wasteful, since you end
>>up drawing lots of pixels multiple times. But it's easy to
>>code.
>
>Actually, that's depth sorting. The painter's algorithm is to convert all the
>polygons into a set of polygons that consist of only what is to be displayed.
>It eliminates any hidden polygons, and breaks up any partially-hidden polygons.
No, the previous description is basically correct.
The Painter's Algorithm is a simple hidden surface algorithm that
works on raster devices or any device that allows you to "paint" over
the top of something that was drawn previously. That's where the
algorithm gets it's name, a painter paints the background first and
then covers it with parts of the scene that are closer. All you have
to do is draw the polygons that are furthest from the "eye" first and
proceed to the polygons that are closer. This works fine if none
of the polygons intersect each other. If there is intersection of
polygons, you need break up the intersecting polygons into
smaller areas that don't intersect.
--Mark
mstucky AT tiac DOT net
- Raw text -