Painter's algorithm

Painter's algorithm

The painter's algorithm, also known as a priority fill, is one of the simplest solutions to the visibility problem in 3D computer graphics. When projecting a 3D scene onto a 2D plane, it is necessary at some point to decide which polygons are visible, and which are hidden.

The name "painter's algorithm" refers to the technique employed by many painters of painting distant parts of a scene before parts which are nearer thereby covering some areas of distant parts. The painter's algorithm sorts all the polygons in a scene by their depth and then paints them in this order, furthest to closest. It will paint over the parts that are normally not visible -- thus solving the visibility problem -- at the cost of having painted redundant areas of distant objects.

The algorithm can fail in certain cases. In this example, Polygons A, B, and C overlap each other. It's not possible to decide which polygon is above the others. In this case, the offending polygons must be cut to allow sorting. Newell's algorithm, proposed in 1972, provides a method for cutting such polygons. Numerous methods have also been proposed in the field of computational geometry.

In basic implementations, the painter's algorithm can be inefficient. It forces the system to 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.

A reverse painter's algorithm is sometimes used, in which objects nearest to the viewer are painted first -- with the rule that paint must never be applied to parts of the image that are already painted. In a computer graphic system, this can be very efficient, since it is not necessary to calculate the colors (using lighting, texturing and such) for parts of the more distant scene that are hidden by nearby objects. However, the reverse algorithm suffers from many of the same problems as the standard version.

These and other flaws with the algorithm led to the development of 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. Even in such systems, a variant of the painter's algorithm is sometimes employed. As Z-buffer implementations generally rely on fixed-precision depth-buffer registers implemented in hardware, there is scope for visibility problems due to rounding error. These are overlaps or gaps at joins between polygons. To avoid this, some graphics engine implementations "overrender"Fact|date=January 2008, drawing the affected edges of both polygons in the order given by painter's algorithm. This means that some pixels are actually drawn twice (as in the full painters algorithm) but this happens on only small parts of the image and has a negligible performance effect.


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Schlemiel the painter's Algorithm — In software development, a Schlemiel the Painter [ s] algorithm denotes any methodology that is inefficient because the programmer has overlooked some fundamental issues at the very lowest levels of software design. The term was coined by… …   Wikipedia

  • Painter's Algorithmus — Zuerst werden die Berge gezeichnet, dann der Boden und zuletzt die Bäume Der Maleralgorithmus (engl. painter s algorithm) ist eine einfache Lösung des Sichtbarkeitsproblems in der 3D Computergrafik. Bei der Darstellung einer dreidimensionalen… …   Deutsch Wikipedia

  • Newell's algorithm — is a 3D computer graphics procedure for elimination of polygon cycles in the depth sorting required in hidden surface removal. It was proposed in 1972 by brothers Martin Newell and Dick Newell, and Tom Sancha, while all three were working at… …   Wikipedia

  • Binary space partitioning — (BSP) is a method for recursively subdividing a space into convex sets by hyperplanes. This subdivision gives rise to a representation of the scene by means of a tree data structure known as a BSP tree.In simpler words, it is a method of breaking …   Wikipedia

  • Z-buffering — Z buffer data In computer graphics, z buffering is the management of image depth coordinates in three dimensional (3 D) graphics, usually done in hardware, sometimes in software. It is one solution to the visibility problem, which is the problem… …   Wikipedia

  • List of algorithms — The following is a list of the algorithms described in Wikipedia. See also the list of data structures, list of algorithm general topics and list of terms relating to algorithms and data structures.If you intend to describe a new algorithm,… …   Wikipedia

  • Список алгоритмов — Эта страница информационный список. Основная статья: Алгоритм Ниже приводится список алгоритмов, группированный по категориям. Более детальные сведения приводятся в списке структур данных и …   Википедия

  • Stacking window manager — A stacking window manager is a window manager that draws all windows in a specific order, allowing them to overlap, using a technique called painter s algorithm. All window managers which allow the overlapping of windows, but are not compositing… …   Wikipedia

  • Stаcking window manager — A stacking window manager is a window manager that draws all windows in a specific order, allowing them to overlap, using a technique called painter s algorithm. All window managers which allow the overlapping of windows, but are not compositing… …   Wikipedia

  • List of mathematics articles (P) — NOTOC P P = NP problem P adic analysis P adic number P adic order P compact group P group P² irreducible P Laplacian P matrix P rep P value P vector P y method Pacific Journal of Mathematics Package merge algorithm Packed storage matrix Packing… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”