The vzTMGradientShader is a built-in shader to be used with the
vzTMRenderAction. The shader implements a 3-pass shading
algorithm to perform gradient shading of volume data. The shader
uses two perfectly overlapping volumes to perform the gradient shading.
The first volume defines the actual volume data, while the other volume
defines the gradient for the first volume. The RGB values of the
gradient texture provide the (a, b, c) coefficients for the gradient at
each texel in the original volume.
The shader computes the dot product of the gradient values with the
light direction using the OpenGL Imaging pipeline. This is done
efficiently by setting the appropriate color matrix before downloading
the gradient texture. Changing the light direction forces
the gradient texture to be re-downloaded in order to re-compute the
dot products with the new light direction. In addition, the shader
accepts a lookup table parameter to apply transfer functions to
the volume data. The shader allows controlling the diffuse and ambient
coefficients using two optional parameters. If not specified, the diffuse
coefficient is assumed to be (1.0, 1.0, 1.0) and the ambient to be
(0.0, 0.0, 0.0).
PARAMETERS
The shader expects six parameters. Two of these parameters, namely ambient
and diffuse, are optional parameters:
Note: The shading algorithm uses destination alpha to compute
the gradient lighting. Hence, the application should make
sure that the appropriate visual is selected.