SET_SHADING Procedure
The SET_SHADING procedure modifies the light source shading parameters that affect the output of SHADE_SURF and POLYSHADE. Parameters can be changed to control the light-source direction, shading method, and the rejection of hidden surfaces. SET_SHADING first resets the shading parameters to their default values. (Defaults are Gouraud interpolation, light-source direction [0, 0, 1], and rejection of hidden faces enabled.) The parameter values specified in the call then overwrite the default values. To reset all parameters to their default values, call this procedure with no parameters.
Examples
Change the light source so that the light rays are parallel to the X axis:
SET_SHADING, LIGHT = [1, 0, 0]
Syntax
SET_SHADING [, /GOURAUD] [, LIGHT=[x, y, z]] [, /REJECT] [, VALUES=[darkest, brightest]]
Arguments
None.
Keywords
GOURAUD
This keyword controls the method of shading the surface polygons by the POLYSHADE procedure. The SHADE_SURF procedure always uses the Gouraud method. Set this keyword to a nonzero value (the default), to use Gouraud shading. Set this keyword to zero to shade each polygon with a constant intensity.
Gouraud shading interpolates intensities from each vertex along each edge. Then, when scan converting the polygons, the shading is interpolated along each scan line from the edge intensities. Gouraud shading is slower than constant shading but usually results in a more realistic appearance.
LIGHT
A three-element vector that specifies the direction of the light source. The default light source vector is [0,0,1], with the light rays parallel to the Z axis.
REJECT
Set this keyword (the default) to reject polygons as being hidden if their vertices are ordered in a clockwise direction as seen by the viewer. This keyword should always be set when rendering enclosed solids whose original vertex lists are in counterclockwise order. When rendering surfaces that are not closed or are not in counterclockwise order this keyword can be set to zero although shading anomalies at boundaries between visible and hidden surfaces may occur.
Note: The REJECT keyword has no effect on the output of SHADE_SURF—it is used only with solids.
VALUES
A two-element array that specifies the range of pixel values (color indices) to use. The first element is the color index for the darkest pixel. The second element is the color index for the brightest pixel. For example, to render a shaded surface with the darkest shade set to pixel value 100 and the brightest value set to 150, use the commands:
SET_SHADING, VALUES=[100, 150]
SHADE_SURF, dataset
If IDL is using a decomposed color system (that is, if the DECOMPOSED keyword to the DEVICE routine is set to one), the pixel range specified by the VALUES keyword is applied to each of the red, green, and blue color channels separately.
Version History
Pre-4.0 |
Introduced |