Non-Photorealistic Rendering: Toon Shading David Luebke University of Virginia


Non-Photorealistic Rendering: Toon Shading

David Luebke University of Virginia

Non-Photorealistic Rendering

“Using a term like ‘nonlinear science’ is like referring to the bulk of zoology as ‘the study of nonlinear 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

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

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

Toon Shading

 Cel shading – Threshold the lighting equation  Ex: the Cg program we looked at  Diffuse below 0.5 ? dark color : light color   Specular above 0.5 ? hilight color : diffuse color If no pixel shaders, can use N ● L to look up a 1-D texture containing the shaded colors – In general, can think of these procedures as remapping the traditional lighting equation elements (

tone mapping


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 –





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!

Finding/Rendering Silhouette Edges

 Surface angle silhouetting – Again, like the Cg program we looked at – Calculate N●V, if below threshold  draw black – Problem: depends on surface curvature (see Fig 7.5)

Procedural Geometry Silhouetting

 Idea: render the geometry in such a way that the silhouettes “fall out”  Ex: – Draw frontfacing polygons – Draw backfacing polygons  But draw them in thick (2-pixel) wireframe    Or draw them in wireframe, z-biased forward a bit Or “fatten” them Or displace them along their normals (“halo” effect)

Image Processing Silhouetting

 Idea: analyze the image after it’s rendered, and extract silhouettes (like edge detection)  Can help by rendering e.g. depth image, object-ID image, normal image  Perfect for fragment program!

Silhouette Edge Detection

 Idea: find silhouette edges geometrically and render them explicitly – Randomized Appel’s algorithm – Lots of interesting geometric approaches  Most work, but gives the most flexibility in how silhouettes are drawn


Wireframe Translation Fattening 40 fps 50 fps 11.5 fps Original Venus model : 5672 triangles, 66 fps