Assignment 5: Lighting the Virtual World
- Due May 20, 2019 by 11:59pm
- Points 10
- Submitting a file upload
Objectives
To have a single point light that illuminates your entire world.
Description
Extend your code for Assignment 4 in order to support a single point light that will illuminate the objects of your world using the Phong Shader. Your application is required to have the following features:
-
A world were one can navigate through moving a camera controlled with the keyboard and mouse (as specified in the previous assignment).
- Add two spheres (see example below for generating a sphere) to your world representing the starting and ending position of the world, respectively (you don't have to do anything when the player collides with these spheres).
- A single point light that rotates (e.g. by 5 degrees) around the world over time simulating a day/night cycle.
-
Each object (ground, walls and spheres) of the world is illuminated using the Phong Shader
- Phong Shader models a combination of ambient, diffuse and specular lighting.
- Specular and Diffuse lighting calculations require the normal of the vertices. So you will have to calculate the normal of each vertex and pass this as input to the shader.
Resources
- Readings:
- (WebGL) Matsuda/Lea Ch8, (Chp 6 and Appendix B are GLSL reference)
- (WebGL) The normal matrix: http://www.lighthouse3d.com/tutorials/glsl-12-tutorial/the-normal-matrix Links to an external site.
- (WebGL) Phong shader: http://www.mathematik.uni-marburg.de/~thormae/lectures/graphics1/code/WebGLShaderLightMat/ShaderLightMat.html Links to an external site.
- Examples:
- Code written in the lab to generate a sphere with normal shading (05/14): https://canvas.ucsc.edu/files/1328316/download?download_frd=1
What to Turn in
1. Canvas Submission
Zip your entire project and submit it to Canvas under the appropriate assignment. Name your zip file "[FirstName]_[LastName]_Assignment_5.zip" (e.g. "Lucas_Ferreira_Assignment_5.zip").
2. Live Hosted Submission
Host your assignment on your UCSC portal. This can be achieved by just putting your entire project directory into the 'public_html' folder which you can access via the UCSC Unix timeshare. Your site link is 'https://people.ucsc.edu/~ucsc_user_name/'.
WHEN SUBMITTING YOUR PROJECT ON CANVAS, PLACE YOUR SITE LINK AS A COMMENT OF THE SUBMISSION.
Read the SubmissionGuide.txt file for further explanation on how to submit your assignment.
Rubric
Criteria | Ratings | Pts | ||
---|---|---|---|---|
Have a world made with a ground and walls where one can navigate with a camera as specified in Assignment 4.
threshold:
pts
|
|
pts
--
|
||
Have two spheres representing the starting and ending point of your world.
See exampled code for generating a sphere.
threshold:
pts
|
|
pts
--
|
||
The point light source illuminates the world objects (ground, walls and spheres) with ambient reflection.
threshold:
pts
|
|
pts
--
|
||
The point light source illuminates the world objects (ground, walls and spheres) with diffuse reflection.
threshold:
pts
|
|
pts
--
|
||
The point light source illuminates the world objects (ground, walls and spheres) with specular reflection.
threshold:
pts
|
|
pts
--
|
||
The point light rotates around the world over time simulating a day-night cycle.
You (as a programer) decide the axis in which the point light rotates around.
threshold:
pts
|
|
pts
--
|
||
Total Points:
10
out of 10
|