Assume that each polygon in the SOR has the same material information:
Ka 0 0 0
Kd 0 1 0
Ks 0 0 0
Also assume that the light source is pure white (1, 1, 1) and
is coming from the direction [1, 1, 1].
The viewer is still at (0,0,∞).
Render the SOR but this time with flat shading and lit by the single light source.
For this task, we shall assume that all our polygons are planar. And that the vertices are specified in a counter-clockwise order as viewed from the outside. You will need to form 2 vectors and calculate their cross product. Make sure you are using the right sequence of points for the vectors, and the right sequence of vectors for the cross product.
Add a toggle button to turn the display of surface normals on/off. Display surface normals in red.
The transformation task is done in the vertex shader. For this, you need to pass the vertex information to the vertex shader to work on. You will also need to tell the vertex shader the transformation matrix to apply to each vertex.
Since the color of a polygon is determined on the CPU side, the vertex shader does not need to do anything with regards to colors. On the other hand, the fragment shader takes the color that was calculated in the CPU and uses that to fill (or paint) each pixel of the projected polygon.
Directional lighting tutorial
Check out the shader code in ColoredCube code from the Matsuda-Lea book.
Rubric:
You start off with 100 points. You earn additional credit by turning in your assignment early and/or implement additional features. You lose credit for missing functionality, incorrect results, poorly documented or formatted code, or not following instructions. Below is a partial list: up to 10 points off for poor features.html file up to 10 points off for inadequate comments or hard-to-read code up to 10 points off for not following instructions up to 10 points off for special handling functionality points depending on importance Make sure you: a. submit the right files you want us to grade, b. have tested your code on the browsers in the lab. c. follow the general instructions described in overview.html
victor: aagrawa6 - andy: drooney - aashwin: mespirit -
Put materials in a folder named lab2 and zip it up. Submission must be done using the "submit" command from unix.ic.ucsc.edu
Last modified Tuesday, 22-Jan-2019 09:42:16 PST.