McGill University
|
TechnicalQuakeA Project for COMP-767 - Non-Photorealistic Rendering Michael Batchelder and Kacper Wysocki |
Winter 2005 |
Things such as drawing silhouettes and creases, and fancy shading algorithms are difficult to do on a polygon unless you know the neighbouring polygons that share edges with the current polygon. Unfortunately, Quake stores all its model frames as "polygon soups", that is, series of independent triangle strips and triangle fans which again consist of independent vertices. So the very first thing we set about doing was somehow rebuilding some of the direly needed neighbouring edge information.
Our approach consists of creating a three-level hash: We keep a table of models previously seen. For each model, we maintain a table of animation frames encountered. For each frame, we store a 3D-hash of edges, each of which contains normals for polygons that share that edge. This is illustrated below.
Coming up with and implementing this structure in Quake was not completely trivial, and so we had anticipated that this sort of preprocessing would make the rendering unbarably slow. However, we were pleasantly surprised once the table creation was implemented, because this preprocessing took hardly no time at all. Although the process had a measurable impact on framerates, the difference is still not noticable to the human eye, as this table shows in frames per second.
Time Demo | Demo1 | Demo2 | Demo3 |
Default | 222 | 219 | 217 |
Sketch | 146 | 148 | 135 |
A.I. Toon | 97 | 97 | 88 |
TechnicalQuake | 86 | 87 | 78 |
TechnicalQuake - No Edges | 104 | 104 | 95 |
Once we had the edge table, we felt ready to proceed to the rendering part. We implemented Gooch shading on the models, which linearly interpolates between a cool (receding) and warm (advancing) color based on the light direction and the surface normals, according to the equation:
Splashback is an adaptation of the cool-to-warm Gooch shading that simulates the more dramatic effects sometimes used by artists. The effect is acheived when the reflected light from the left of the object produces a back-splash of light opposite the direct lighting source. We acheive this effect simply by adding the following multiplier to the Gooch shading color equation:
Silhouettes and creases are where we had the most problems. We had hoped that the Quake "polygon soup" would match up at the vertices, at least most of the time. We were disappointed by discovering that not only did the models consist of polygons that did not match up at edge boundries, and therefore had unexpected discontinuities that were invisible under normal rendering, but that the models sometimes had double-faced polygons, edges that were part of more than two polygons, and degenerate triangles.
Nevertheless, we implemented a silhouette and crease finder algorithm based on our preprocessing information, and the algorithm described in the Gooch et al Interactive Technical Illustration paper. The results are not amazing, because the neighbouring information is inaccurate due to the above mentioned issues, and also because quake does not correctly give us the eye position, rendering the same edges as silhouettes regardless of viewing direction.