Midterm Solutions ----------------- Q1.a. Ambient : No. Ambient objects are a hack to capture all light in a scene and reflect it uniformly for all points on the object so the point on the object the laser hits will be indistinguishable from any other point. Diffuse : Yes. Diffuse objects will reflect some energy of the laser hitting a point on the object equally in all directions, one of which will get picked up by the camera image. Specular : No. All the lasers energy will be reflected along the reflected ray by the laser. If lucky the camera will perfectly set up to catch this ray. in all other positions the camera sees no light reflected form that point. b. At the point on the object the two ray equations are equal <2,1,1>t = <7,0,1> + <-1,3,2>s gives t=3, s=1 => point = <6,3,3>. Q2a. A' = (0, 0.5, 1.5) B' = (1.5, 0, 2) C' = (0, 0.5, 0) You can figure this sort of problem out (i) using similar triangles (sometimes), or more generally, by (ii) solving the vector equation. I'll illustrate both methods. (i) We find B' by similar triangles. Label the cube vertices underneath L in the -Y direction T = (1.5, 1, 0) T' = (1.5, 0, 0) We have that LBT ~ LB'T'. Thus LB/LB'=LT/LT' =1/2 Giving LB = LB'/2 B' = L+(B-L)*2 = (1.5, 2, 0) + (0, -1, 1)*2 = (1.5, 0, 2) Verify that this is in fact on the XZ plane (Y=0). (ii) Find C' using vectors. First find C-L = (-1, -1, 0) The shadow will occur where the line C+(C-L)*t intersects a wall. By inspection the YZ plane (X=0) will be that wall. So just consider the X-component of the line equation: 0.5 + (-1)*t = 0 t = 0.5 The coordinates of the shadow is thus C' = C+(C-L)*0.5 = (0.5, 1, 0) + (-1, -1, 0)*0.5 = (0, 0.5, 0) Verify that this is in fact on the YZ plane (X=0). 2b. We'll just solve the vector equation for some general P=(x,y,z). Form the shadow ray: L + (P-L)*t = (1.5 + (x-1.5)*t, 2 + (y-2)*t, z*t) The first wall this ray intersects corresponds to the smallest (positive) value of t that makes one of the components of the ray equation zero. YZ plane (X=0): 1.5 + (x-1.5)*t_YZ = 0 t_YZ = -1.5/(x-1.5) XZ plane (Y=0): 2 + (y-2)*t_XZ = 0 t_XZ = -2/(y-2) So the algorithm in summary: t_YZ = -1.5/(x-1.5) t_XZ = -2/(y-2) t = min(t_YZ, t_XZ) P' = L + (P-L)*t [We can safely ignore shadows on the XY plane, and points with y>=2 or x>=1.5, which won't create shadows.] Q3 a. A silhouette edge is characterized by the edge E having one incident face facing the camera V, and the other as a backface. For F1 (V-V1).F1' >= 0 => front face < 0 => back face So the above formula for the two faces should have different signs for a silhouette edge => the product of two formulae should be -ve so edge E is a silhouette edge if and only if ((V-V1).F1').((V-V1).F2') <= 0 b) No, it will not work for concave objects. _______ | / | / | E\ | \ |_______\ ^ | V suppose the shape above was extruded out of the plane of the paper. the point labeled E would result in an edge that is not a silhouette edge that passes the test above. c) k=(P-V1)/(V2-V1)=(C-C1)/(C2-C1) C= C1+k*(C2-C1). Q4. for each point P { P' = trans(-c_x, -c_y, P) P'' = rotate(-theta, P') } P'''[] = clip(-w/2, w/2, h/2, -h/2, P''[]); for each point P''' { P'' = rotate(theta, P''') P' = trans(c_x, c_y, P'') }