Download presentation
Presentation is loading. Please wait.
Published bySylvia Randall Modified over 8 years ago
1
David Luebke 1 6/4/2016 Non-Photorealistic Rendering Painting, Drawing, Sketching
2
David Luebke 2 6/4/2016 Admin ● Reminder: no class Monday ■ Optional review/Q&A session: Thursday May 1, 3 PM ● Reminder: final exam Monday, May 5, 9 AM ● Reminder: assn4 due Monday ■ Late days okay, but not beyond 11:59 PM Wednesday
3
David Luebke 3 6/4/2016 Recap: Stochastic Sampling ● Sampling theory tells us that with a regular sampling grid, frequencies higher than the Nyquist limit will alias ● Q: What about irregular sampling? ● A: High frequencies appear as noise, not aliases ● This turns out to bother our visual system less!
4
David Luebke 4 6/4/2016 Recap: Stochastic Sampling ● Poisson distribution: ■ Completely random ■ Add points at random until area is full. ■ Uniform distribution: some neighboring samples close together, some distant
5
David Luebke 5 6/4/2016 Recap: Stochastic Sampling ● Poisson disc distribution: ■ Poisson distribution, with minimum-distance constraint between samples ■ Add points at random, removing again if they are too close to any previous points ● Jittered distribution ■ Start with regular grid of samples ■ Perturb each sample slightly in a random direction ■ More “clumpy” or granular in appearance
6
David Luebke 6 6/4/2016 Recap: Stochastic Sampling ● Spectral characteristics of these distributions: ■ Poisson: completely uniform (white noise). High and low frequencies equally present ■ Poisson disc: Pulse at origin (DC component of image), surrounded by empty ring (no low frequencies), surrounded by white noise ■ Jitter: Approximates Poisson disc spectrum, but with a smaller empty disc.
7
David Luebke 7 6/4/2016 Stochastic Sampling: The Exciting Conclusion ● Distributed ray tracing is an elegant technique that tackles many problems at once ■ Stochastic ray tracing: distribute rays stochastically across pixel ■ Distributed ray tracing: distribute rays stochastically across everything
8
David Luebke 8 6/4/2016 Distributed Ray Tracing ● Distribute rays stochastically across: ■ Pixel for antialiasing ■ Light source for soft shadows ■ Reflection function for soft (glossy) reflections ■ Time for motion blur ■ Lens for depth of field ● Cook: 16 rays suffice for all of these
9
David Luebke 9 6/4/2016 Distributed Ray Tracing ● Distributed ray tracing is basically a Monte Carlo estimation technique ● Practical details: ■ Use lookup tables (LUTs) for distributing rays across functions ■ See W&W Figure 10.14 p 263 ● Learn lots more about this in Image Synthesis
10
David Luebke 10 6/4/2016 Non-Photorealistic Rendering ● Next topic: Non-Photorealistic Rendering
11
David Luebke 11 6/4/2016 Non-Photorealistic Rendering “Using a term like ‘nonlinear science’ is like referring to the bulk of zoology as ‘the study of nonelephant animals’” ● Photorealism: age-old goal of graphics ● Non-photorealistic rendering ■ Broadly, techniques for rendering that don’t strive for realism, but style, expressiveness, abstraction, uncertainty, etc ■ A terrible, terrible term that we’re probably stuck with ○ Better terms: stylized rendering, artistic rendering, abstract rendering
12
David Luebke 12 6/4/2016 Stylized Rendering ● NPR is most commonly used to refer to graphics techniques that emulate a particular artistic style or medium ■ Impressionistic painting ■ Pen-and-ink (cross hatching, outlining, etc) ■ Colored-pencil, copperplate engraving, you name it ■ Cartoon drawing
13
David Luebke 13 6/4/2016 Toon shading ● Toon shading is the term that we use to refer to cartoon-like rendering effects ● Tendencies in cartoon/comic style: ■ Simple, flat shading (cel shading) ○ Two-tone (light/shadow) or three-tone (light/shadow/highlight) ■ Edge highlighting ○ Boundary (border edge) ○ Crease (hard edge) ○ Material edge ○ Silhouette edge
14
David Luebke 14 6/4/2016 Silhouette Rendering ● Boundary (border edge) ■ Not shared by two polygons ■ E.g. the edge of a sheet of paper ■ Solid models usually have no boundaries ● Crease (hard edge) ■ Shared by two polygons at a dihedral angle greater than some threshold (often 60°) ■ Or a vertex with two normals/two colocated vertices ■ Ridge or valley edges
15
David Luebke 15 6/4/2016 Silhouette Rendering ● Material edge ■ Triangles sharing edge have different materials/texture maps/etc ■ Or just an edge that the artist wants to emphasize ● Silhouette edge ■ Triangles sharing edge face different directions (towards/away from viewer) ■ Lots of techniques to find at runtime!
16
David Luebke 16 6/4/2016 Summary: Edge Highlighting ● Toon shading (and other NPR techniques based on drawing) requires some edges be drawn or highlighted: ■ Silhouette edges ■ Mesh boundaries (always on silhouette) ■ Creases (ridge and valley) ■ Material boundaries ● Find first at run-time, precalculate the others (unless object is deformable)
17
David Luebke 17 6/4/2016 Recap: Silhouette Edges ● Surface angle silhouetting ■ Calc N●V, if below threshold draw black ○ Best as a per-pixel routine ○ E.g., Assn4c ○ Also can do with a spheremap, or use a mip-map with top-level textures dark ■ Pros: ○ Uses the texture hardware fast ○ Can antialias the resulting lines ■ Cons: ○ Line width depends on curvature ○ Doesn’t work for some models (e.g., a cube)
18
David Luebke 18 6/4/2016 Recap: Silhouette Edges ● Procedural Geometry Silhouetting ■ Idea: render the geometry in such a way that the silhouettes “fall out”, e.g.: ○ Draw frontfacing polygons ○ Draw backfacing polygons But draw them in (possibly thick) wireframe Or draw them z-biased forward a bit Or “fatten” them Or displace them along their normals (“halo” effect) –Flip normals –Amount of displacement varies w/ distance (why?) –Perfect task for vertex shader! ■ Pros: relatively robust, doesn’t need connectivity info ■ Cons: Wastes some fill & some polys, needs antialiasing
19
David Luebke 19 6/4/2016 Results WireframeTranslationFattening 40 fps 50 fps 11.5 fps Original Venus model : 5672 triangles, 66 fps
20
David Luebke 20 6/4/2016 Recap: Silhouette Edges ● Image Processing Silhouetting ■ Idea: analyze the image after it’s rendered, and extract silhouettes (i.e., edge detection) ■ Perfect for fragment program! ■ Can help by rendering e.g. depth image, object-ID image, normal image
21
David Luebke 21 6/4/2016 Recap: Silhouette Edges ● Silhouette Edge Detection ■ Idea: find silhouette edges geometrically on the CPU and render them explicitly ○ Brute force: test every edge to see if its adjoining polygons face opposite directions in eye space Can speed this up with randomized coherent search ○ Most work, but gives the most flexibility in how silhouettes are drawn ■ GPU variant: ○ Draw degenerate quadrilateral at each edge ○ Use vertex shader to “fatten” quad into a “fin” when edge is on silhouette Fin thickness based on distance to eyepoint
22
David Luebke 22 6/4/2016 Highlighting Ridge Edges ● Clever related technique by Raskar: ■ Add “fins” to every edge at dihedral angle ■ Size fins according to distance to viewer ■ Again, perfect for vertex shader ● Similar but more complicated technique for highlighting valley edges
23
David Luebke 23 6/4/2016 Drawing Lines: Outlining Polygons ● Surprisingly hard to draw polys as filled outlines ■ Problem: depth buffer values of edge & polys same ■ 2-pass technique: draw polys, then draw edges ○ Z-bias edges forward or polygons back ( glPolygonOffset ) ○ Works okay, but has occasional problems ■ 3-pass technique: ○ Render filled polygon Disable depth buffer writes (leave depth test on) Enable color buffer writes ○ Render polygon edges polygon Normal depth & color buffering ○ Render filled polygon again Enable depth buffer writes Disable color buffer writes
24
David Luebke 24 6/4/2016 Drawing Lines: Hidden-Line Rendering ● Hidden-line vs. obscured line vs halos ■ Hidden-line ○ Draw polygons to depth buffer (not color buffer) ○ Draw edges using previous technique ■ Obscured (light, dotted, dashed) line ○ Draw all edges in obscured style ○ Draw polygons to depth buffer (not color buffer) ○ Draw edges using previous technique ■ Haloed line ○ Draw all edges as thick background-color lines ○ Draw edges using biasing, foreground-color
25
David Luebke 25 6/4/2016 Other Styles ● Impressionistic or “painterly” rendering: ■ Sprinkle particles on object surface ■ Draw particles as brushstrokes ■ Can render images to encode normals, surface curvature, depth, color/tone info
26
David Luebke 26 6/4/2016 Painterly Rendering ● More info if time permits…
27
David Luebke 27 6/4/2016 Other Styles ● Hatching: ■ Store different cross-hatch patterns representing different tones as textures ■ Clever ways to use texture hardware to blend between tones at run-time ● More info if time permits…
28
David Luebke 28 6/4/2016 Other Styles ● “Graftals” are a general term used for strokes, decals, little bits of geometry ● Dynamic placement of graftals to achieve certain effects/styles:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.