Z Buffering

Z Buffering

What is Z-Buffering?

Z-buffering is a method of drawing three dimensional objects properly. Without it, there is the danger of drawing an object in front of another one when it really belongs behind.

How is it done?

A z-buffer is an array with elements that correspond to the pixels on the screen. Each element contains the z value for the pixel that is closest to the view point. When each point is considered for drawing, the z coordinate is compared with that of the one already in the buffer. If it is further away, then no action is taken. If it is closer, though, the z-buffer value is updated and the screen buffer color at that coordinate is changed to reflect the now-closest pixel's.
Return to main page.