Casting Fast Shadows for a 3D Cursor
Although rarely at the forefront of our perception, shadows can greatly
enhance our ability to perceive depth and other spatial relationships.
Unfortunately, except in special cases such as casting a shadow on a
simple planar surface, computing and rendering cast shadows is normally
too time intensive for use in interaction. The work described here
provides a technique for very rapidly rendering a shadow onto any
existing scene rendered into a depth buffer. This technique works only
for a special case -- casting a shadow from a single convex polygonal
object using one light source -- however, this case is useful for
interaction since it can provide shadows for a 3D cursor, or a single
object being manipulated. An example of a simple cursor with a cast
shadow (in this case in the form of a red cube over an irregular
surface) is shown below:
To cast a shadow over an existing scene in depth buffer we can make use
of the special properties of a single convex polygonal object. In
particular, all the surface area upon which a shadow can be cast by
such an object will always fall within a convex volume called its
"shadow volume". As illustrated below, for this form of volume, any
ray (representing, for example, the line of sight through a pixel) is
guaranteed to first strike a front facing polygon, then strike a back
facing polygon.
To cast a shadow over an existing scene in a depth buffer we need to
intersect the surfaces represented in the buffer with the shadow
volume. A pixel represents a surface within the shadow volume if it
has a depth value between the depth of the front facing polygon and the
back facing polygon found along the ray representing the line of sight
through that pixel. These pixels should be rendered as in shadow, all
others should retain normal rendering. To compute these pixels the
steps illustrated below can be used. First the depth buffer is locked
so that it is not modified. Next, the shadow is rendered into a
separate image or "mask" plane in two steps. First all front facing
polygons of the shadow volume are rendered in a foreground "shadow"
color.
This renders color onto each pixel which is on a surface behind a front
facing polygon. Next, all back facing polygons are rendered in the
background color.
This removes shadow from any and all pixels behind a back facing
polygon. The end result of these rendering steps is that only pixels
representing a surface within the shadow volume remain colored.
These pixels represent the exact extent of the
shadow and can be used to render it over the top of the existing scene.
References:
Hudson, Scott, E.,
"Adding Shadows to a 3D Cursor",
ACM Transactions on Graphics, v11, n2, pp. 193-199, April 1992.
|
|
|
|
|