Department of Computing Science Umeå University

Project 2


This project will introduce you to the consepts of 3D viewing. It will also provide you with an understanding of illumination models.

Goals

You should be able to:
  • load OFF files with arbitrary number of polygons where each polygon can have any number of sides
  • view the 3D object using the model for perspective projection
  • display the loaded 3D object using wireframe
  • display the loaded 3D object using flat shading
  • specify a viewport using rubberband technique
  • clip the lines correctly using either Cohen-Sutherland or Liang-Barsky lineclipping algorithm
In this exercise, all coordinates should be specified using NDC.

3D viewing

The model for perspective projection is described here. You are not allowed to use OpenGL routines for 3D-viewing, however, you will need the routines to draw lines and polygons.

Wireframe and flat shading

Your program should be able to present the 3D object in both wireframe and flat shaded mode. See screenshoots for samples. The simple illumination model is described here.

User interface

Your GUI should allow easy adjustments of the parameters for viewing (At point, From point, Up vector and Angle) and for shading (ka, kd, ks, Ia, Ip, n (phong constant) and light source point). We strongly recommend you to use at least GLUT popup menus but feel to use any menu system. Please, do not use a keyboard-only UI.
It is also a good ide to be able to show the normals of all polygons and the axis of the coordinate system.
The hidden surface problem should be solved with backface culling and painters algorithm. On 3D objects where the inside can be seen, a second color should be used to distiguish inside from outside. It is not neccesary to be able to change the inside color, just use any good fixed value.
See screenshoots for sample parameters.

Bonus points

For a correct solution and demo, you will earn 6 points. For a really good presentation and extra/good functionality, you can be rewarded up to 3 points. Some examples of extra functionality is;
  • Polygon clipping
  • A nice, intuitive way to rotate the 3D object (that is, adjust the viewing parameters) by dragging the object with the mouse. Dragging horizontally for example, should make the object rotate horizontally (that is, rotate around the vertical axis).
  • Any other excellent idea.
Note: If you choose not to demo this project, you will not recieve any points. See rules for more information.

What to hand in

You should hand in a detailed users guide and a nice printout of the source code. Remember also to describe all algorithms you use that are not mentioned in this specification. Your program must be compiled and runnable under Linux. The project due is Monday 6 December 2004 at 13.15.


http://www.cs.umu.se/kurser/TDBC07/HT04/projects/project1/index.html
Responsible for the page: Anders Pettersson
Last modified 2004-11-08
Copyright © 2003. All rights reserved.