1997 Midterm 2 1) a) There are 5 polygons. Their normals are: N1: [0, -1, 0] N2: [1, 1, 0] N3: [0, 1 -1] N4: [-1, 1 0] N5: [0, 1, 1] b) V1 = N1+N2+N3 = [1, 1, 1] V2 = N2+N3+N4+N5 = [0, 4, 0] V3 = N1+N2+N3 = [1, 1, -1] V4 = N1+N3+N4 = [-1, 1 -1] V5 no normal V6 = N1+N4+N5 = [-1, 1, 1] V7 = N1 = [0, -1, 0] 2) Specular reflection 3) Cavalier 4) a) The surface normals fot the polygons are (1, 0) and (0, 1) respectively. Therefore the angle betwwen the surface normal and the light source is 45 degrees in both cases. The diffuse lighting equation is I*k_d*cos(45) = (1,1,1)*(0.6, 0.4, 0.2)*(1/sqrt 2) = (0.6/sqrt 2, 0.4/sqrt 2, 0.2/sqrt 2) b) For Gouraud, we need to find the per-vertex normals by averaging the neighbors. So, N1 = N01 + N12 = (0, 1) + (1, 0) = (1, 1) N2 = N12 + N23 = (1, 1) N3 = N23 + N34 = (1, 1) In other words they are all pointing in the direction of the light, therefore theta = 0. We again use the diffuse shading equation : I*K_d*cos(0) = (1, 1, 1)*(0.6, 0.4, 0.2)*1 = (0.6, 0.4, 0.2) c) Since normals are the same, interpolated normals will be all the same. Hence, we can reuse the color calculation from 4b. 5) a) B_0 = 1*t^0*(1-t)^2 = 1 - 2*t + t^2 B_1 = 2*t^1*(1-t) = 2*t - 2*t^2 B_2 = 1*t^2 = t^2 b) P(t) = TMG where T = [t^2 t 1] | 1 -2 1 | M = |-2 2 0 | | 1 0 0 | |P_0| G = |P_1| |P_2| c) B_0(1/2) = 1 - 1 + 1/4 = 1/4 B_1(1/2) = 1 - 2(1/4) = 1/2 B_2(1/2) = 1/4 d) P'(t) = T' M G = [2*t 1 0] M G 6) a) Start by plugging in s values into the equation: P(s,t) = [1 1 1 1]M_b G_b M_b^T T^T = = [0 0 0 1] G_b M_b^T T^T = =[P30 P31 P32 P33] M_b^T T^T This reduces us to the 2D Bezier curve where P30, P31, P32 and P33 are the control points. b) |1/8| |1/4| P(1, 1/2) = [1 1 1 1]M_b G_b M_b^T |1/2| | 1 | following the multiplications on both sides we get |1/8| |3/8| P(1, 1/2) = [P30 P31 P32 P33]]|3/8| |1/8| The weights for all other points are 0. c) You can get a surface normal by taking a cross product of the tangents in the s and t directions. The tangents are calculated by taking the first derivative with respect to that paramter. dP/ds = [3*s^2 2*s 1 0] M G M^T T^T |1/8| |1/4| = [3 2 1 0] M G M^T |1/2| = | 1 | |1/8| |3/8| = [0 0 3 3] G |3/8| = |1/8| |1/8| |3/8| = [3(P20-P30) 3(P21-P31) 3(P22-P32) 3(P23-P33)| |3/8| |1/8| |3*t^2| | 2*t | dP/dt = S M G M^T | 1 | = | 0 | |-3/4| |-3/4| = [0 0 0 1] G | 3/4| = | 3/4| The surface normal N = (dP/ds)x(dP/dt) ------------------------------------------------------------------------------ Midterm 2 December 1998 1) presentPoly | A | A B | A B C | B C | C | visiblePoly | A | A | C | C | C | 2) The point at which the surface reflection is at maximum occurs when the reflected vector matches the viewing vector. This point is on the sphere, half-way between the edges of the triangle. To calculate the location of the point use the 30, 90, 60-degree triangle where the hypotenuse is the bisector of the original triangle, to the edge of the sphere with length L/2. From this, we get the x-direction value of -(L*sqrt(3))/4, and y-direction value of L/4, which make the coordinates of our desired spot (-L*/sqrt(3)/4, L/4). 3) a) For orthographic projections, drop the z. P1_ortho = (1, 2) P2_ortho = (-10, 10) b) Use canonical projection matrix M = |1 | | 1 | | 0 1/10 | | 1 | P1_per = [1 2 3 1] M = (10/13, 20/13) P2_per = [-10 10 20 1] M = (-10/3, 10/3) 4) a ) Up = [S - E] = [50 60 70] b) VPN = [O - Z] = [-1 -2 -3] c) V_x = VPN x Up = [1 -2 1] d) V_y = V_x x VPN = [ 4 1 -2] r 1999 1) a) VPN = LA-LF = [-10 0 0], normalized = [-1 0 0] Up = [0 0 1] V_x = VPN x Up = [0 1 0] V_y = V_x x VPN = [ 0 0 1] b) VPN = [ 0 0 1 ] V_x = [ 0 1 0 ] V_y = [ 1 0 0 ] c) same as b 2) a) I_diffuse = k_d * I_d * cos(theta) = = (.8 .1 .1)*(1 1 1) cos(30) = = (.8 .1 .1)*1/2 = (.4 .05 .05) I_specular = k_s * I_s * (cos(alpha))^n = = (.1 0 0) * (.5 .5 .5) * (cos 90)^1 = = 0 I_total = I_diffuse + I_specular = = (.4 .05 .05) b) I_diffuse same equation as before, except theta>90, meaning surface is not lighted, therefore 0. Same with specular. Hence total diffuse+specular = (0 0 0) 3) a) I_diffuse = k_d * I_d * cos(theta) = = (.1 .1 .5) * (1 1 1) * (N_normalized . L_normalized) = = (.1 .1 .5) * ([1 2 3] . [3 2 1]) = = (.1 .1 .5) * (1/14) * (10) = = 5/7 * (.1 .1 .5) b) First calculate the colors at corner of polygon. C1 = (.1 .1 .5)*([3 2 1].[1 -1 1]) = ( 0 0 0 ) C2 = (1/sqrt(42))* (1 1 5) C3 = (sqrt(6)/sqrt(42)*( .1 .1 .5) C4 = (1/sqrt(42))*(.4 .4 2) The color in the center will be a half-way interpolation of all four points, which can be calculated by taking their average: C = (C1+C2+C3+C4)/4 c) For Phong shading we need to first calculate the surface normal in the center, again, by taking the average of normals at the corners. N = N1+N2+N3+N4 = [8 4 -6] C = (.1 .1 .5) [8 4 -6].[3 2 1] = (.1 .1 .5) * 13 / (sqrt(7) * sqrt(58)) 4) a) The answer is b) b) - Floating horizon - painter's algorithm (depth-sort) - cookie-cutter (area subdivision) ...... 5) a) The mapping is one-to-one, and values are unchanged, hence: u = s v = t b) x= 2 cos(2*Pi*1/2) = -2 y= 2 sin(Pi) = 0 z = 1 - 1 = 0 c) T(1/2, 1/2) = (n/2, m/2) 6) a ) Plugin t=0 and t=1 to see what happens at the beginning and ending of curve. For a curve to go through a point you'd need to have the weight of that point be 1 and the weight for the other points be 0. P(0) = [0 0 1] M G = [-2 0 3] G, so no P(1) = [1 1 1] M G = [0 0 1]G = P2, so it does go through P2 b) P(1/2) = [1/4 1/2 1] M G = [-5/4 -1/4 5/2] G = = -5/4*P0 - 1/4*P1 + 5/2*P2 c) We're looking for a solution such that P(t) = T M G = [0 1 0] G This way he only point which has weight 1 is P1, the rest are 0. So we want T M = [ 0 1 0 ] If we develop T M, we get: t^2 + t - 2 = 0 t^2 - t = 1 -2*t^2 + 3 = 0 from the third equation, we can solve for t = sqrt(2/3). If you plug in this value to the other two equations, the results don't match. Therefore there is no solution to this system of equations. The answer is no. d) For a curve to lie within the convex hull of the control points we need to satisfy 2 requiments: 1 - sum of basis functions = 1, YES 2 - all basis function values are between 0 and 1, NO Final answer is NO