Central to every rendering system is a rendering engine which
converts the mathematical descriptions of the modeling primitives into shaded and
hidden-surface images. NuGraf sports a highly optimized and tuned scanline renderer which
is based upon a hybrid Z-buffer/A-buffer algorithm. NuGraf's hybrid algorithm performs all
computations on a pixel-area basis to aid in analytical antialiasing; this methodology is
extended to the transparency and 2D image texturing systems as well.
Over its lifetime the NuGraf renderer has been continually tweaked to
make it one of the fastest, most memory conservative and highest quality renderers
currently available. In order to minimize memory, the renderer does not allocate any
memory for an object until the current scanline intersects with its bounding box; at this
point the renderer begins to allocate memory for the object on a per-scanline and a
per-pixel basis. In addition, the renderer reuses memory from previous objects so that
costly and time consuming malloc()'s do not have to be performed.
Coverage area masks, as used by the A-Buffer algorithm, are used to accurately composite
polygon fragments smaller in size than a pixel; this ensures that no holes appear between
abutting polygon faces. It also provides a good degree of 'free' anti-aliasing along
polygon edges without turning the global anti-aliaser on and guarantees that the final
pixel color will not become supersaturated. The coverage masks are key to the transparency
calculations where they are used to determine which sub-pixel polygon fragments are
overlapping; this is an integral requirement of scanline-based transparency. The alpha
channel output from the renderer is computed as the total area coverage of the pixel
fragments within a pixel. In addition, the texture mapping, shadow casting and environment
mapping routines all perform area-based filtering calculations based on coordinates
interpolated at the four corners of a pixel; this ensures accurate adaptive filtering and
removes the need for user-adjustable filtering parameters as required by some other 3D
packages.
Output from the renderer can be sent to a number of predefined or host-defined output
drivers - from frame buffers to disk-based files. An integral part of the NuGraf Toolkit
is its 'User Defined Output Driver' mechanism; this mechanism allows new output
drivers to be dynamically linked into the toolkit via a single function call; it also
allows complex frame buffer or file output drivers to be written quickly and with ease (in
actual fact all the frame buffer and disk-base file output drivers provided with the
toolkit are written as 'User Defined' output drivers). Complete documentation is
provided with the toolkit which describes how to write new output drivers.