top of page
Dhruv Badaya

Why is depth-sort algorithm for visible surface determination called painter’s algorithm?

The painter's algorithm is a technique used in computer graphics to determine which surfaces (or parts of surfaces) of 3D objects are visible from a given viewpoint. The basic idea is to render surfaces in a back-to-front order, so that closer surfaces are painted over farther ones. This ensures that the visible parts of objects are correctly displayed, and hidden parts are not shown.


When a painter creates a painting, especially one that depicts a complex scene with overlapping objects, they often paint the background first and then successively paint the foreground objects on top. This process can be broken down into steps:

  1. Paint the sky and distant landscape: These are the farthest elements.

  2. Paint intermediate objects: Trees, buildings, and other mid-ground elements.

  3. Paint the nearest objects: Foreground elements like people, animals, or any objects that are closest to the viewer.

By following this sequence, the painter ensures that each new layer covers parts of the previous layers as necessary, creating a realistic depth effect.


In computer graphics, the painter's algorithm works in a similar way:

  1. Sort all surfaces by their depth: Calculate or determine the distance of each surface from the viewpoint.

  2. Render surfaces from back to front: Start with the farthest surfaces and proceed to the nearest.


The depth-sort algorithm for visible surface determination is called the "painter's algorithm" because it mimics the technique used by painters to create a sense of depth in their paintings.

195 views0 comments

Commenti


bottom of page