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
- Use the
normals.[vert|geom|frag] shader object
to render normals:
- 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)
- face normals may be computed in the normals shader
- use the phong lighting model implemented in a shader
Suggestions
- 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)
- How to start?
- start by rendering your textured object in 3D, i.e.,
set up the perspective and view matrices and
test this first
- you will need to read in both phong and normals
shaders to render both the object (pass 1) and its
normals (pass 2)
- create additional vertex and fragment shaders that implement
the Phong lighting model in world space
Input
- Use our
pyramid.obj file that we came up with in class
as input.
- You will need to read in both vertex and fragment shaders from files,
e.g.,
phong.vert and phong.frag.
- 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.
- 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.
- 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
- The object should rotate and translate correctly.
Supplemental
- 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:
- A
README file containing
- Course id--section no
- Name
- Brief solution description
(e.g., program design, description of
algorithm, etc., however appropriate).
- Lessons learned, identified interesting features of your
program
- Any special usage instructions
Makefile
- source code (
.h headers and .cpp source)
object code
(do a make clean before tar)
How to hand in
See handin notes