Final-year Geometric Modelling Course

Rendering Algorithms

The Painter's Algorithm


This algorithm will make pictures of anything that is composed of polygons.

The Painter's Algorithm:


1. Split all the polygons into triangles.
2. Sort the triangles by distance from the eye.
3. Plot them in solid colour from the back forwards.



How do we decide what colour a triangle is?

Lambert's law: intensity of illumination is proportional to the cosine of the angle between the surface normal vector and the direction of the light (can be quickly computed using a scalar product; see the Revision notes).




Painter's algorithm problem:

Triangle A is in front of B, which is in front of C, which is in front of A...

Solution: work out the plane a triangle is in (B in this figure), and use it to chop the other triangles (A in this figure) into three whenever the problem is detected.



The painter's algorithm produces pictures like this:


Back to: Chapter 1.

© Adrian Bowyer 1996