Z-buffering is an algorithm used in 3-D graphics to ensure that perspective works the same way in the virtual world as it does in the real one: a solid object in the foreground will block the view of one behind it. You've seen this illustrated in the real world when someone stands between you and the television screen. Z-buffering is a type of algorithm known as a Visual Surface Determination (VSD) algorithm.
Z-buffering works by testing pixel depth and comparing the current position ( z coordinate ) with stored data in a buffer (called a z-buffer ) that holds information about each pixel's last postion. The pixel in the closer position to the viewer is the one that will be displayed, just as the person in front of the television is what the viewer sees rather than the screen.
Z-buffering is one of three VSD algorithms commonly used for this purpose. The other two, BSP trees and depth sorting, work with polygons and consequently are less effective for portrayal of movement and overlap. Since it works at the pixel level, z-buffering can be demanding in terms of memory and processing time. Nevertheless, its more complex and life-like simulation of real-world object dynamics ensures its continuing popularity as a 3-D graphics development tool.