Zbuffer
An image/screen space algorithm.
Employs 2 [see page 7, buffers]:
Buffer | Meaning |
---|---|
Color Buffer | The color for each pixel on the screen. |
ZBuffer | The depth into the screen for each pixel in the color buffer. |
The basic idea behind the algorithm is keep a copy of the entire screen in memory and keep trying to draw objects onto it. Keep track of the color of each pixel and its z-index and only remember those pixels that're closest to the screen (erasing further away pixels). See [see page 17, here].
Disadvantages
- Over renders - renders pixels even those that get overwritten.
- Lots of memory - one RGBA pixel = 4 bytes, 1920x1080 pixels. About 66mb.
- Possible depth [see page 21, quantization] errors. (two surfaces intersect unnaturally).
- Rendering [see page 22, transparent] objects is a pain.
- [see page 23, clipping] - two surfaces could be close to enough to each other to fight over which is on top.