 |
vliso_shade
NAME
vliso_shade - Define the isosurfaces for
a specific variable in a given volume and shade the volume.
SYNOPSIS
#include <parvox.h>
void vliso_shade(vlvolume *vol, vlvariable
*variable,
int time_step, vlsurface *surface,
int num_surfaces)
DESCRIPTION
vliso_shade()
classifies the data volume of a specific variable
at a given time_step with the
isosurface definition defined in an array of vlsurface data structure
pointed by surface. num_surfaces
specifies the number of isosurfaces defined. vlsurface
is defined in vltypes.h as follows:
typedef struct surf
{
float threshold,
/* iso-surface threshold */
thickness; /* thickness in voxels */
vlcolor col;
/* color of this surface */
} vlsurface;
The color (col) of the surface can be specified
by the users, or determined by the threshold value and a predefined colormap
using vlpick_iso_color(). ParVox
renders multiple isosurfaces, each with a different opacity and color.
Levoy's classification algorithm ("Display of Surfaces from Volume Data",
IEEE Computer Graphics & Applications, May 1988) is used to define
the surfaces. When the voxel value is equal to the threshold
value, the opacity is set to the specified opacity (col.o); the
voxel opacities fall off as we move away from the threshold value at a
rate inversely proportional to the magnitude of the local gradient vector.
The thickness is used to define the transition region from the full
opacity to zero. When more than one isosurface is defined,
the classification has to be done all at once, in other words, all the
surfaces have to be defined and stored in surface array, then vliso_shade()
is called once to classify the volume. Prior to this function,
each isosurface may be individually enabled or disabled by vlenable_surface()
or vldisable_surface().
By default, all the surfaces are disabled. Whenever there is any
changes in the surface definition, such as add a new surface, change an
existing surface, or disable/enable an existing surface, vliso_shade()
has to be called again to reclassify the volume.
After the volume is classified, the volume is shaded.
The Torrance-Sparrow reflection model introduced by Blinn ("Models of Light
Reflection for Computer Synthesized Pictures", Proceedings of SIGGRAPH
1997) is used in ParVox. Blinn's shading model is less expensive
in computation comparing to Phong's model, but has comparable image quality.
The shading process requires the calculation of a normalized gradient vector
for each voxel. The magnitude of the gradient vector is also
required for classification. vliso_shade() will calculate
the gradient vectors, save the maginitudes of the gradient vectors in vlvariable
data structure, but discard the normalized vector after shading is done.
ParVox also provide calls to do shading and classification separately.
vlgradient_shade() calculates the gradient
vectors and stores the magnitudes of the gradient vectors in vlvariable
data structure, then do the shading. vliso_surface()
does the classification for multiple isosurfaces assuming the gradient
vector magnitudes are pre-calculated and stored. The
volume needs to be reshaded when the light source is changed or the material
setting is changed, and the volume needs to be reclassified when the isosurface
definition is changed. Therefore, it is recommended to
call vliso_shade() to classify and shade the volume for the first
time. Later on, if there is any changes in classification, call vliso_surface().
SEE ALSO
vlgradient_shade,
vliso_surface , vlpick_iso_color,
vlenable_surface, vldisable_surface,
vllight, vlmaterial
BACK TO INDEX
|
 |