Content deleted Content added
adding Template:Computer graphics |
Citation bot (talk | contribs) Removed URL that duplicated identifier. Removed parameters. | Use this bot. Report bugs. | Suggested by Headbomb | Linked from Wikipedia:WikiProject_Academic_Journals/Journals_cited_by_Wikipedia/Sandbox | #UCB_webform_linked 10/967 |
||
(25 intermediate revisions by 14 users not shown) | |||
Line 1:
{{Short description|Algorithm for visible surface determination in 3D
{{Distinguish|Schlemiel the Painter's algorithm}}
[[File:Genesis fractal landscape software (Commodore Amiga).webm|thumb
The '''painter's algorithm''' (also '''depth-sort algorithm''' and '''priority fill''') is an algorithm for [[Hidden-surface determination#Visible surface determination|visible surface determination]] in [[3D computer graphics]] that works on a [[polygon|polygon-by-polygon]] basis rather than a [[pixel|pixel-by-pixel]], row by row, or area by area basis of other [[hidden-surface determination]] algorithms.<ref>{{Cite journal|last=Appel|first=Arthur|date=1968|editor-last=Morrel|editor-first=A. J. H.|title=On calculating the illusion of reality|url=http://graphics.stanford.edu/courses/Appel.pdf |archive-url=https://web.archive.org/web/20080720031432/http://graphics.stanford.edu/courses/Appel.pdf |archive-date=2008-07-20 |url-status=live|journal=Information Processing, Proceedings of IFIP Congress 1968, Edinburgh, UK, 5-10 August 1968, Volume 2 - Hardware, Applications|pages=945–950}}</ref><ref>{{Cite journal|last=Romney|first=Gordon Wilson|date=1969-09-01|title=Computer Assisted Assembly and Rendering of Solids.|url=https://apps.dtic.mil/sti/citations/AD0753673|archive-url=https://web.archive.org/web/20201102232139/https://apps.dtic.mil/sti/citations/AD0753673|url-status=live|archive-date=November 2, 2020|language=en}}</ref><ref>Gary Scott Watkins. 1970. [https://archive.org/details/utech-csc-70-101_watkins_dissertation_jun70 "A real time visible surface algorithm. Ph.D. Dissertation."] The University of Utah. Order Number: AAI7023061.</ref> The painter's algorithm creates images by sorting the polygons within the image by their depth and placing each polygon in order from the farthest to the closest object.<ref name=":0" /><ref>{{Cite journal|last=Bouknight|first=W. Jack|date=1970-09-01|title=A procedure for generation of three-dimensional half-toned computer graphics presentations|journal=Communications of the ACM|volume=13|issue=9|pages=527–536|doi=10.1145/362736.362739|s2cid=15941472|issn=0001-0782|doi-access=free}}</ref>
The painter's algorithm was initially proposed as a basic method to address the == Algorithm ==
Line 19 ⟶ 20:
=== Time complexity ===
The painter's algorithm's time-complexity
=== Space complexity ===
The painter's algorithm's worst-case space-complexity is ''O''(''n+m''), where ''n'' is the number of polygons and ''m'' is the number of pixels to be filled.
== Advantages ==
There are two primary technical requisites that favor the use of the
=== Basic graphical structure ===
The painter's algorithm is not as complex in structure as its other depth sorting algorithm counterparts.<ref name=":1" /><ref>{{Cite journal|last=Warnock|first=John E.|date=1969-06-01|title=A Hidden Surface Algorithm for Computer Generated Halftone Pictures|url=https://apps.dtic.mil/sti/citations/AD0753671|archive-url=https://web.archive.org/web/20201108193625/https://apps.dtic.mil/sti/citations/AD0753671|url-status=live|archive-date=November 8, 2020|language=en}}</ref> Components such as the depth-based rendering order, as employed by the
=== Memory efficiency ===
In the early 70s, when the
== Limitations ==
[[File:Painters problem.svg|thumb|Overlapping polygons can cause the algorithm to fail.]]
The algorithm can fail in some cases, including cyclic overlap or piercing polygons.
=== Cyclical
In the case of cyclic overlap, as shown in the figure to the right, Polygons A, B, and C overlap each other in such a way that it is impossible to determine which polygon is above the others. In this case, the offending polygons must be cut to allow sorting.<ref name=":0" />
Line 43 ⟶ 46:
=== Efficiency ===
In basic implementations, the painter's algorithm can be inefficient. It forces the system to [[rendering (computer graphics)|render]] each point on every polygon in the visible set, even if that polygon is occluded in the finished scene. This means that, for detailed scenes, the painter's algorithm can overly tax the computer hardware.
== Reducing visual errors ==
There are a few ways to reduce the visual errors that can happen with sorting:
=== Binary Space Partitioning ===
BSP is a method that involves making a BSP tree, and splitting triangles where they intersect. It can be extremely hard to implement, but it fixes most visual errors.
=== Backface culling ===
Backface culling involves calculations to see if a triangles points will appear clockwise or counter-clockwise once projected to the screen, and doesn't draw triangles that shouldn't be visible anyway. It reduces some visual errors, as well as reducing the total triangles drawn.
== Variants ==
Line 52 ⟶ 65:
== Other computer graphics algorithms ==
The flaws of painter's algorithm led to the development of [[Z-buffering|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.<ref>{{Cite book|last=Nyberg|first=Daniel|url=http://urn.kb.se/resolve?urn=urn:nbn:se:kth:diva-130849|title=Analysis of Two Common Hidden Surface Removal Algorithms, Painter
== References ==
* {{cite book
|last1 |first1
|author-link
|title = Computer Graphics: Principles and Practice
|publisher = [[Addison-Wesley]]
Line 68 ⟶ 82:
|last3 = Hughes
|first3 = John F.
|title-link = Computer Graphics: Principles and Practice
|author-link3 = John F. Hughes (computer scientist)
}}
|