Interactive Computer Graphics: Assignment 5

Viewing, Projection and Flat-Shading


Topics:



  1. Write a program that loads a triangle mesh model (with at least 100 triangles) from an smf file. smf files can be found here

  2. The file name of the model should be passed as an argument to your program

  3. Calculate a surface normal for each triangle.

  4. Normalize the normal and take its absolute value, and set the triangle's color equal to this vector. This will visualize the normal as a color.

  5. Implement a rotating camera view of the model using the LookAt function.
    Your camera should rotate on a cylinder around the model.
    Allow the user to interactively change the height, the orbit radius and cylinder angle of the camera via keyboard input.
    Changing the angle should make the camera rotate around and look at the smf model (i.e. your LookAt point stays constant (the model centroid perhaps)).

    Recall that the Cartesian coordinates of a point (X, Y , Z) defined in cylindrical coordinates (θ, R(adius), H(eight)) is
    X = R * cos(θ)
    Y = R * sin(θ)
    Z = H

    This is for a cylinder aligned along the Z axis. You may have to rearrange the terms to properly view some of the models.
  6. Allow the user to select either parallel or perspective projection.

Your flat-shaded models should look something like the ones below.


Grading Scheme

  1. Reading in and storing an SMF model (1 point)
  2. Implementing flat shading (2 points)
  3. Interface for interactively changing view of model (1 point)
  4. Properly implementing camera movement (2 points)
  5. Implementing parallel projection (2 points)
  6. Implementing perspective projection (2 points)

Last modified February 26, 2017.