aboutsummaryrefslogtreecommitdiffstats
path: root/worksheets
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2021-11-23 10:45:38 -0600
committerMatt Strapp <matt@mattstrapp.net>2021-11-23 10:45:38 -0600
commitb623569b45d256582e962c5a464c0b16b8bd1383 (patch)
treec52429d6e4703800eaa39ce89c342fd3c29c3034 /worksheets
parentdo a4 (diff)
parentUpdate artrender_app.cc (diff)
downloadcsci4611-b623569b45d256582e962c5a464c0b16b8bd1383.tar
csci4611-b623569b45d256582e962c5a464c0b16b8bd1383.tar.gz
csci4611-b623569b45d256582e962c5a464c0b16b8bd1383.tar.bz2
csci4611-b623569b45d256582e962c5a464c0b16b8bd1383.tar.lz
csci4611-b623569b45d256582e962c5a464c0b16b8bd1383.tar.xz
csci4611-b623569b45d256582e962c5a464c0b16b8bd1383.tar.zst
csci4611-b623569b45d256582e962c5a464c0b16b8bd1383.zip
Merge branch 'support-code' of https://github.umn.edu/umn-csci-4611-f21/shared-upstream
Diffstat (limited to '')
-rw-r--r--worksheets/a5_artrender.md65
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* &middot; *l*
+
+*specular* = (*n* &middot; *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*
+&middot; *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) --- */
+```