Zach Gildersleeve
December 5, 2006
zgildersleeve@gmail
CADE login: gildersl
Graduate level credit
Project Objectives
For my final project I intend to explore some of the fundamental concepts of Non-Photorealistic Rendering, or NPR. NPR is a branch of computer graphics research that, by acknowledging that photo-realistic graphics may not be the most ideal means of conveying and presenting all graphic information, frequently draws from artistic styles to explore other means of representation. As many NPR researchers have pointed out, the most relevant details from a representational perspective of any given object are areas of silhouette and creases, and any exploration of NPR techniques must start with the identification of these elements. With the introduction and use of programmable graphics hardware, there has been a movement towards NPR methods that operate in image space, which allows for more general solutions that fit in with current graphic research methods, and this will be reflected in this project as well.
A silhouette edge is defined as an edge that separates a back facing polygon from a front facing polygon. Raskar and Cohen's paper "Image Precision Silhouette Edges," describes several image space methods to draw a contour on silhouette edges. However, this paper provides no support for creases, and consequentially is not ideal. A crease edge is defined as any edge between adjacent polygons where the angle between the two polygon's normals is greater than an established threshold. In "Image Space Silhouette Extraction Using Graphics Hardware," Wang et. al. describes both silhouette and crease rendering using image processing techniques applied to the depth and normal buffers. The depth map / normal map concept is further described by Aaron Hertzmann in his "Introduction to 3D Non-Photorealistic Rendering: Silhouettes and Outlines."
Once silhouette and crease edges are drawn, they still must be lit properly. With the standard diffuse lighting model used by OpenGL, silhouette edges in particular tend to undesirably blend in with the diffuse shading. Gooch et. al, in "A Non-Photorealistic Lighting Model For Automatic Technical Illustration" offers a new lighting model for NPR of tone-based shading.
Program Description
The program demonstrates some of the fundamental concepts of Non-Photorealistic Rendering. As a means for describing these concepts visually, we will start with an basic OpenGL image below:
These objects are lit using the traditional diffuse lighting model, implemented as a GLSL vertex and fragment shader program (diffuseVertex.vert and diffuseFragment.frag) operating per vertex. The color of any vertex is determined by the equation
color.rgb = ambient.material + ambient.global + diffuse.material * color.material * max(0.0, normal dot light)
where normal is the unit surface normal at the vertex, and light is the unit vector of the light at the vertex. This lighting equation will be important later, but first, we will explore the Image Precision method of rendering silhouettes.
Raskar and Cohen in this paper offer the above definition of a silhouette edge, being an edge that separates a back facing polygon from a front facing polygon. Therefore, to draw these silhouette edges in image space, the process is as simple as drawing the back facing polygons only first, unlit and perturbed in some way as to make them larger than normal, and draw the front facing polygons only second with lighting enabled. Raskar and Cohen offer several means to perturb the back facing polygons, from simply scaling them larger, translating them closer to the camera a scaled amount, and so on. The program implements two means of generating silhouette edges via this method. The "Translation" button shifts the back facing polygons towards the camera a scaled amount, while the "Line" method reverses the method slightly, and draws the rear facing edges as GL_LINE polygons with a line width greater than one. This two different methods are depicted below.
![]() |
![]() |
Translated Silhouettes, thickness = 1.0 | Line Silhouettes, thickness = 1.0 |
![]() |
![]() |
Translated Silhouettes, thickness = 5.0 | Line Silhouettes, thickness = 5.0 |
Here we can see some of the shortcomings of the Image Precision method of silhouette rendering. At a silhouette thickness of 1.0, the translated method barely produces noticeable results, and the silhouette edges are not the same thickness across the scene, as would be expected, since the back facing polygons are translated from the origin. The line method does produce clean, consistent results, but this method becomes inconsistent at larger thicknesses. At larger thicknesses, the translated silhouettes start to produce interesting NPR looking images due to their inconsistent nature, but are still far from ideal.
The image produces by the line silhouette method at a thickness of 1.0 hi-lights an additional, more concerning problem with silhouette generation in NPR images. The following image depicts a view across the face of the sphere, looking towards the icosahedron:
As we can see, the added silhouette edges tend to blend in with the natural diffuse shading attenuation. This could be considered undesirable, given that one of the hallmarks of NPR philosophy is the abstraction and embellishment of components like silhouettes for the purposes of conveying graphical information. It becomes clear that a different lighting model is necessary, and this is offered in "A Non-Photorealistic Lighting Model For Automatic Technical Illustration."
Gooch et. al. draw inspiration from tone based shading, a fairly standard convention among artists to depict the transition from light to dark as from a warm to cool color rather than simply from white to black. In the above colored pencil drawing by Susan Ashurst, there is a transition in overall tone from yellow to blue, in addition to the color that creates the shape of each garlic bulb. Gooch et. al. presents a model for simulating this lighting according to the following equations:
color.cool = color.blue + diffuse.material * color.coolLuminance
color.warm = color.yellow + diffuse.material * color.warmLuminance
color.rgb = ((1 + normal dot light) / 2) * color.cool + (1 - ((1 + normal dot light) / 2)) * color.warm
Gooch et. al. also suggest a Phong specular component to further signify shape. The image below implements the Gooch NPR shading equation, and a per-vertex Blinn/Phong half angle specular component.
![]() |
![]() |
Gooch shading | Gooch shading with line silhouettes |
![]() |
|
Silhouette problem resolved |
"A Non-Photorealistic Lighting Model For Automatic Technical Illustration" is the one of the most widely referenced papers on NPR lighting techniques, particularly for anything that is remotely "toonish," and based on the clean results, it is not hard to see why.
At this point, it is necessary to revisit silhouette rendering, with the goal of adding crease edges to the scene. This is done via the process described in "Image Space Silhouette Extraction Using Graphics Hardware" and "Introduction to 3D Non-Photorealistic Rendering: Silhouettes and Outlines." A multiple step rendering process is necessary. To extract silhouette edges, we will generate a grayscale depth map; similarly to extract crease edges we will generate a normal map. From these images - stored as textures - a edge detection method will identify sharp changes in the depth map (signifying a silhouette) and sharp changes in the normal map above a set threshold (signifying a crease). The two sets of edges will then be combined into one texture unit, and subsequently used to texture the geometry to produce an icosahedron with all facets outlined (hopefully). Other NPR techniques can be explored at this stage to produce other results.
Development Platform
This project was coded in C++ and GLSL in Xcode on OS X (10.4.7) using a ATI Mobility Radeon 9700, and ported to MS Visual Studio 2005 on a Windows XP machine. This move was made to fulfill the assignment requirements.
Project Features and Design Choices
Graphical User Interface
|