Shading is the process of applying lights to a surface according to shading parameters specified for the surface and the scene.
The shading process described here is performed by the
DXRender() function for surface
objects only;
volumes are rendered directly, using the colors and opacities
specified.
Lights are specified by light Objects (see 16.8 , "Light Class")
contained in the input Object.
Shading is defined only for 2-dimensional connections (lines, triangles,
and quads) and is applied only if normals are present.
The shading process uses the following
Field components:
Component | Meaning |
---|---|
"positions" | points |
"colors" | front and back colors |
"front colors" | colors of front of face |
"back colors" | colors of back of face |
"normals" | surface normals |
A Field may have both "colors" and "front colors" or both "colors" and "back colors," in which case the "front colors" or "back colors" component overrides the "colors" component for the specified side of the object. The front and back of a surface are defined in Chapter 3. "Understanding the Data Model" in IBM Visualization Data Explorer User's Guide.
Shading parameters are specified by a set of attributes of an
input Object:
Attribute | Meaning |
---|---|
"ambient" | ambient lighting coefficient ka |
"diffuse" | diffuse lighting coefficient kd |
"specular" | specular lighting coefficient ks |
"shininess" | specular lighting exponent sp |
These parameters apply to both the front and back of an object. In addition, for each shading parameter "x," there is also a "front x" and a "back x" parameter that apply only to the front and back of a surface respectively. These parameters are used in the following shading model: I % = % k sub a A C plus k sub d L C % ("n" % % dot % "l") plus k sub s L % ( "n" % % dot % "h" ) sup sp
where:
I = apparent intensity of the object k = a lighting
coefficient
A = an ambient light n
= the surface normal
C = the color of the object l =
the direction to the light
L = a point or distant light sp = specular lighting
exponent
h = a unit vector halfway between the direction to the
camera
and the direction to the light.