CS 130 Exam I. Fall 2015

Similar documents
CS 130 Exam I. Fall 2015

CS 130 Final. Fall 2015

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Rendering approaches. 1.image-oriented. 2.object-oriented. foreach pixel... 3D rendering pipeline. foreach object...

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Pipeline Operations. CS 4620 Lecture 14

Institutionen för systemteknik

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Pipeline Operations. CS 4620 Lecture 10

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Topics and things to know about them:

Midterm Exam CS 184: Foundations of Computer Graphics page 1 of 11

CS 464 Review. Review of Computer Graphics for Final Exam

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CHAPTER 1 Graphics Systems and Models 3

The exam begins at 2:40pm and ends at 4:00pm. You must turn your exam in when time is announced or risk not having it accepted.

Deferred Rendering Due: Wednesday November 15 at 10pm

Midterm Exam! CS 184: Foundations of Computer Graphics! page 1 of 13!

CS 4620 Program 3: Pipeline

6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, :05-12pm Two hand-written sheet of notes (4 pages) allowed 1 SSD [ /17]

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

The exam begins at 2:40pm and ends at 4:00pm. You must turn your exam in when time is announced or risk not having it accepted.

CS559 Computer Graphics Fall 2015

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

Graphics Pipeline. CS535 Fall Daniel G. Aliaga Department of Computer Science Purdue University

Graphics Pipeline 2D Geometric Transformations

8.1 Geometric Queries for Ray Tracing

Midterm Exam! CS 184: Foundations of Computer Graphics! page 1 of 14!

CS 4620 Midterm, March 21, 2017

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Geometric Queries for Ray Tracing

Rasterization. COMP 575/770 Spring 2013

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

CSE Intro to Computer Graphics. ANSWER KEY: Midterm Examination. November 18, Instructor: Sam Buss, UC San Diego

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

CS 130, Final. Solutions

CS452/552; EE465/505. Geometry Transformations

Introduction to Visualization and Computer Graphics

CS4620/5620: Lecture 14 Pipeline

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

Computer Graphics. Bing-Yu Chen National Taiwan University

Supplement to Lecture 16

The University of Calgary

U.C. Berkeley, EECS, Computer Science TAKE HOME EXAM. Your Class Computer Account: DO NOT OPEN THIS INSIDE SODA HALL -- WAIT UNTIL YOU ARE ALONE!

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

CS 4620 Final Exam. (a) Is a circle C 0 continuous?

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th

Homework 3: Programmable Shaders

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Computer Graphics I Lecture 11

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

SUMMARY. CS380: Introduction to Computer Graphics Ray tracing Chapter 20. Min H. Kim KAIST School of Computing 18/05/29. Modeling

Models and Architectures

TDA361/DIT220 Computer Graphics, January 15 th 2016


Ray Tracing Basics I. Computer Graphics as Virtual Photography. camera (captures light) real scene. photo. Photographic print. Photography: processing

CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

Lecture 8 Ray tracing Part 1: Basic concept Yong-Jin Liu.

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

The Traditional Graphics Pipeline

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

CS451Real-time Rendering Pipeline

The Rasterization Pipeline

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Midterm Exam Fundamentals of Computer Graphics (COMP 557) Thurs. Feb. 19, 2015 Professor Michael Langer

CS384G Midterm Examination Spring 2008

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Computer Graphics and GPGPU Programming

Interactive Real-Time Raycasting

Interpolation using scanline algorithm

CPSC GLOBAL ILLUMINATION

The Graphics Pipeline. Interactive Computer Graphics. The Graphics Pipeline. The Graphics Pipeline. The Graphics Pipeline: Clipping

Illumination and Shading

Surface shading: lights and rasterization. Computer Graphics CSE 167 Lecture 6

CMSC 435/634: Introduction to Graphics

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Comp 410/510 Computer Graphics. Spring Shading

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

Werner Purgathofer

9. [20 points] A degree three Bezier curve q(u) has the four control points p 0 = 0,0, p 1 = 2,0, p 2 = 0,2, and p 3 = 4,4.

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Raytracing CS148 AS3. Due :59pm PDT

QUESTION BANK 10CS65 : COMPUTER GRAPHICS AND VISUALIZATION

U.C. Berkeley, EECS, Computer Science TAKE HOME EXAM. Your Class Computer Account: Your student ID #:

The Traditional Graphics Pipeline

THE AUSTRALIAN NATIONAL UNIVERSITY Final Examinations(Semester 2) COMP4610/COMP6461 (Computer Graphics) Final Exam

Real Time Rendering of Complex Height Maps Walking an infinite realistic landscape By: Jeffrey Riaboy Written 9/7/03

Computer Graphics. Illumination and Shading

Transcription:

CS 130 Exam I Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying to ask and answer that. 1

Question Points Score True/False 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 Multiple Choice 11 4 12 4 13 4 14 4 15 4 16 4 17 4 18 4 19 4 20 4 Written 21 15 22 10 23 15 Total 100 2

1 True/False For each question, indicate whether the statement is true or false by circling T or F, respectively. 1. (T/ F ) Rasterization occurs before vertex transformation in the graphics pipeline. 2. ( T /F) Rasterization may generate multiple fragments per pixel. 3. ( T /F) Matrix multiplication is associative but not commutative. 4. (T/ F ) Perspective transformation is a linear transformation. 5. ( T /F) Applying a perspective transformation in the graphics pipeline to a vertex involves dividing by its z coordinate. 6. (T/ F ) Clipping geometry against the view volume can be done independently on each vertex, make the graphics pipeline extremely fast. When clipping triangles we need to use connectivity of vertices. 7. (T/ F ) The directional light source idealization is appropriate for a light that is very close to the scene. It is appropriate for a distant light source, e.g.,the sun. 8. ( T /F) When using the Phong Reflectance Model, we calculate the red, green, and blue color channels independently. 9. (T/ F ) When using the Phong Reflectance Model with smooth shading for a triangulated surface, we will calculate the Phong Reflectance Model once per triangle. In smooth shading, the shading calculation is done once per vertex. 10. ( T /F) Modern day GPUs allow the user to supply custom vertex and pixel shaders. 2 Multiple Choice For each question, circle exactly one of (a)-(e), unless otherwise stated. 11. Consider the use of homogeneous coordinates (x, y, z, w) T in the graphics pipeline. I. (x, y, z, w) T can be used to represent either a 3D point or a 3D vector. I (b) I and II only w = 0 for a 3D vector. Nonzero values of w are used to effect translation and perspective transformation. (c) II and III only (d) I and III only (e) I, II and III 3

12. Consider the OpenGL graphics pipeline. Which statements are true? I. Pipelining increases throughput and decreases latency. I (b) II only (c) OpenGL sorts triangles to determine visibility. In modern OpenGL, the user may supply shaders which will execute on the GPU. III only (d) I and II only (e) I and III only 13. Which of the following are true? I. Backface culling refers to eliminating geometry with backfacing normals. I The Painter s algorithm attempts to sort fragments and draw them back to front. Using z-buffering, shading calculations will be done for fragments that may never appear on screen. (b) I and II only (c) II and III only (d) I and III only (e) I, II and III 14. Concerning flat, smooth, and Phong shading, I. in flat shading the shading calculation is done once per triangle, while in Phong shading the shading calculation is done once per fragment. I (b) I and II only (c) flat shading does not require any normals. smooth shading requires interpolation of normals to vertices. I and III only (d) II and III only (e) I, II and III 4

15. Match the type of transformation in the left column with the example transformation matrix in the right by drawing lines between the matching boxes. translation perspective nonuniform scale identity 1 0 0 1 0 1 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 3 2 0 0 1 1 5 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 16. Perspective transformations I. are nonlinear transformations. preserve the z ordering of vertices between the near and far planes. I can change the sign of the z coordinate for vertices behind the eye. (b) I and II only (c) I and III only (d) II and III only (e) I, II and III 5

17. Consider the Midpoint algorithm given here: (1) y = y0 (2) d = f(x0+1,y0+1/2) (3) for x = x0 to x1 (4) do (5) draw(x,y) (6) if (d<0) (7) then (8) y = y+1 (9) d = d+(y0-y1)+(x1-x0) (10) else (11) d = d+(y0-y1) (12) end (13) end Which statements are true? I. For a line with slope m > 1, we should change the outer loop in line (3) to be over y. Lines (9) and (11) update the decision variable d through an incremental evaluation of the line equation f. I This algorithm fails if d is ever 0. (b) I and II only (c) I and III only (d) II and III only (e) I, II and III 18. Which of the following statements about barycentric coordinates (α, β, γ) for triangles are true? I. If s = α+β +γ, then s < 1 for points inside the triangle, s > 1 for points outside the triangle, and s = 1 for points on the triangle. I (b) I and II only At least one of α, β, and γ will be 0 for a point on the triangle. α, β, and γ can be used to interpolate vertex attributes across the face of the triangle. (c) I and III only (d) II and III only (e) I, II and III 6

19. Consider the 3D vectors, x, y, illustrated below, and dot product and cross product. Which statements are true? (a) I. x y > 0. x y = 0, because x and y lie in the same plane. I x x = y y. I only (b) II only (c) I and II only (d) I and III only (e) None 20. Consider the following equation from the Lambertian reflectance model, where R a, R d, L a, and L d are the ambient and diffuse reflectance of the object, and the ambient and diffuse components of the light, respectively, l is the light vector, and n is the object normal vector. I = R a L a + R d L d max(0, l n) I. Polygons facing away from the light will necessarily have I = 0. I (b) II only (c) I and II only This formula can capture specular highlights. Generally n will vary over the surface of the object but l will be constant. (d) I and III only (e) None 7

3 Written Response 21. Consider a line in the plane going through the points (1, 2) and (2, 4). (a) Write down the explicit equation for the line, with x the independent variable and y = f(x) the dependent variable. Answer The explicit equation is of the form y = f(x) = mx+b. In this case m = 4 2 2 1 = 2, b = 0, so y = f(x) = 2x. (b) Write down an implicit equation for the line. Identify a normal to the line. Answer f(x, y) = 2x + y = 0. This can also be expressed as so the vector ( 2, 1) T is normal to the line. f(x, y) = ( 2, 1) (x, y) = 0, (c) Write down a parametric equation for the line segment going through the two points, in terms of a single parameter t [0, 1]. Answer The parametric equation is of the form p(t) = a + t(b a) for segment endpoints a and b. In this case, ( ( 1 1 p(t) = + t, 0 t 1. 2) 2) 8

22. Come up with a series of matrices as well as an order of multiplication (you don t need to actually perform the multiplication) to transform the triangle (0,0), (1,0), (0,3) to (-1,0), (-3,0),(-1,-6). Sketch the triangle at every step of the transformation. The transformations are: 1. Scale uniformly by 2: 2. Rotate by π radians CCW: 3. Translate left by -1: S = 2 0 0 0 2 0 0 0 1 cos(π) sin(π) 0 R = sin(π) cos(π) 0 0 0 1 1 0 1 T = 0 1 0 0 0 1 Thus each point in the triangle would be multiplied by the matrix The effect on the triangle is illustrated below T RS. 9

23. Consider a ray with endpoint a and a normalized direction u, p(t) = a + tu, t 0, (1) and a sphere of radius r, centered at the origin. The implicit equation for the sphere is given as follows: f(p) = p p r 2 = 0 (2) (a) Describe geometrically the ways in which the ray can intersect/not intersect with the sphere. I.e., when is there exactly one intersection, when are there two intersections, and when are there no intersections? Answer We enumerate the ways in which the line containing the ray can intersect the sphere, and for each case how the ray itself (t 0) can intersect the sphere. These cases are illustrated below. i. 0 intersection points of line and sphere A. the ray also also does not intersect with the sphere ii. 1 intersection point of line and sphere A. the ray contains the intersection point B. the ray does not contain the intersection point iii. 2 intersection points of line and sphere A. the ray contains point intersection points B. the contains exactly one intersection point C. the ray does not contain either intersection point In summary, 0 intersection points: ia, iib, and iiic 1 intersection point: iia and iiib 2 intersection points: iiia ia iia iib iiia iiib iiic 10

(b) Find an expression for t where the intersection occurs by plugging eq. (1) into eq. (2) and solving for t. How can this expression to be used to distinguish the three cases described in part (a)? Hint (Quadratic formula): Solutions to ax 2 + bx + c = 0 are x = b± b 2 4ac 2a Answer Plugging eq. (1) into eq. (2), we get f(p(t)) = (a + tu) (a + tu) r 2 = 0. This gives (a + tu) (a + tu) r 2 = 0 a a + 2ta u + t 2 u u r 2 = 0 (u u) t 2 + (2a u) t + ( a a r 2) = 0. We know u u = 1 since the direction vector u of the ray is normalized. So this simplifies to t 2 + (2a u) t + ( a a r 2) = 0. Using the quadratic formula given in the hint, we solve for t: Simplifying further, the expression for t is We will label the two roots as t = 2a u ± 4(a u) 2 4(a a r 2 ) 2 t = a u ± (a u) 2 (a a r 2 ) t1 = a u (a u) 2 (a a r 2 ), t2 = a u + (a u) 2 (a a r 2 ). The different intersection cases can be distinguished by the value of the discriminant d = (a u) 2 (a a r 2 ), and of t1 and t2. These are summarized in this table, with l = number of line/sphere intersections, r = number of ray/sphere intersections d t1 t2 fig l r d < 0 t1 complex t2 complex ia 0 0 d = 0 t1 0 t2 0 iia 1 1 d = 0 t1 0 t2 0 iib 1 0 d > 0 t1 0 t2 0 iiia 2 2 d > 0 t1 < 0 t2 0 iiib 2 1 d > 0 t1 < 0 t2 < 0 iiic 2 0 11

(c) Write pseudocode for an algorithm for finding the intersection points or identifying that there is is no intersection. Answer // returns number of intersections found // sets intersection1 to first intersection, if applicable // sets intersection2 to second intersection, if applicable FindIntersections(a,u,r) d = sqr(dot(a,u)) - dot(a,a) + sqr(r) if (d < 0) return 0 // no intersections end t1 = -dot(a,u) - sqrt(d) t2 = -dot(a,u) + sqrt(d) if (d == 0) if(t1 >= 0) intersection1 = return 1 end end intersection2 = a+ t1 * u if (d > 0) if (t2 < 0) return 0 else if (t1 < 0) intersection2 = a + t2 * u return 1 else intersection1 = a + t1 * u intersection2 = a + t2 *u end end 12