Various projects and musings by Mason Smith
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.
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.
I used a fragment shader to compute per-pixel Gooch shading using the first light specified in OpenGL.
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.
I was unable to get suggestive contours working successfully.
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).