JMU CS488 - Computer Graphics Applications
Help Policies Solutions Study-Aids Syllabus Tools
Programming Assignment 9


1 Overview

For this assignment you must use improve your 3-D rasterizer from programming assignment 8 by adding lighting and shading. Specifically, you must implement and use a GouraudShader class.

This assignment is about 3-D computer graphics. You will not use any new aspects of C++.

2 Detailed Specification

The specifications for the classes in this assignment are available in "documentation format". That is, you are being provided with the documentation for the classes, and your implementation must conform to the documentation.

3 Hints

The following hints may help you complete this assignment.
  1. The double array named intensities contains the intensity of the light at each of the three vertexes in the Triangle. They are denoted \(I_a\), \(I_b\), and \(I_c\) in the lecture notes. The elements of the intensities array should be initialized in the setTriangle() method of the GouraudShader using the lightng model from the lecture notes.
  2. As you know, the lighting model needs parameters. I used \(\delta = 1.00\), \(A = 15.00\), \(L = 5.00\), \(\kappa_A = 0.05\), \(\kappa_D = 0.05\), and \(\kappa_S = 0.15\), but you may have to play with them to get a rendering that you like.
  3. The calculateColor() method in a Colorizer is passed several parameters. The first three relate to the first vertex of the "from" side of the Triangle, and the next three relate to the "to" side of the Triangle.

    Recall that a Triangle contains three vertexes. The fromSideFirstIndex is the first vertex of the "from" side and the fromSideSecondIndex is the second vertex of the "from" side. The same idea is used for the "to" side.

    phi contains the interpolation weight for the "from" side (which is denoted by \(\phi\) in the lecture notes on shading). Similarly, tau contains the interpolation weight for the "to" side (which is denoted by \(\tau\) in the lecture notes).

    pi contains the interpolation weight for each pixel on the scan line (which is denoted by \(\pi\) in the lecture notes).

  4. The calulcateColor() method in the GouraudShader should use the intensities array and the red, green, and blue components of the (front) Color attribute of the vertexes of the Triangle.

Obviously, you should feel free to ask any other questions you may have.

4 Integration Testing

You must perform integration testing using the teapot.txt and fighter.txt data files from programming assignment 7. The resulting images should look something like the following:
teapot.png
fighter.png

5 Submission

You must submit .pdf files containing the images generated by your implementation using Canvas.

6 Grading

Points will be awarded based on the correctness of the images generated by your implementation.

Copyright 2020