Home | | Computer Aided Design | Painter’s Algorithm

Chapter: Mechanical : Computer Aided Design : Visual Realism

Painter’s Algorithm

The painter's algorithm is called as a priority fill, is one of the easiest results to the visibility issue in three dimensional graphics.

Painter’salgorithm

 

The painter's algorithm is called as a priority fill, is one of the easiest results to the visibility issue in three dimensional graphics. When projecting a 3D view onto a 2D screen, it is essential at various points to be finalized which polygons are visible, and which polygons are hidden.


Fig.3.4. Painter’salgorithm

 

The ‘painter's algorithm’shows to the method employed by most of the painters of painting remote parts of a scene before parts which are close thereby hiding some areas of distant parts. The painter's algorithm arranges all the polygons in a view by their depth and then paints them in this order, extreme to closest. It will paint over the existing parts that are usually not visible hence solving the visibility issue at the cost of having painted invisible areas of distant objects. The ordering used by the algorithm is referred a 'depth order', and does not have to respect the distances to the parts of the scene: the important characteristics of this ordering is, somewhat, that if one object has ambiguous part of another then the first object is painted after the object that it is ambiguous. Thus, a suitable ordering can be explained as a topological ordering of a directed acyclic graph showing between objects.

 

 

Algorithm:

 

sort objects by depth, splitting if necessary to handle intersections; loop on objects (drawing from back to front)

 

{

 

loop on y within y range of this object

 

{

 

loop on x within x range of this scan line of this object

 

{

 

image[x,y] = shade(x,y);

 

}

 

}

 

}

 

Basic operations:

 

1.     compute ‘y’range of an object

 

2.     compute ‘x’range of a given scan line of an object

3.     compute intersection point of  a given object with ray via pixel point (x,y).

 

4.     evaluate depth of two objects, determine if A is in front of B, or B is in front of A, if they don’t overlap in xy, or if they intersect

 

5.     divide one object by another object

 

 

Advantage of painter's algorithm is the inner loops are quite easy and limitation is sorting

 

operation.


Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Mechanical : Computer Aided Design : Visual Realism : Painter’s Algorithm |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.