Doc Eng Logo
University of Nottingham CS
Home People Research

Overview

It's easy to sort the umpteen surfaces into display order because of the rather simple nature of the scene (for instance, no two surfaces intersect). The algorithm used to determine whether or not a surface is entirely hidden by others is not ideal, and I would appreciate suggestions of alternatives. It is based on the depth-buffer or z-buffer method more properly used for raster output.

Conceptually, a grid is drawn over the viewing area, and each cell is initialised to zero. 1 is added to each cell for each surface which it covers (regardless of whether that surface will end up being visible). Then each surface is considered in turn, deepest first. Each cell which covers the surface gets 1 subtracted from it. If any cell ends up with the value zero, the surface is required (it is the only one which contributes to that cell). Otherwise it may be omitted.

Bits and Bobs

The algorithm works OK as long as there are `enough' cells. It can really only be guaranteed to work if there is a cell for each pixel, but in a scalable PDF file there are an infinite number of pixels. I use 40x60 cells, and this is `enough' for the detail in the 8x8 Mazeworld 3.

Checking to see if a cell covers (or is covered by?) a surface is done with the aid of the PostScript Level 2 infill operator for each corner of the cell. Doing this many times causes Distill time to shoot up to over an hour for Mazeworld 3 on a 50MHz 486

The extra code also bumps up the PostScript program from a lithe 12K to a rather portly 19K, but if you've bothered to read this far, you'll know it's worth it.