next up previous contents
Next: 15.6 2D Drawing Techniques Up: 15 Illustration and Artistic Previous: 15.4 Depth Cuing   Contents

15.5 Cross Hatching and 3D Halftones

In [88], Saito suggests using cross-hatching to shade 3D geometry to provide visual cues. Rather than performing 2D hatching using a fixed screen space pattern (e.g., using polygon stipple) an algorithm is suggested for generating hatch lines aligned with parametric axes for the object (for example a sequence of straight lines traversing the length of a cylinder, or a sequence of rings around a cylinder).

A similar type of shading can be achieved using texture mapping. The parametric coordinates of the object are used as the texture coordinates at each vertex and a 1D or 2D texture map consisting of a single stripe is used to generate the hatching. This method is similar to the methods for generating contour lines in Section 6.14, except the iso-contours are now lines of constant parametric coordinate. If a 1D texture is used, at minimum two alternating texels are needed. A wrap mode of GL_ REPEAT is used to replicate the stripe pattern across the object. If a 2D texture is used then the texture map contains a single stripe. Two parametric coordinates can be cross hatched at the same time using a 2D texture map with stripes in both the $s$ and $t$ directions. To reduce artifacts, the object needs to be tessellated finely enough to provide accurate sampling of the parametric coordinates.

This style of shading can be useful with bilevel output devices. For example, a luminance hatched image can be thresholded against an unlit version of the same image using a max function. This results in the darker portions of the shaded image being hatched, while the brighter portions remain unchanged as shown in Figure 85. This idea is generalized to the notion of a 3D halftone screen in [44].


% latex2html id marker 17727
\fbox{\begin{tabular}{c}
\vrule width 0pt height 0....
...umn{1}{p{5.7in}}{\small Figure \thefigure . 3D Cross Hatching}\\
\end{tabular}}

Traditionally, halftones are generated by thresholding an image against a halftone screen. Graphics devices such as laser printers can approximate the variable width circles used in halftones by using circular raster patterns. Such patterns can be generated using a clustered-dot ordered dither [30]. An $n \times n$ dither pattern can be represented as a matrix. For dithering operations in which the number of output pixels is greater than the number of input pixels i.e., each input pixel is converted to a $n \times n$ set of output pixels, the input pixel is compared against each element in the dither matrix. For each element that the input pixel is larger than the dither element, a 1 is output, otherwise a 0. An example $3 \times 3$ dither matrix is:

\begin{displaymath}
D = \pmatrix { 6 & 8 & 4 \cr 1 & 0 & 3 \cr 5 & 2 & 7 \cr }
\end{displaymath}

A dithering operation of this type can be implemented using the OpenGL pipeline as follows

  1. Replicate the dither patter in the framebuffer to generate an a threshold image the size of the output image. Use glCopyPixels() to perform the replication.
  2. Set glPixelZoomn,n(n,n) to replicate each pixel to a $n \times n$ block.
  3. Move the threshold image into the accumulation buffer with glAccumGL_ LOAD,1.0(GL_ LOAD,1.0).
  4. Use glDrawPixels() to transfer the expanded source image in the framebuffer
  5. Call glAccumGL_ ACCUM,-1.0(GL_ ACCUM,-1.0).
  6. Call glAccumGL_ RETURN,-1.0(GL_ RETURN,-1.0) to invert and return the result.
  7. Set up glPixelMap() to map 0 to 0 and everything else to 1.0.
  8. Call glReadPixels() with the pixel map to retrieve the thresholded image.

Alternatively, the subtractive blend function can be used to do the thresholding instead of the accumulation buffer if the imaging extensions are present. If the input image is not a luminance image, it can be converted to luminance using the techniques described in Section 13.2.4 during the transfer to the framebuffer. If the framebuffer is not large enough to hold the output image, the source image can be split into tiles which are processed separately and merged.


next up previous contents
Next: 15.6 2D Drawing Techniques Up: 15 Illustration and Artistic Previous: 15.4 Depth Cuing   Contents
2001-01-10