Computing the shade

When a 3D graphic draws, the drawing port determines whether a point on a surface is visible relative to all other graphics in the scene. For every point that is visible, the drawing port creates a TShadingSample instance, calls the TShader::ComputeShade function, and passes it a TShadingSample and TSceneBundle instance.

TSceneBundle provides scene attribute information that affects all 3D graphics in a scene. The ComputeShade function performs all shading computations and stores the resulting color in the TShadingSample instance. The orientation of the graphic determines whether ComputeShade calculates the inside surface color or the outside surface color. The drawing port uses the TShadingSample instance for drawing, and provides the TShadingSample instance with surface point information and local surface characteristics, which consist of the information below. Figure 209 shows the classes involved in computing the surface shade.

Shading normal: A vector that is used for shading computation.

Geometric normal: A vector that is perpendicular to a surface.

World position: A 3D point defined in world-coordinate units.

Texture coordinate: The surface texture coordinates.

Filter basis vectors: The filter used for generating antialiased texture.

UV: The surface parameters.

TangentU, TangentV: The derivative of a particular surface location with respect to u and v.

dU, dV: The change in parameters u and v across a surface area.

Base color: The surface color to be modified by light sources.

Resultant color: The computed color.



[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker