next up previous contents
Next: 15.5 Cross Hatching and Up: 15. Illustration and Artistic Previous: 15.3.3.2 No Alpha Buffer

15.4 Depth Cuing

Perspective projection and hidden surface and line elimination are regularly used to add a sense of depth to rendered images. However, other kinds of depth cues are useful, particularly for applications using orthographic projections. The term depth-cuing is typically associated with the technique of changing the intensity of an object as a function of distance from the eye. This effect is typically implemented using the fog stage of the OpenGL pipeline. For example, using a linear fog function with the fog color set to black results in a linear interpolation between the object's color and zero, where the interpolation factor, f, is determined by the distance of each fragment from the eye, $f = {{end - z} \over {end - start}}$

It is also straightforward to implement a cuing algorithm using a 1D texture map using glTexGen() to generate a texture coordinate using a linear texture coordinate generation function to compute a coordinate proportional to the distance from the eye along the z-axis. The filtered texel value is used as the interpolation factor between the polygon color and texture environment color. One advantage of using a 1D texture is that the map can be used to encode an arbitrary function of distance which can be used to implement more extreme cuing effects. Textures can also be useful on OpenGL implementations that use per-vertex rather than per-pixel fog calculations.

Other types of depth cues may also be useful. Section 17.7 describes methods for generating points with appropriate perspective foreshortening. Similar problems exist for line primitives as their width is specified in window coordinates rather than object coordinates. For most wireframe display applications this is not an issue since the lines are typically very narrow. However, for some applications wider lines are used to convey other types of information. A simple method for generating perspective lines is to use polygonal primitives rather than lines.


next up previous contents
Next: 15.5 Cross Hatching and Up: 15. Illustration and Artistic Previous: 15.3.3.2 No Alpha Buffer
David Blythe
1999-08-06