Resources:
A Hidden Surface Elimination algorithm which ignores transparency. It uses a color buffer, and a depth buffer. Each new primitive is checked against the current z buffer, and if it is closer (smaller), then the depth buffer is updated, and the color is also updated. The code below is the core of the algorithm.
Where
- is the pixel of interest
- is the current stored value in that point (depth and color).
Runtime is either or , where
Depth complexity is the average number of depth tests per pixel.