IBM Visualization Data Explorer Programmer's Reference

[ Bottom of Page | Previous Page | Next Page | Table of Contents | Partial Table of Contents | Index ]


16.2 Surface Shading

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.
Color, Opacity, and Normals Dependencies

Colors, opacities, and normals may be dependent on the positions (when the corresponding components have a "dep" attribute of "positions") or on connections or faces (when the corresponding components have a "dep" attribute of "connections" or "faces").

Opacities and normals, if present, must depend on the same component that the colors depend upon, with one exception: if the colors are dependent on the positions and the normals are dependent on the connections, the face will be flat-shaded with the average color of the face vertices.

If the colors, opacities, and normals are dependent on the positions, the color and opacity of each face is linearly interpolated between the vertices (Gouraud shading). If they are dependent on the connections or faces, the color and opacity of each face is constant (flat shading).


[ Top of Page | Previous Page | Next Page | Table of Contents | Partial Table of Contents | Index ]
[Data Explorer Documentation | QuickStart Guide | User's Guide | User's Reference | Programmer's Reference | Installation and Configuration Guide ]

[Data Explorer Home Page | Contact Data Explorer | Same document on Data Explorer Home Page ]


[IBM Home Page | Order | Search | Contact IBM | Legal ]