diff options
author | KT <tran0563@umn.edu> | 2021-11-09 12:58:15 -0600 |
---|---|---|
committer | KT <tran0563@umn.edu> | 2021-11-09 12:58:15 -0600 |
commit | f965f6daa99cc8d11f732f00002535fdd2e66d65 (patch) | |
tree | 09296334e8a3f0be5b054a96130b54055b5ba126 /worksheets/a5_artrender.md | |
parent | Update a4_dance.md (diff) | |
download | csci4611-f965f6daa99cc8d11f732f00002535fdd2e66d65.tar csci4611-f965f6daa99cc8d11f732f00002535fdd2e66d65.tar.gz csci4611-f965f6daa99cc8d11f732f00002535fdd2e66d65.tar.bz2 csci4611-f965f6daa99cc8d11f732f00002535fdd2e66d65.tar.lz csci4611-f965f6daa99cc8d11f732f00002535fdd2e66d65.tar.xz csci4611-f965f6daa99cc8d11f732f00002535fdd2e66d65.tar.zst csci4611-f965f6daa99cc8d11f732f00002535fdd2e66d65.zip |
Publish a5
Diffstat (limited to '')
-rw-r--r-- | worksheets/a5_artrender.md | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/worksheets/a5_artrender.md b/worksheets/a5_artrender.md new file mode 100644 index 0000000..518ba4c --- /dev/null +++ b/worksheets/a5_artrender.md @@ -0,0 +1,65 @@ +# Assignment 5 (Art Render) Worksheet + +## Q1: Phong Shading + +Given the following lighting equation: + +*diffuse* = *n* · *l* + +*specular* = (*n* · *h*) ^ *s* + +*color* = ka\*Ia + kd\*Id\**diffuse* + ks\*Is\**specular* + +Draw a picture that includes a point on a surface, a light, and labeled arrows +for each vector that shows up in the equation. Hint: make sure that your +vectors point in the right direction to make sense for the equation as written +(e.g., make sure you draw *l* pointing in the correct direction for *n* +· *l* to be calculated correctly)! + +Replace this image with your diagram: + +![](./img/vectors.png) + + +## Q2: Silhouette Outline + +This week in class we'll be talking in more detail about the key matrices used +in vertex and fragment shaders. For example, we'll learn that the +`normal_matrix` must be used rather than the `model_view_matrix` to transform +normals to eye (a.k.a. camera) space. You'll use this in all of the shaders +you write. The outline shader includes the most interesting use of normals +though because not only does each vertex have a normal, the shader also has +access to the "left normal" for the normal of the triangle to the left and the +"right normal" for the triangle to the right. As you see in the assignment +handout these are used to determine whether the vertex lies on a silhouette +edge. Here are a few questions about the logic you'll need to use in that +shader: + +### Q2.1 +Your outline vertex shader will need to include an if statement that is true +if the vertex lies on a silhouette edge by testing the left normal and right +normal in some way. Assuming `vec3 e` is a vector calculated in eye space +that points from the vertex to the eye and `vec3 nl` is defined for the left +normal and `vec3 nr` for the right normal, fill in the condition on the if +statement: + +``` +if (/* --- Fill this in --- */) +``` + +### Q2.2 +For the `nl` and `nr` that appear in your if statement above, should these two +vectors be transformed to eye space using the `normal_matrix`? + +``` +/* --- Write your answer here (yes / no) --- */ +``` + +### Q2.3 +Inside the "if statement" from Q2.1, you will need to offset the vertex in the +direction of the normal to move it outwards in order to create the "fin" that +forms the silhouette outline. This process of changing the location of the vertex is like making a change to the actual 3D geometry of the model, as if you quickly loaded the model into a 3D modeling program, edited the vertex by hand, and resaved the file. So, we want to make this change while the vertex is still in model space, before transforming it to world space, camera space, and so on. With this in mind, which version of the vertex normal should you use at this step? Should you transform the normal as usual by multiplying by the `normal_matrix` in this case? + +``` +/* --- Write your answer here (yes / no) --- */ +``` |