Date: Sun, 24 Nov 1996 23:08:52 GMT
Server: NCSA/1.5
Content-type: text/html
Last-modified: Wed, 03 Jul 1996 20:04:20 GMT
Content-length: 3635
Shadow Tip
Making Shadows.
Shadows are powerful perceptual cues for the 3D relationship of objects
in a scene. The DX renderer does not produce shadows, but is possible
to generate acceptable shadows by modifying the colors of individual
vertices of objects in a scene. The macro described here performs the
following steps:
- The obects to be shadowed are transformed to the coordinate system
of a light places in an arbitrary direction at infinity.
- A depth buffer is calculated from the viewpoint of the light.
- The depth buffer is turned into a "volume" data set by stacking it
with itself in such a way that it overlaps all the vertices in the
original objects.
- The volume depth buffer is mapped onto the original vertices as new data.
- The depth buffer value at each vertex is compared to the depth at
of the vertex. If the vertex is farther from the light than the value
given by the depth buffer, it is dimmed.
- The objects (with modified colors) are transformed back to world coordinates.
This approach (a sort of vertex-mapped, z-buffer method) has some limitations:
- The accuracy of the shadows depends on the density of vertices on
an object. Objects with just a few vertices will have "jaggie" shadows thrown onto them.
- The resolution of the depth buffer must be high to get acceptable
shadows.
- The Compute module cannot resolve transform objects. Any objects
built using Rotate, Translate, Scale, or Transform modules will not
shadow correctly, unless you use the
Calculate
macro to
apply the transforms.
- The module uses a lot of memory. It runs well on a machine with
.5 Gbyte of memory.
The macro dialog box is shown below.
Explaination of inputs:
- The object input carries the objects to be shadowed against each other.
- The depth_resolution input is the resolution of the desired depth-buffer.
- The shadow_factor is the amount to "dim" a shadowed vertex.
- The light_pos is the direction to the light at infinity.
- The depth_ingore input is the threshold for self-shadowing. Set to
zero, it will cause surfaces to "dim" themselves.
- The object_scale input overrides the automatic conversion of the object
size to camera coordinate space.
- The offset input allows the objects to move along the z-axis of the light.
To download the test program click
here. . You also need it's configuration file
from here.
The test program layout is shown
here.
An example output from the program is shown below.
To download the macro click
here.
Another example is shown below. A protein ribbon representation is casting
shadows on itself and on two planes.
See also: