next up previous contents
Next: 12.2 Alpha Blending Up: 12. Transparency Previous: 12. Transparency

   
12.1 Screen-Door Transparency

One of the simpler transparency techniques is known as screen-door transparency. Screen-door transparency uses a bit mask to cause certain pixels not to be rasterized. The percentage of bits in the bitmask which are set to 1 is equivalent to the transparency of the object [27].

In OpenGL, screen-door transparency is implemented using polygon stippling. The command glPolygonStipple() defines a 32x32 polygon stipple pattern. When stippling is enabled (using glEnableGL_POLYGON_STIPPLE(GL_POLYGON_STIPPLE)) the low-order x and y bits of the screen coordinates of each fragment are used to index into the stipple pattern. If the corresponding bit of the stipple pattern is 0, the fragment is rejected. If the bit is 1, rasterization continues.

Since the lookup into the stipple pattern takes place in screen space, a different pattern should be used for objects which overlap, even if the transparency of the objects is the same. If the same stipple pattern is used, the same pixels in the framebuffer would be drawn for each object. Of the transparent objects, only the last (or the closest, if depth buffering is enabled) would be visible.

The biggest advantage of screen-door transparency is that the objects do not need to be sorted. Also, rasterization may be faster on some systems using the screen-door technique than using other techniques such as alpha blending. Since the screen-door technique operates on a per-fragment basis, the results will not look as smooth as if another technique had been used. However, patterns that repeat on a 2x2 grid are the smoothest and a 50% transparent ``checkerboard'' pattern looks quite smooth on most systems.


next up previous contents
Next: 12.2 Alpha Blending Up: 12. Transparency Previous: 12. Transparency
David Blythe
1999-08-06