
|

Version
3.1
SECTION 9 - OVERVIEW OF THE SHADING PROCESS
In this document, shading includes the entire process
of computing the color of a point on a surface. The shading process
requires the specification of light sources, surface
material properties, and volume or atmospheric
effects. The interpolation of color across a primitive, in
the sense of Gouraud or Phong interpolation, is not considered part
of the shading process. Each part of the shading process is controlled
by giving a function which mathematically describes that part of
the shading process. Throughout this document the term shader refers
to a procedure that implements one of these processes. There are
thus three major types of shaders:
- Light source shaders. Lights may exist alone or be
attached to geometric primitives. A light source shader calculates
the color of the light emitted from a point on the light source
towards a point on the surface being illuminated. A light will
typically have a color or spectrum, an intensity, a directional
dependency and a fall-off with distance.
- Surface shaders. Surface shaders are attached to all
geometric primitives and are used to model the optical properties
of materials from which the primitive was constructed. A surface
shader computes the light reflected in a particular direction
by summing over the incoming light and considering the properties
of the surface
- Volume shaders. Volume shaders modulate the color of
a light ray as it travels through a volume. Volumes are defined
as the insides of solid objects. The atmosphere is the initial
volume defined before any objects are created.
Conceptually, it is easiest to envision the shading process using
ray tracing (see Figure 9.1). In the classic
recursive ray tracer, rays are cast from the eye through a point
on the image plane. Each ray intersects a surface which causes new
rays to be spawned and traced recursively. These rays are typically
directed towards the light sources and in the directions of maximum
reflection and transmittance. Whenever a ray travels through space,
its color and intensity is modulated by the volume shader attached
to that region of space. If that region is inside a solid object,
the volume shader is the one associated with the interior of that
solid; otherwise, the exterior shader of the spawning primitive
is used. Whenever an incident ray intersects a surface, the surface
shader attached to that geometric primitive is invoked to control
the spawning of new rays and to determine the color and intensity
of the incoming or incident ray from the color and intensity of
the outgoing rays and the material properties of the surface. Finally,
whenever a ray is cast to a light source, the light source shader
associated with that light source is evaluated to determine the
color and intensity of the light emitted. The shader evaluation
pipeline is illustrated in Figure 9.2.
Figure 9.1 The ray tracing
paradigm
(click on image to view a larger version)
Figure 9.2 Shader
evaluation pipeline
(click on image to view a larger version)
This description of the shading process in terms of ray tracing
is done because ray tracing provides a good metaphor for describing
the optics of image formation and the properties of physical materials.
However, the Shading Language is designed to work with any rendering
algorithm, including scanline and z-buffer renderers, as well as
radiosity programs.
The Shading Language is also used to program two other processes:
- Displacement and transformation shaders. These shaders
change the position and normals of points on the surface. Displacements
are used to place bumps on surfaces. Transformations are used
to bend and twist objects, as well as to specify special camera
projections.
- Imager shader. Imager shaders are used to program pixel
operations that are done before the image is quantized and output.
|