Asg 6: Lights!

Objectives

Implement a program to render a 3D object (textured or not) that rotates in place and translates, and where its face and vertex normals are displayed, and is lit using Phong lighting.

Assignment

  1. Use the normals.[vert|geom|frag] shader object to render normals:
    1. vertex normals must be computed as average of all face normals incident on any given vertex (you cannot use an object loading library for this)
    2. face normals may be computed in the normals shader
    3. use the phong lighting model implemented in a shader

Suggestions

  1. Your aw_t C++ class must compute face and vertex normals after the object has been read in (an object loading library cannot be used in this assignment)
  2. How to start?
    1. start by rendering your textured object in 3D, i.e., set up the perspective and view matrices and test this first
    2. you will need to read in both phong and normals shaders to render both the object (pass 1) and its normals (pass 2)
    3. create additional vertex and fragment shaders that implement the Phong lighting model in world space

Input

  1. Use our pyramid.obj file that we came up with in class as input.
  2. You will need to read in both vertex and fragment shaders from files, e.g., phong.vert and phong.frag.
  3. You will also need to read in all three vertex, geometry, and fragment shaders from files, e.g., normals.vert, normals.geom, and normals.frag.
  4. Make sure to include an image file your program is to read as the texture (you could use our ppm_t class for *.ppm images of the stb class from the learnopengl tutorial) if you choose to texture map your object.
  5. You will need to send to your Phong shader the camera position, light position, and you will need to split up your MVP matrix into its constituent parts, namely M, V, and P.

Output

  1. The object should rotate and translate correctly.

Supplemental

  1. Provide a Makefile with a README if there any special program running instructions.

Turn in

Turn in all of your code, in one tar.gz archive of your asg##/ directory, including:
  1. A README file containing
    1. Course id--section no
    2. Name
    3. Brief solution description (e.g., program design, description of algorithm, etc., however appropriate).
    4. Lessons learned, identified interesting features of your program
    5. Any special usage instructions
  2. Makefile
  3. source code (.h headers and .cpp source)
  4. object code (do a make clean before tar)

How to hand in

See handin notes

Grading scheme