www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/04/01:13:14

From: mstucky AT tiac DOT net (Mark B. Stucky)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro 3D : Sorting Polygons
Date: Fri, 04 Apr 1997 01:35:24 GMT
Organization: The Internet Access Company, Inc.
Lines: 34
Message-ID: <33445751.222266432@news.tiac.net>
References: <E7rD4t DOT 9zL AT news DOT uwindsor DOT ca> <5hmmtt$5bg$1 AT news0 DOT xs4all DOT nl> <3341AAEF DOT 52E5 AT cam DOT org> <33419DA2 DOT 544FE8A1 AT caldera DOT com> <5i1541$h1q$1 AT news0 DOT xs4all DOT nl>
NNTP-Posting-Host: mstucky.tiac.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019