CS 176 Project 6: Illustration Rendering

Introduction

In addition to photorealistic rendering and accurate simulation of physical phenomena, much of computer graphics is dedicated to non-photorealistic rendering. Non-photorealistic technical illustrations, for instance, can be more useful than photorealistic renders for displaying certain details of a model. In this lab, we demonstrate the benefits of NPR through Gooch shading and suggestive contours.

Running the Program

You can download the source here. Compiling the program requires OpenGL and GLUT. A Makefile is included, so building the program should be as simple as `make`.

You can download a Linux binary here.

Press 's' to toggle silhouette rendering.

Implementation

Gooch Shader

I used a fragment shader to compute per-pixel Gooch shading using the first light specified in OpenGL.

Contours

Each frame, I looked at every edge and compared the signs of the dot products of the adjacent triangles' normals with the view vector. Each edge that satisfied the contour constraint was then draw as a thick line.

Suggestive Contours

I was unable to get suggestive contours working successfully.

Results

Various examples of Gooch shading
(Left): The triceratops is rendered with a silhouette before the camera is ever moevd. (Right): We can see that the silhouette is only calculated correctly at the initial camera view.

Discussion

To correct the silhouette rendering issue, I need to transform the normals of the edges by the inverse transpose of the modelview matrix before computing dot(N, V).