computer graphics代写: COMP 3801 Winter 2018 Written Assignment 4

COMP 3801 Winter 2018

Written Assignment 4

Show how you arrive at each answer to receive partial credit for incorrect answers.

Submitting Your Assignment (see Canvas for due date/time)

All submissions must be online, through Canvas, as a PDF file. If you use Microsoft Word to write your answers (recommended), use “Save As…” and save as file type PDF. If you use Google Docs (also a good solution), use “Download as PDF Document”. Other software which generates a PDF file is also fine to use.

If you hand-write your answers, you are responsible for readability. The recommended method is to scan using one of the scanners in the library (or your own scanner), at 300 dpi or higher. If you must use your cell phone camera (not recommended), get the free Microsoft Office Lens App (iOS and Android). This app will correct perspective and adjust exposure for better readability.

Name:                                                                                                                                                                                             

 

1.   Perspective, Interpolation, and Hidden Surfaces

An edge of triangle A has vertices  and . An edge of triangle B has vertices  and . All points are in perspective-projected homogeneous coordinates.

 

  1. Calculate the equivalent representations of all 4 points after perspective division. Call these points , and .                                                                 [9 points]

 

 

 

 

 

 

 

 

  1. Calculate the linearly interpolated z and w coordinates of the midpoints in homogeneous coordinates of edges from to , and from  to  (just average the z and w coordinates). Perform perspective division on these z                                                                                                                                       [9 points]

 

 

 

 

 

 

 

 

 

 

 

 

 

  1. Calculate the linearly interpolated z coordinates of the midpoints in ordinary coordinates of edges from to , and from  to  (just average the z coordinates).                                                                         [9 points]

 

 

 

 

 

 

 

 

 

  1. The interpolated z values calculated in b) and c) are different. Briefly explain which method should be used to calculate depth values for the Z-buffer, and why.                                                                [6 points]

2.   Transformations, Viewing, and Lighting

Given the following matrices and points for typical OpenGL rendering:

  •  is the perspective projection matrix (transform from view frame to clip coordinates)
  •  is the view matrix (transform from world to view frame)
  •  is the model matrix (transform from model to world frame, may include non-uniform scale)
  •  is a light source location point (in the world frame)
  •  is a point on the model surface (in the model frame)
  •  is the unit surface normal vector at P (in the model frame)

Using the above information, answer the following items regarding point . Give the expression (or set of expressions, defining new variables as needed) to compute the requested value.

 

  1. The final projected location of in clip coordinates.                                                                       [9 points]

     

  2. The unit vector in the view frame, from the transformed point towards the transformed light source.                                                                                                                                                              [9 points]

 

 

 

 

 

  1. The lighting unit vector in the view frame, from the transformed point towards the center of projection (not the view frame basis vector for which we’ve also used ).                                                                [9 points]
  2. The transformed unit surface normal in the view frame (call it ).         [10 points]

 

 

 

3.   Lighting and Shading

In the view frame, you are given the following items:

  • A light source located at homogeneous point . It has RGB diffuse intensity
    , specular intensity , and ambient intensity .
  • A point p at . The surface unit normal vector n at  is . The surface RGB diffuse absorption coefficients at are kd = (0.75, 0.75, 0.75), specular ks = (0.9, 0.9, 0.9), and ambient
    ka = (1.0, 1.0, 1.0). The surface shininess coefficients are α = 5 and β = 4.
  • A viewer position q at the origin (0, 0, 0) of the view frame.

Using the above information, answer the following items regarding Phong shading at point p. Perform all calculations within the viewing coordinate frame (no transformations necessary).                         [3 points each]

(a) What is the numeric value of the unit vector l from p towards light source s?


(b) What is the numeric value of the unit vector v from p towards the viewer position q?

(c) What is the numeric value of the unit vector r, the primary light reflection direction?


(d) What is the numeric value of the unit vector h, the halfway vector?

Lambertian) component of the shade value at p?

p?

 

(g) What are the numeric RGB values of the specular component of the shade value at p, if computed using the original Phong method, using shininess coefficient α?

p, if computed using Blinn’s modification to the original Phong method using shininess coefficient β?

 


(i) What are the numeric RGB values for the final total shade values at p, if computed using the original Phong method (values from parts e, f, and g above)?

 

p, if computed using Blinn’s modification to the original Phong method (values from parts e, f, and h above)?