SYNOPSIS
#include <volpack.h>
vpResult
-
vpShadeTable(vpc)
-
- vpContext *vpc;
ARGUMENTS
- vpc
- VolPack context from vpCreateContext.
DESCRIPTION
vpShadeTable computes the contents of the shading lookup table previously specified with vpLookupShader. For each entry in the table, the Phong shading equation is evaluated using the current lighting properties (as specified with vpSetLight), material properties (as specified with vpSetMaterial), and viewing parameters (as specified with the view transformation commands). See vpSetMaterial(3) for a description of the shading calculation.This function should be called before rendering a volume if any of the lighting or material properties have changed or if the viewpoint has changed since the last call to vpShadeTable. It should not be called if shading is performed using a callback function or if the shading lookup tables are initialized by a user-defined routine.
There is one state variable that affects the operation of vpShadeTable. If VP_CLAMP_SHADE_TABLE is enabled (see vpEnable(3)), then values are clamped to the range 0.0-255.0 before they are stored in the table. If this option is not enabled then no clamping is performed. Clamping is enabled by default, but can be turned off to achieve special effects. For example, if all of the voxels in a data set have very low opacity then the rendered image may be very dark. To brighten it, multiply all of the material parameter coefficients by a constant, possibly making the values exceed 1.0, and turn off clamping.
ERRORS
The normal return value is VP_OK. The following error return values are possible:- VPERROR_SINGULAR
- One of the current view transformation matrices is singular.
- VPERROR_BAD_SHADER
- The shading lookup tables are sized incorrectly, or one of the voxel fields used to index the tables is invalid, or the number of material types is invalid.
- VPERROR_BAD_SHADOW
- The angle between the shadow light vector and the viewing direction is too large (must be less than 45 degrees). Either change the light direction or disable shadows (see vpSetShadowLookupShader).