Starting from:

$30

Homework 3 CS 354, BME 345

Homework 3
CS 354, BME 345

1. (5 points) A 2D triangle has vertices (0, 0),(2, 1),(−1, 1). What are the barycentric coordinates of the
point (0.8, 0.7)?
2. (5 points) Suppose a triangle has the following RGB colors at its vertices: c0 = (1, 0, 0), c1 =
(1, 0.8, 0.4), c2 = (0.6, 0.3, 0.9). Given a point with barycentric coordinates (0.2, 0.5, 0.3), what will
the color be at that point using linear interpolation?
3. (5 points) Suppose a triangle has the following vertex normals: n0 = (1, 0, 0), c1 = (0, 1, 1), c2 = (2, 1, 0).
Given a point with barycentric coordinates (0.2, 0.5, 0.3), what will the normal be at that point using
linear interpolation?
1
4. A light source located at (0, 0, 10) emits white light for specular, diffuse and ambient reflections. A
triangle has vertices v0 = (0, 0, 0), v1 = (1, 0, 0), v2 = (1/2, 1, 0). Each vertex has an associated normal,
which are n0 = (0, 0, 1), n1 = (0, 0, 1), n2 = (0,

2/2,

2/2). The triangle has material properties
kd = [1, 0, 0]0
, ks = [0, 1, 0]0 and a specular coefficient of 10. A point p is located at barycentric
coordinates (0.2, 0.6, 0.2) with respect to the triangle. The viewer’s eye is at (5, 0, 10). Using the
Phong reflection model and assuming no distance attenuation, answer the following questions. You
may write code to solve the equations if you wish, but you must show all steps, including the values
of the relevant vectors. Be sure to always normalize your vectors!
(a) (5 points) What is the diffuse reflection term at vertex v1?
(b) (5 points) What is the specular reflection term at vertex v1?
(c) (5 points) Assuming phong reflection, what is the diffuse reflection term at point p?
2
(d) (5 points) Assuming phong reflection, what is the specular reflection term at point p?
(e) (5 points) If we move the light source very slightly up along the positive y axis, what will happen
to the diffuse and specular terms for vertex v1? Why? You don’t need to do the calculations, just
describe what will happen.
5. (5 points) Consider a texture that is square and is a smooth, linear gradient from red to green moving
left to right. That is, all pixels (0, y) are red, all pixels (w − 1, y) are green (where w is the width of
the texture), and all pixels in-between vary linearly in color. Give the color in RGB for the following
texture coordinates.
(a) (0, 0.5)
(b) (0.5, 0.5)
(c) (0.75, 0.5)
(d) (0.75, 0.75)
6. (5 points) Consider the texture from the previous question. Let a triangle have vertices that have
texture coordinates vt0 = (0, 0), vt1 = (1, 0), vt2 = (0, 0. Let point p be at barycentric coordinates
(0.5, 0.5, 0) with respect to the triangle. What is the color at p?
3

More products