12.07.2015 Views

wu'ed in haste; fried, stewed at leisure

wu'ed in haste; fried, stewed at leisure

wu'ed in haste; fried, stewed at leisure

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

When I read through SIGGRAPH proceed<strong>in</strong>gs and other st<strong>at</strong>e-of-the-art computergraphicsm<strong>at</strong>erial, all too often I feel like I’m d<strong>in</strong><strong>in</strong>g <strong>at</strong> a four-star restaurant withtwo-year-old triplets and an empty wallet. We’re talk<strong>in</strong>g <strong>in</strong>credibly <strong>in</strong>appropri<strong>at</strong>e technologyfor PC graphics here. Sure, I say to myself as I read about an antialias<strong>in</strong>gtechnique, th<strong>at</strong> sounds wonderful-if I had 24bpp color, and dedic<strong>at</strong>ed hardware todo the process<strong>in</strong>g, and all day to wait to gener<strong>at</strong>e one image. Yes, I th<strong>in</strong>k, th<strong>at</strong> is agood way to do hidden surface removal-<strong>in</strong> a system with hardware z-buffer<strong>in</strong>g. Mostof the stuff <strong>in</strong> the journal Computer Ofaphics is rivet<strong>in</strong>g, but, alas, pretty much uselesson PCs. When an x86 has to do all the work, speed becomes the overrid<strong>in</strong>g parameter,especially for real-time graphics.Liter<strong>at</strong>ure th<strong>at</strong>’s applicable to fast PC graphics is hard enough to f<strong>in</strong>d, but wh<strong>at</strong> we’dreally like is above-average image quality comb<strong>in</strong>ed with terrific speed, and there’salmost no liter<strong>at</strong>ure of th<strong>at</strong> sort around. There is some, however, and you folks areright on top of it. For example, alert reader Michael Chapl<strong>in</strong>, of San Diego, wrote tosuggest th<strong>at</strong> I might enjoy the l<strong>in</strong>e-antialias<strong>in</strong>g algorithm presented <strong>in</strong> Xiaol<strong>in</strong> Wu’sarticle, “An Efficient Antialias<strong>in</strong>g Technique,” <strong>in</strong> the July 1991 issue of Computer Guphics.Michael was dead-on right. This is a gre<strong>at</strong> algorithm, comb<strong>in</strong><strong>in</strong>g excellentantialiased l<strong>in</strong>e qualitywith speed th<strong>at</strong>’s close to th<strong>at</strong> of non-antialiased Bresenham’sl<strong>in</strong>e draw<strong>in</strong>g. This is the sort of algorithm th<strong>at</strong> makes you want to go out and write awire-frame anim<strong>at</strong>ion program, just so you can see how good those smooth l<strong>in</strong>eslook <strong>in</strong> motion. Wu antialias<strong>in</strong>g is a wonderful example of wh<strong>at</strong> can be accomplishedon <strong>in</strong>expensive, mass-market hardware with the proper programm<strong>in</strong>g perspective.In short, it’s a splendid example of appropri<strong>at</strong>e technology for PCs.Wu Antialias<strong>in</strong>gAntialias<strong>in</strong>g, as we’ve been discuss<strong>in</strong>g for the past few chapters, is the process ofsmooth<strong>in</strong>g l<strong>in</strong>es and edges so th<strong>at</strong> they appear less jagged. Antialias<strong>in</strong>g is partly anaesthetic issue, because it makes images more <strong>at</strong>tractive. It’s also partly an accuracyissue, because it makes it possible to position and draw images with effectively moreprecision than the resolution of the display. F<strong>in</strong>ally, it’s partly a fl<strong>at</strong>-out necessity, toavoid the horrible, crawl<strong>in</strong>g, jagged edges of temporal alias<strong>in</strong>g when perform<strong>in</strong>ganim<strong>at</strong>ion.The basic premise of Wu antialias<strong>in</strong>g is almost ridiculously simple: As the algorithm stepsone pixel unit <strong>at</strong> a time along the major (longer) axis of a l<strong>in</strong>e, draws it the two pixelsbracket<strong>in</strong>g the l<strong>in</strong>e along the m<strong>in</strong>or axis <strong>at</strong> each po<strong>in</strong>t. Each of the two bracket<strong>in</strong>gpixels is drawn with a weighted fraction of the full <strong>in</strong>tensity of the draw<strong>in</strong>g color, withthe weight<strong>in</strong>g for each pixel equal to one m<strong>in</strong>us the pixel’s distance along the m<strong>in</strong>oraxis from the ideal l<strong>in</strong>e. Yes, it’s a mouthful, but Figure 42.1 illustr<strong>at</strong>es the concept.The <strong>in</strong>tensities of the two pixels th<strong>at</strong> bracket the l<strong>in</strong>e are selected so th<strong>at</strong> they alwayssum to exactly 1; th<strong>at</strong> is, to the <strong>in</strong>tensity of one fully illum<strong>in</strong><strong>at</strong>ed pixel of the draw<strong>in</strong>gcolor. The presence of aggreg<strong>at</strong>e full-pixel <strong>in</strong>tensity means th<strong>at</strong> <strong>at</strong> each step, the l<strong>in</strong>e776 Chapter 42

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!