Given a 3D volume and a contour value, SHADE_VOLUME produces a list of vertices and polygons describing the contour surface. This surface can then be displayed as a shaded surface by the POLYSHADE procedure. Shading is obtained from either a single light-source model or from user-specified values.
SHADE_VOLUME computes the polygons that describe a three dimensional contour surface. Each volume element (voxel) is visited to find the polygons formed by the intersections of the contour surface and the voxel edges. The method used by SHADE VOLUME is that of Klemp, McIrvin and Boyd, 1990: "PolyPaint--A Three-Dimensional Rendering Package," American Meteorology Society Proceedings, Sixth International Conference on Interactive Information and Processing Systems . This method is similar to the marching cubes algorithm described by Lorenson and Cline, 1987: "Marching Cubes: A High Resolution 3D Surface Construction Algorithm," Computer Graphics 21 , 163-169.
This routine is limited to processing datasets that will fit in memory.
A three-dimensional array that contains the dataset to be contoured. If the
array is dimensioned
, the resulting vertex coordinates are as follows:
0 < X < D 0 - 1; 0 < Y < D 1 - 1; 0 < Z < D 2 - 1.
A named variable to receive the polygon list, an m -element, longword array. This list describes the vertices of each polygon and is suitable for input to POLYSHADE. The vertices of each polygon are listed in counterclockwise order when observed from outside the surface. The vertex description of each polygon is a vector of the form: [ n , i 0 , i 1 , ..., i n-1 ] and the Poly array is the concatenation of the lists of each polygon. For example, when rendering a pyramid consisting of four triangles, Poly would contain 16 elements, made by concatenating four, four-element vectors of the form [3, V 0 , V 1 , V 2 ]. V 0 , V 1 , and V 2 are the indices of the vertices describing each triangle.
Set this keyword to display the low side of the contour surface (i.e., the contour surfaces enclose high data values). If this keyword is omitted or is 0, the high side of the contour surface is displayed and the contour encloses low data values. If this parameter is incorrectly specified, errors in shading will result.
An optional array, converted to byte type before use, that contains the user-specified shading color index for each voxel. This array must have the same dimensions as Volume . On exit, this array is replaced by another array, that contains the shading value for each vertex, contained in Vertex .
When using the SHADES keyword on True Color devices, we recommend that decomposed color support be turned off, by setting DECOMPOSED=0 for
The following procedure shades a volume passed as a parameter. It uses the SCALE3 procedure to establish the viewing transformation. It then calls SHADE_VOLUME to produce the vertex and polygon lists, and POLYSHADE to draw the contour surface.