shademodel(3G)shademodel(3G)NAMEshademodel - selects the shading model
C SPECIFICATION
void shademodel(model)
long model;
PARAMETERS
model expects one of two possible flags:
FLAT, tells the system to assign the same color to each pixel of
lines and polygons during scan conversion.
GOURAUD, tells the system to interpolate color from vertex to
vertex when scan converting lines, and to interpolate color
throughout the area of filled polygons when they are scan
converted. This is the default shading model.
DESCRIPTIONshademodel determines the shading model that the system uses to render
lines and filled polygons. When the system uses Gouraud shading, the
colors along a line segment are an interpolation of the colors at its
vertices, and the colors in the interior of a filled polygon are an
interpolation of the colors at its vertices. In RGB mode, red, green,
blue, and alpha (when supported) are all interpolated. Currently the
interpolation is linear. Future architectures may do nonlinear
interpolation to compensate for errors due to extreme projection.
When flat shading is specified, color is not interpolated. Rather, the
color of the second vertex of a line segment, or of the last vertex of a
polygon, is used at each pixel of the line segment or polygon. Thus
connected lines, triangles, and quadrilaterals can be successfully flat
shaded. For example, the color of the nth segment in a connected line is
determined by the color of vertex n+1, and the color of the nth triangle
in a mesh is determined by the color of vertex n+2.
Color interpolation or flat shading occurs after lighting and depthcueing
calculations are made, so both these color generation operations can be
either flat or Gouraud shaded. Texture, fog, and blending calculations,
however, occur after pixel shading is completed. These operations are
always themselves Gouraud shaded, regardless of the current shade model.
This means, for example, that a triangle mesh can be lighted or depthcued
with flat shaded facets, then fogged or texture mapped smoothly.
SEE ALSO
getsm
NOTE
Gouraud is the default shading model, but is in general slower than flat
shading. To improve performance, specify flat shading where Gouraud
shading is not required.
Page 1
shademodel(3G)shademodel(3G)BUGS
On IRIS-4D B and G models, and on the Personal Iris without Turbo
Graphics, lines are always drawn with constant color regardless of the
current shading model. Also, flat shaded independent polygons scan
convert to a single color, but this color is not always that of the last
vertex specified, Flat shaded polygons yield consistent results on these
models only when the same color is specified at each vertex. On Infinite
Reality and Impact flat shaded independent polygons are shaded the color
of the first vertex.
On IRIS-4D GT and GTX models, lines drawn with move and draw are always
flat shaded, and lines drawn with v commands are always Gouraud shaded,
regardless of the current shading model. Independent polygons are always
Gouraud shaded. Triangle meshes are correctly flat or Gouraud shaded,
depending on the shading model.
On early versions of IRIS-4D GT and GTX models, alpha is not interpolated
correctly within polygons.
On IRIS-4D VGX models, independent quads will flat-shade with the color
from the third vertex instead of the fourth.
Page 2