CS6554 Computer Graphics 2 – Lab 3 – Shading, i.e. Constant, Gouraud and Phong

This class has tasked us with developing a 3D renderer from scratch without using any existing libraries. The only library functionality that has been used in these renderings is the point drawing facilities of OpenGL.

In lab 1 we developed the basic renderer with wireframe capability and this is the only other case where other OpenGL facilities were allowed or used, e.g. line drawing from vertex to vertex. The goal of lab 1 was to implement and test the necessary mathematical functions, to perform perspective projection, to implement backface culling and in general to develop the necessary system framework for continued development throughout the semester.

Isometric View Utah Teapot Wireframe with Backface Cull

In lab 2 we implemented depth buffering and a coherence based scan line algorithm. The goal of this lab was to render solid polygons in an appropriate back to front ordering so that polygons that are in front of others properly occlude those that are behind. The fill for the polygons was a simple random color procedure.

Isometric View Utah Teapot Depth Buffered Random Fill

In lab 3 we implemented shading which necessitated the addition of an intensity Bi-directional Reflectance Distribution Function, i.e. BRDF, as well as lights to the scene and materials to the models. The following are renders from the system that I developed using the classic "Utah Teapot" model with a red material and the phong BRDF. The teapot is positioned at the world origin with no rotation and the camera is positioned above and beside the model and then tilted down to produce the isometric view. In the top light cases, the light is positioned directly above the model along the world y-axis, i.e. up/down, and in the side light cases, the light is positioned along the world z-axis, i.e. forward/back. The light is omni-directional, includes attenuation and in both cases is very close to the surface of the model.

Isometric View Utah Teapot Top Light Flat Shaded

Isometric View Utah Teapot Top Light Gouraud Shaded

Isometric View Utah Teapot Top Light Phong Shaded

Isometric View Utah Teapot Side Light Flat Shaded

Isometric View Utah Teapot Side Light Gouraud Shaded

Isometric View Utah Teapot Side Light Phong Shaded

Just for fun, I added a shading mode to render the depthbuffer itself. The graphical representation came in very handy in debugging the data stored within it. Unfortunately, the teapot model and this particular perspective configuration doesn't have a significant amount of depth variation, so another model has also been rendered that is a much better demonstration of what this shows. Pixels that are very close to the near clipping plane shift toward pure white while pixels that are far from the viewer, and are therefore close to the far clipping plane, shift toward to pure black.

Isometric View Utah Teapot Depth Buffer

Isometric View Cow Depth Buffer

Comments are closed.