Transcription

Real-Time HatchingEmil PraunPrinceton UniversityHugues HoppeMicrosoft ResearchMatthew WebbPrinceton UniversityAdam FinkelsteinPrinceton UniversityAbstractDrawing surfaces using hatching strokes simultaneously conveysmaterial, tone, and form. We present a real-time system for nonphotorealistic rendering of hatching strokes over arbitrary surfaces.During an automatic preprocess, we construct a sequence of mipmapped hatch images corresponding to different tones, collectivelycalled a tonal art map. Strokes within the hatch images are scaledto attain appropriate stroke size and density at all resolutions, andare organized to maintain coherence across scales and tones. Atruntime, hardware multitexturing blends the hatch images over therendered faces to locally vary tone while maintaining both spatialand temporal coherence. To render strokes over arbitrary surfaces,we build a lapped texture parametrization where the overlappingpatches align to a curvature-based direction field. We demonstratehatching strokes over complex surfaces in a variety of styles.Keywords: non-photorealistic rendering, line art, multitexturing,chicken-and-egg problem1 IntroductionFigure 1: 3D model shaded with hatching strokes at interactive rate.In drawings, hatching can simultaneously convey lighting, suggestmaterial properties, and reveal shape. Hatching generally refers togroups of strokes with spatially-coherent direction and quality. Thelocal density of strokes controls tone for shading. Their characterand aggregate arrangement suggests surface texture. Lastly, theirdirection on a surface often follows principal curvatures or othernatural parametrization, thereby revealing bulk or form. This paperpresents a method for real-time hatching suitable for interactivenon-photorealistic rendering (NPR) applications such as games,interactive technical illustrations, and artistic virtual environments.In interactive applications, the camera, lighting, and scenechange in response to guidance by the user, requiring dynamicrearrangement of strokes in the image. If strokes are placedindependently for each image in a sequence, lack of temporalcoherence will give the resulting animation a flickery, random lookin which individual strokes are difficult to see. In order to achievetemporal coherence among strokes, we make a choice betweentwo obvious frames of reference: image-space and object-space.Image-space coherence makes it easier to maintain the relativelyconstant stroke width that one expects of a drawing. However, theanimated sequence can suffer from the “shower-door effect” – theillusion that the user is viewing the scene through a sheet of semitransmissive glass in which the strokes are embedded. Furthermore,with image-space coherence, it may be difficult to align strokedirections with the surface parametrization in order to reveal shape.Instead, we opt for object-space coherence. The difficulty whenassociating strokes with the object is that the width and densityof strokes must be adjusted to maintain desired tones, even as theobject moves toward or away from the camera.In short, hatching in an interactive setting presents three mainchallenges: (1) limited run-time computation, (2) frame-to-framecoherence among strokes, and (3) control of stroke size and densityunder dynamic viewing conditions. We address these challenges byexploiting modern texture-mapping hardware.Our approach is to pre-render hatch strokes into a sequence ofmip-mapped images corresponding to different tones, collectivelycalled a tonal art map (TAM). At runtime, surfaces in the sceneare textured using these TAM images. The key problem then is tolocally vary tone over the surface while maintaining both spatialand temporal coherence of the underlying strokes. Our solutionto this problem has two parts. First, during offline creation of theTAM images, we establish a nesting structure among the strokes,both between tones and between mip-map levels. We achieve tonecoherence by requiring that strokes in lighter images be subsets ofthose in darker ones. Likewise, we achieve resolution coherence bymaking strokes at coarser mip-map levels be subsets of those at finerlevels. Second, to render each triangle face at runtime we blendseveral TAM images using hardware multitexturing, weighting eachtexture image according to lighting computed at the vertices. Sincethe blended TAM images share many strokes, the effect is that, as anarea of the surface moves closer or becomes darker, existing strokespersist while a few new strokes fade in.As observed by Girshick et al. [3], the direction of strokesdrawn on an object can provide a strong visual cue of its shape.For surfaces carrying a natural underlying parametrization, TAMsmay be applied in the obvious way: by letting the renderedstrokes follow isoparameter curves. However, to generate hatchingover a surface of arbitrary topology, we construct for the givenmodel a lapped texture parametrization [17], and render TAMsover the resulting set of parametrized patches. The lapped textureconstruction aligns the patches with a direction field on the surface.This direction field may be either guided by the user to followsemantic features of the shape, or aligned automatically withprincipal curvature directions using a method similar to that ofHertzmann and Zorin [7].URL: ssion to make digital or hard copies of all or part of this work forpersonal or classroom use is granted without fee provided that copiesare not made or distributed for profit or commercial advantage and thatcopies bear this notice and the full citation on the first page. To copyotherwise, to republish, to post on servers or to redistribute to lists,requires prior specific permission and/or a fee.ACM SIGGRAPH 2001, 12-17 August 2001, Los Angeles, CA, USA 2001 ACM 1-58113-374-X/01/08. 5.00581

3 Tonal Art MapsThe specific contributions of this paper are: the introduction of tonal art maps to leverage current texturinghardware for rendering strokes (§3), an automatic stroke-placement algorithm for creating TAMswith stroke coherence at different scales and tones (§4), a multitexturing algorithm for efficiently rendering TAMs withboth spatial and temporal coherence (§5), and the integration of TAMs, lapped textures and curvature-baseddirection fields into a real-time hatching system for shading 3Dmodels of arbitrary topology (§6).Drawing hatching strokes as individual primitives is expensive,even on modern graphics hardware. In photorealistic rendering, thetraditional approach for rendering complex detail is to capture itin the form of a texture map. We apply this same approach to therendering of hatching strokes for NPR. Strokes are pre-renderedinto a set of texture images, and at runtime the surface is renderedby appropriately blending these textures.Whereas conventional texture maps serve to capture materialdetail, hatching strokes in hand-drawn illustrations convey bothmaterial and shading. We therefore discretize the range of tonevalues, and construct a sequence of hatch images representing thesediscrete tones. To render a surface, we compute its desired tonevalue (using lighting computations at the vertices), and render thesurface unlit using textures of the appropriate tones. By selectingmultiple textures on each face and blending them together, we canachieve fine local control over surface tone while at the same timemaintaining spatial and temporal coherence of the stroke detail. Wepresent the complete rendering algorithm in Section 5.Another challenge when using conventional texture maps torepresent non-photorealistic detail is that scaling does not achievethe desired effect. For instance, one expects the strokes to haveroughly uniform screen-space width when representing both nearand far objects. Thus, when magnifying an object, we would liketo see more strokes appear (so as to maintain constant tone over theenlarged screen-space area of the object), whereas ordinary texturemapping simply makes existing strokes larger. The art maps ofKlein et al. [9] address this problem by defining custom mip-mapimages for use by the texturing hardware. In this paper, we use asimilar approach for handling stroke width. We design the mip-maplevels such that strokes have the same (pixel) width in all levels.Finer levels maintain constant tone by adding new strokes to fill theenlarged gaps between strokes inherited from coarser levels. Weperform this mip-map construction for the stroke image associatedwith each tone. We call the resulting sequence of mip-mappedimages a tonal art map (TAM).A tonal art map consists of a 2D grid of images, as illustrated inFigure 2. Let ( , t) refer to indices in the grid, where the row index is the mipmap level ( 0 is coarsest) and the column index tdenotes the tone value (t 0 is white).Since we render the surface by blending between textures corresponding to different tones and different resolutions (mipmap levels), it is important that the textures have a high degree of coherence. The art maps constructed in [9] suffered from lack of coherence, because each mipmap level was constructed independentlyusing “off-the-shelf” NPR image-processing tools. The lack of coherence between the strokes at the different levels create the impression of “swimming strokes” when approaching or receding from thesurface.Our solution is to impose a stroke nesting property: all strokesin a texture image ( , t) appear in the same place in all the darkerimages of the same resolution and in all the finer images of the sametone – i.e. every texture image ( , t ) where and t t (throughtransitive closure). As an example, the strokes in the gray box inFigure 2 are added to the image on its left to create the image on itsright. Consequently, when blending between neighboring imagesin the grid of textures, only a few pixels differ, leading to minimalblending artifacts (some gray strokes).Figure 3 demonstrates rendering using tonal art maps. The unlitsphere in Figure 3a shows how the mip-maps gradually fade outthe strokes where spatial extent is compressed at the parametricpole. The lit cylinder in Figure 3b shows how TAMs are ableto capture smoothly varying tone. Finally, Figure 3c shows thecombination of both effects. The texture is applied to these modelsusing the natural parametrization of the shape and rendered usingthe blending scheme described in Section 5.2 Previous workMuch of the work in non-photorealistic rendering has focused ontools to help artists (or non-artists) generate imagery in varioustraditional media or styles such as impressionism [5, 12, 14],technical illustration [4, 19, 20], pen-and-ink [1, 21, 22, 26, 27],and engraving [16]. Our work is applicable over a range of stylesin which individual strokes are visible.One way to categorize NPR methods would be to consider theform of input used. One branch of stroke-based NPR work usesa reference image for color, tone, or orientation, e.g. [5, 21, 22].For painterly processing of video, Litwinowitcz [12] and laterHertzmann and Perlin [6] addressed the challenge of frame-toframe coherence by applying optical flow methods to approximateobject-space coherence for strokes. Our work follows a branch ofresearch that relies on 3D models for input.Much of the work in 3D has focused on creating still imagesof 3D scenes [1, 2, 20, 24, 25, 26, 27]. Several systems havealso addressed off-line animation [1, 14], wherein object-spacestroke coherence is considerably easier to address than it is forprocessing of video. A number of researchers have introducedschemes for interactive non-photorealistic rendering of 3D scenes,including technical illustration [4], “graftals” (geometric texturesespecially effective for abstract fur and leaves) [8, 10], and realtime silhouettes [2, 4, 7, 13, 15, 18]. While not the focus of ourresearch, we extract and render silhouettes because they often playa crucial role in drawings.In this paper, we introduce tonal art maps, which build on twoprevious technologies: “prioritized stroke textures” and “art maps.”Described by both Salisbury et al. [21] and Winkenbach et al. [26],a prioritized stroke texture is a collection of strokes that simultaneously conveys material and continuously-variable tone. Prioritized stroke textures were designed for creating still imagery andtherefore do not address either efficient rendering or temporal coherence. One might think of TAMs as an organization for samplingand storage of prioritized stroke textures at a discrete set of scalesand tones, for subsequent real-time, temporally-coherent rendering.TAMs also build on the “art maps” of Klein et al. [9], which adjustscreen-space stroke density in real time by using texture-mappinghardware to slowly fade strokes in or out. TAMs differ from artmaps in two ways. First, art maps contain varying tone within eachimage, whereas TAMs are organized as a series of art maps, eachestablishing a single tone. Second, TAMs provide stroke coherenceacross both scales and tones in order to improve temporal coherencein the resulting imagery.Three previous systems have addressed real-time hatching in3D scenes. Markosian et al. [13] introduced a simple hatchingstyle indicative of a light source near the camera, by scatteringa few strokes on the surface near (and parallel to) silhouettes.Elber [2] showed how to render line art for parametric surfaces inreal time; he circumvented the coherence challenge by choosinga fixed density of strokes on the surface regardless of viewingdistance. Finally, Lake et al. [11] described an interactive hatchingsystem with stroke coherence in image space (rather than objectspace).582

Figure 2: A Tonal Art Map. Strokes in one image appear in all the images to the right and down from it.4 Automatic generation of line-art TAMswith alli previously chosen strokes and with si added. The sum(T T ) expresses the darkness that this stroke would add to all the hatch images in t