One of the most costly operations in computer graphics is shadow
casting. One of NuGraf's most advanced features is its method of casting shadows. The
technique used is called Depth Map Shadows, which is commonly used in high-end
rendering systems. The method allows for rendering soft and diffuse shadows with minimal
overhead. With this shadow casting technique a "z depth map" is created relative
to the viewpoint of each light source; this is illustrated in the following two images.
The right image is a "z depth" snapshot of the scene as viewed from the light
source (brighter areas are farther from the light) and the left image is a rendering made
relative to the camera location which uses the z-depth map to determine where shadows
should be placed.
Figure 11: Image With Shadows
Figure 12: Z Depth Map
NuGraf's implementation of depth map shadows sports several advanced
and possibly unique features:
The z-map, used to determine whether an object is in shadow, is
generated as a series of small tiles which represent diced regions of the original z-map.
This dicing procedure allows significant parts of the z-map to be thrown away, thus
reducing disk and memory requirements. While 512x512 z-maps would normally require 1Mb,
dicing reduces this figure to 300k on average. It is believed that this dicing strategy is
unique to NuGraf's implementation of depth map shadows.
The z-map data within each tile is rearranged to maximize virtual
memory paging efficiency.
Bounding boxes and statistics computed for each z-map tile are used
to speed the shadow generation algorithm.
The shadow map data can either be entirely read into memory for
maximum access speed, or kept on disk and paged into memory to a cache that maintains the
most recently accessed z-map tiles. This advanced feature is a fundamental requirement to
making NuGraf run on machines with little memory.
A special depth-map generation algorithm has been developed to remove
the black Moire patterns often associated with depth-map shadow implementations.
With the inclusion of the above advanced features and optimizations,
each additional light source added to a scene only increases rendering time by a factor of
1.25.