for( each pixel(i, j) ) // clear Z-buffer and frame buffer
{
z_buffer[i][j] = far_plane_z;
color_buffer[i][j] = background_color;
}
for( each face A)
for( each pixel(i, j) in the projection of A)
{
Compute
depth z and color c of A at (i,j);
if( z > z_buffer[i][j] )
{
z_buffer[i][j] = z;
color_buffer[i][j] = c;
}
}