Painter's algorithm: Difference between revisions

Content deleted Content added
Fredrik (talk | contribs)
changing "Painter's algorithm" to "painter's algorithm"
Fredrik (talk | contribs)
m wording
Line 1:
The '''painter's algorithm''' 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 at some point, you neednecessary to decide which [[polygon]]s are visible and which are hidden.
 
The name "painter's algorithm" refers to a simple-minded painter who paints the distant parts of a scene at first and then covers them by those parts which are nearer. Similarly, whenthe you want to use thispainter's algorithm in your rendering system, you first sortsorts all the polygons by their depth and then paintpaints them in this order. YouIt will over-paint the parts that are normally not visible and thus solvesolves the visibility problem.
 
[[Image:Painter's_algorithm.png|600px|center|thumb|The distant mountains are painted first, followed by the closer meadows; finally, the closest objects in this scene - the trees - are painted.]]
 
Note that this approach has several problems. What happens when polygon A partly covers B, B partly covers C and C partly covers A again? It's not possible to decide which polygon is above the others. Or when two polygons intersect one another in three dimensions? The painter's algorithm will fail in these cases.
Note that this approach has several problems.
What happens when polygon A partly covers B, B partly covers C and C partly covers A again? It's not possible to decide which polygon is above the others. Or when two polygons intersect one another in three dimensions? The painter's algorithm will fail in these cases.
 
[[Image:Painters_problem.png|Image: how painter's algorithm fail]]