GPU Programming EE Practice Midterm Examination

Size: px
Start display at page:

Download "GPU Programming EE Practice Midterm Examination"

Transcription

1 Name Solution GPU Programming EE Practice Midterm Examination This practice exam has been made a little longer than the actual midterm is expected to be. Also, some questions are expected to be answered using references, whereas on the actual midterm all needed information will be provided. Alias Practice Exam Total (100 pts) Good Luck!

2 Problem 1: A scene contains a light at position L and a vertex at position V. The scene contains a plane which includes point P 0 and has normal n. The scene also contains a circle of radius r with the center at C, and with normal m. (a) Let P be the point on the plane where the vertex casts a shadow. Find an expression for P. This is a simple line/plane intercept problem. To find the shadow consider a line passing through L and V. Let P be the point where the line passes through the plane (assuming it does). P will be the shadow location if V is between L and P. Let LV be the vector from L to V. The parametric equation of the line through L and V is then P = V + tlv, where t is the parameter. If P is on the plane then PP 0 is orthogonal to the plane normal, n and so PP 0 n = 0. Substituting for P yields (V + t LV )P 0 n = 0 (P 0 V t LV ) n = 0 V P 0 n tlv n = 0 Substituting t in the line equation gives the possible shadow location: t = V P 0 n LV n V P = V + P 0 n LV. LV n (b) For what value of r will the shadow cast by V be exactly on the circle perimeter. Hint: Simple once the previous part solved. This is another line plane intercept problem. Find the point at which the line defined by the vertex and light intercepts the plane containing the circle, call that point A. Then r is just the distance between A and C. 2

3 Problem 2: A scene contains a moving sphere of radius r with center at S(t) = S 0 + tv, where t is the time, S 0 is the position at t = 0, and D is the velocity. The scene also contains a cube with which the sphere may collide. The cube center is at C, a side of the cube has length a, and the face normals are ±ˆn 1, ±ˆn 2, and ±ˆn 3. Hint: From that information we can determine that a point on one of the faces is C + a 2 ˆn 1, a point on one of the edges is C + a 2 ˆn 1 + a 2 ˆn 2 and one of the corners is C + a 2 ˆn 1 + a 2 ˆn 2 + a 2 ˆn 3. (a) Describe the three ways the sphere can collide with the cube. Each will require solving a different kind of geometric problem. The ball can collide with a face (sphere/plane collision), an edge (sphere/line collision), or a corner (sphere/point collision). The brute-force way to determine collision time is to find the collision time with each of the six faces, 12 edges, and four corners, and then use the smallest such time. (b) Write expressions for collision time with each type of element (assuming they do collide). Hint: One of these is a solution to a prior problem. Note: This problem is harder than I would ask on a real exam. On a real exam I might ask for expressions indicating how close the sphere is to each type of element at a particular time (with a distance of zero or perhaps less than r indicating contact). We need expressions for when the sphere will hit a plane (cube face), line (cube edge), and point (cube corner). The path of the center of the sphere forms the line S(t) = S 0 + td. Let Q be a point on a corner of the cube, Q = C + a 2 ˆn 1 + a 2 ˆn 2 + a 2 ˆn 3. The plane collision will be shown for the face containing Q and normal n 1. For the line collision it will be the edge touching Q and in direction n 1, and for the corner collision the point Q. At time t the sphere center will be at S(t), at the time of impact the sphere will be distance r from the plane, so we will solve the plane/line intercept problem for a plane moved distance r from the cube, that moves Q to Q p = Q+rˆn 1 ; the plane normal is still n 1. Using the solution to the line/plane intercept from the previous problem we find the collision time. t = S 0 Q p n 1 D n 1 For the corner collision we need to find the time the sphere is at distance r from a corner. This is equivalent to asking when the center of the sphere intercepts a sphere of radius r centered on Q. When S(t) is a distance r from Q then QS(t) = r, or QS(t) QS(t) = r 2. Substituting for S(t): Solving for t:. QS(t) QS(t) = r 2 (S 0 + td Q) (S 0 + td Q) = r 2 ( QS 0 + td) ( QS 0 + td) = r 2 QS 0 QS 0 + 2QS 0 td + t 2 D D = r 2 t = 2 QS 0 D ± (2QS 0 D) 2 4(D D)( QS 0 2D D QS 0 r 2 ) The sphere will collide with the corner if the discriminant is non-negative, that is (2QS 0 D) 2 4(D D)( QS 0 QS 0 r 2 ) 0. If it s positive there are two solutions, the one to use is either the smaller one, or the smaller non-negative positive one. 3 (1)

4 For an edge collision we need to find the time the sphere is at a distance r from the edge. The edge is on the line Q(u) = Q+un 1. Suppose D n 1 = 0. That would mean the closest point on the line to the sphere is fixed, so we could just use the line/sphere intercept time solution, (1). Find a new sphere velocity D in which the velocity component in the direction of n 1 is removed: D = D (D n 1 )n 1. It should be easy to verify that D n 1 = 0. Since only velocity in the direction of n 1 was removed from D spheres following S(t) = S 0 + td and S (t) = S 0 + td should be at distance r at the same time. So just solve (1) substituting D for D. (c) It s possible the sphere never collides with the cube. Show a computationally inexpensive way to test for this possibility. For this find the time of closest approach to either the center of the cube or a corner. If the time is based on the center then collision is impossible if the sphere center never comes closer than 3/4a + r. To test for that inexpensively evaluate argument to the square root in (1) but replace r with 3/4a + r and Q with C: (2CS 0 ) 2 4(D D)( CS 0 CS 0 ( 3/4a + r) 2 ) (2) If this quantity is negative the sphere cannot touch the cube, if its zero or positive it might hit the cube and so specific collisions must be tested for. Note that ( 3/4a+r) 2 can be precomputed, though quantities like S 0 are might be changed elsewhere in the simulation. 4

5 Problem 3: A scene contains a tray upon which are cups. On the next page is code that renders the scene using a Tray class and a Cup class. A tray object can hold multiple cups. Each object provides an array of vertices that describes its appearance (but not contained objects). So, for example, tray->vtx_array_pointer returns vertices that form a tray, but not the cups upon it. The vertices are in the object s own coordinate space. The location member gives the location of an object in its parent s coordinate space. So cup->location is a coordinate in the tray s coordinate space. See the code on the next page. (a) The code sets the correct modelview matrix for rendering the tray, but code for setting the modelview matrix for the cup is not finished. Finish it. The solution appears below. Note that the mtray transformation matrix is multiplied. pmatrix mcup = mtray * ptranslate(-cup->location) * cup->orientation; (b) Changing a transformation is relatively time consuming, especially when it s only done for a few vertices, as might be the case with the cup at the center of the loop nest. Show how to compute cup vertex coordinates for which the modelview matrix set for the tray is sufficient. That is, find a transformation matrix for the code below that will make the glloadtransposematrixf(mcup) call unnecessary (but the glloadtransposematrixf(mtray) will still be needed). pmatrix matrix = ptranslate(-cup->location) * cup->orientation; // SOLUTION \endsol \beginlit for( int i=0; i<cup->vtx_cnt; i++ ) cup->vtx_array_pointer_new[i] = matrix * cup->vtx_array_pointer[i]; (c) If the loop from the previous part were executed each time show_tray was called, execution would probably be slower despite the fact that the transformation matrix is not changed as often. Explain why. The GPU can perform the matrix multiplication faster than the CPU, so running the loop above might take more time than is saved by not having to change transformation matrices. 5

6 Problem 3, continued: The code for rendering tray and cups: void show_tray() { // Location of tray in world coordinate space. pcoor tray_location = tray->location(); // Matrix that rotates tray coordinates (in tray space) to correct // position in world coordinate space. pmatrix tray_orientation = tray->orientation(); // Note: modelview is the current modelview matrix, which maps // world coordinates to eye coordinates. glmatrixmode(gl_modelview); pmatrix mtray = modelview * ptranslate(-tray_location) * tray_orientation; glloadtransposematrixf(mtray); glvertexpointer(3,gl_float,0,tray->vtx_array_pointer); glenableclientstate(gl_vertex_array); gldrawarrays(gl_triangles,0,tray->vtx_cnt()); while ( Cup* cup = tray->contents_iterate() ) { // Render one cup that s on the tray. // Location of cup in tray coordinate space. pcoor location = cup->location; // A rotation matrix that will rotate the cup into the correct // position in tray coordinate space. pmatrix orientation = cup->orientation; glmatrixmode(gl_modelview); pmatrix mcup = ; // SOLUTION HERE. glloadtransposematrixf(mcup); } } glvertexpointer(3,gl_float,0,cup->vtx_array_pointer); glenableclientstate(gl_vertex_array); gldrawarrays(gl_triangles,0,cup->vtx_cnt()); 6

7 Problem 4: Write OpenGL code that renders a simple cup (a hollow cylinder with one end covered). The cup center is at the origin. The radius of the cup is 11 (in world space coordinates). The cup is upright (up is (0,1,0)), and has a height of 22. Include vertices and normals. Ignore colors and lighting. The code should be reasonably efficient. Solution appears below. const int sides = 10; const double delta_theta = 2 * M_PI / sides; // Cylinder glbegin(gl_quad_strip); for ( double theta = 0; theta <= two_pi; theta += delta_theta ) { const double cos_th = cos(theta); const double rcos_th = r * cos_th; const double sin_th = sin(theta); const double rsin_th = r * sin_th; pvect normal( cos_th, 0, sin_th ); glnormalf( cos_th, 0, sin_th ); glvertex3f( rcos_th, 0, rsin_th ); glvertex3f( rcos_th, height, rsin_th ); } glend(); // Circle glbegin(gl_triangle_fan); glnormalf(0,1,0); glvertex3f(0,0,0); for ( double theta = 0; theta <= two_pi; theta += delta_theta ) { const double cos_th = cos(theta); const double rcos_th = r * cos_th; const double sin_th = sin(theta); const double rsin_th = r * sin_th; glvertex3f( rcos_th, 0, rsin_th ); } glend(); 7

8 Problem 5: A scene contains a wall that has letters (forming some text) cut out of it. The wall itself is dark gray and behind the wall are light-colored objects, which you can see through the holes forming the letters. You are given a texture with the text (say, the EE 4702 syllabus) where the letters (the ink) are black and opaque (α = 1) and the background is transparent (any color, α = 0). The command glbindtexture(gl_texture_2d,texid_text); will bind this texture to a texture unit. Describe how to achieve this effect using a texture, the stencil buffer, and an alpha test. See section 4.1 of the OpenGL 3.0 specification for details on how the alpha and stencil test relate. If this weren t a practice exam more details would be given. Assume the code wall->render() will send wall vertices to OpenGL and other->render() will send vertices of other parts of scene to OpenGL. The solution appears below. In the first pass the stencil buffer is written with a 1 wherever there is ink. Ink is detected using the alpha test. If the fragment s alpha value is not 1 it fails the alpha test (and so the stencil buffer isn t written). The stencil test in pass 1 always fails (if its reached). The glstencilop tells OpenGL to replace the existing stencil value with our own when the stencil test fails (the other two arguments are for depth test fail and pass). The gltexenvi call tells OpenGL not to blend the texture with the wall, so we don t have to worry about the texel alpha values changing. In pass 2 the stencil test is set up to reject fragments if the stencil buffer is 1 (and so there will be no wall where there was ink). The glalphafunc command turns off the alpha test (which is normal) and gltexenvi specifies a typical texture blending function. Also a different texture is used, perhaps one that looks like concrete. // Pass 1: // Write a 1 in stencil buffer at "ink" locations, // ink is present if texel alpha value is 1. // glalphafunc(gl_equal,1.0); // Reject if alpha!= 1. glstencilfunc(gl_never,1,-1); // Stencil func fails, so pixel not written.. glstencilop(gl_replace,gl_keep,gl_keep); //..but replace stencil val w. 1. glbindtexture(gl_texture_2d,texid_text); // Use texture with text. gltexenvi(gl_texture_env, GL_TEXTURE_ENV_MODE,GL_REPLACE); // No lighting. glenable(gl_texture_2d); wall->render(); // Pass 2: // Render wall wherever stencil value is not 1. // Use real wall texture, not the text. glalphafunc(gl_always,1.0); // Alpha test always passes. (Normal setting.) glstencilfunc(gl_notequal,1,-1); // Pass if stencil is not 1. glstencilop(gl_keep,gl_keep,gl_keep); // Don t change stencil buffer. gltexenvi(gl_texture_env, GL_TEXTURE_ENV_MODE,GL_MODELVIEW); // Use lighting. glbindtexture(gl_texture_2d, some_other_texture_id); // Wall s real texture. wall->render(); 8

9 Problem 6: Determine the best lighting type (emissive, ambient, diffuse, specular) to use for each of the following situations, and explain your reason. (a) A triangle out in space illuminated only by a nearby star. Diffuse lighting, with only the quadratic attenuation set to a non-zero value. (b) A computer monitor screen (turned on, working properly). Emissive. (c) A glossy sphere. Specular. (d) A triangle in a room with white walls and many light sources. Ambient. 9

10 Problem 7: Answer each question below. (a) OpenGL defines several ways to combine texels with the lighted color to obtain the final color to write. Why does one need to combine a texel with a lighted color, why not just write the texel? Combining with the lighted color provides realistic lighting, for example, a darker appearance with distance or angle from light. (b) What is the advantage of using TRIANGLE_STRIPS over TRIANGLES? With triangle strips a vertex is shared by up to three triangles, so one avoids having to waste time duplicating calculations. 10

GPU Programming EE Midterm Examination

GPU Programming EE Midterm Examination Name Solution GPU Programming EE 4702-1 Midterm Examination Wednesday, 18 October 2017 11:30 12:20 CDT Alias Think of something, quick! Problem 1 Problem 2 Problem 3 Problem 4 Exam Total (30 pts) (20 pts)

More information

GPU Programming EE Midterm Examination

GPU Programming EE Midterm Examination Name Solution GPU Programming EE 4702- Midterm Examination Wednesday, 2 November 204 9:30 0:20 CST Alias Phylæ has landed! Problem Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Exam Total (8 pts) (2

More information

GPU Programming EE Final Examination

GPU Programming EE Final Examination Name GPU Programming EE 4702-1 Final Examination Tuesday, 5 December 2017 12:30 14:30 CST Alias Problem 1 Problem 2 Problem 3 Problem 4 Exam Total (15 pts) (20 pts) (30 pts) (35 pts) (100 pts) Good Luck!

More information

CS 130 Final. Fall 2015

CS 130 Final. Fall 2015 CS 130 Final 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

More information

GPU Programming EE Midterm Examination

GPU Programming EE Midterm Examination Name GPU Programming EE 4702- Midterm Examination Wednesday, 2 November 204 9:30 0:20 CST Alias Problem Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Exam Total (8 pts) (2 pts) (24 pts) (2 pts) (4

More information

Topics and things to know about them:

Topics and things to know about them: Practice Final CMSC 427 Distributed Tuesday, December 11, 2007 Review Session, Monday, December 17, 5:00pm, 4424 AV Williams Final: 10:30 AM Wednesday, December 19, 2007 General Guidelines: The final will

More information

Models and Architectures

Models and Architectures Models and Architectures Objectives Learn the basic design of a graphics system Introduce graphics pipeline architecture Examine software components for an interactive graphics system 1 Image Formation

More information

EE 4702 GPU Programming

EE 4702 GPU Programming fr 1 Final Exam Review When / Where EE 4702 GPU Programming fr 1 Tuesday, 4 December 2018, 12:30-14:30 (12:30 PM - 2:30 PM) CST Room 226 Tureaud Hall (Here) Conditions Closed Book, Closed Notes Bring one

More information

Deferred Rendering Due: Wednesday November 15 at 10pm

Deferred Rendering Due: Wednesday November 15 at 10pm CMSC 23700 Autumn 2017 Introduction to Computer Graphics Project 4 November 2, 2017 Deferred Rendering Due: Wednesday November 15 at 10pm 1 Summary This assignment uses the same application architecture

More information

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1 Ray tracing Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 3/19/07 1 From last time Hidden surface removal Painter s algorithm Clipping algorithms Area subdivision BSP trees Z-Buffer

More information

LSU EE Homework 3 Solution Due: 12 October 2015

LSU EE Homework 3 Solution Due: 12 October 2015 LSU EE 4702 1 Homework 3 Solution Due: 12 October 2015 Problem 0: Follow the instruction on the http://www.ece.lsu.edu/koppel/gpup/proc.html page for account setup and programming homework work flow. Compile

More information

CS 130 Exam I. Fall 2015

CS 130 Exam I. Fall 2015 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

More information

GPU Programming EE Final Examination

GPU Programming EE Final Examination Name Solution GPU Programming EE 4702-1 Final Examination Friday, 11 December 2015 15:00 17:00 CST Alias Methane? Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Exam Total (20 pts) (15 pts)

More information

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

Lecture 8 Ray tracing Part 1: Basic concept Yong-Jin Liu. Fundamentals of Computer Graphics Lecture 8 Ray tracing Part 1: Basic concept Yong-Jin Liu liuyongjin@tsinghua.edu.cn Material by S.M.Lea (UNC) Goals To set up the mathematics and algorithms to perform

More information

Computer Graphics 10 - Shadows

Computer Graphics 10 - Shadows Computer Graphics 10 - Shadows Tom Thorne Slides courtesy of Taku Komura www.inf.ed.ac.uk/teaching/courses/cg Overview Shadows Overview Projective shadows Shadow textures Shadow volume Shadow map Soft

More information

Computer Graphics. Shadows

Computer Graphics. Shadows Computer Graphics Lecture 10 Shadows Taku Komura Today Shadows Overview Projective shadows Shadow texture Shadow volume Shadow map Soft shadows Why Shadows? Shadows tell us about the relative locations

More information

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

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th 1. a. Show that the following sequences commute: i. A rotation and a uniform scaling ii. Two rotations about the same axis iii. Two

More information

Photorealism: Ray Tracing

Photorealism: Ray Tracing Photorealism: Ray Tracing Reading Assignment: Chapter 13 Local vs. Global Illumination Local Illumination depends on local object and light sources only Global Illumination at a point can depend on any

More information

Homework #2. Shading, Ray Tracing, and Texture Mapping

Homework #2. Shading, Ray Tracing, and Texture Mapping Computer Graphics Prof. Brian Curless CSE 457 Spring 2000 Homework #2 Shading, Ray Tracing, and Texture Mapping Prepared by: Doug Johnson, Maya Widyasari, and Brian Curless Assigned: Monday, May 8, 2000

More information

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

For each question, indicate whether the statement is true or false by circling T or F, respectively. 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)

More information

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico Models and Architectures

More information

Adaptive Point Cloud Rendering

Adaptive Point Cloud Rendering 1 Adaptive Point Cloud Rendering Project Plan Final Group: May13-11 Christopher Jeffers Eric Jensen Joel Rausch Client: Siemens PLM Software Client Contact: Michael Carter Adviser: Simanta Mitra 4/29/13

More information

GPU Programming EE Final Examination

GPU Programming EE Final Examination Name GPU Programming EE 4702-1 Final Examination Monday, 5 December 2016 17:30 19:30 CST Alias Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Exam Total (20 pts) (20 pts) (15 pts) (20 pts) (25 pts)

More information

CT5510: Computer Graphics. Texture Mapping

CT5510: Computer Graphics. Texture Mapping CT5510: Computer Graphics Texture Mapping BOCHANG MOON Texture Mapping Simulate spatially varying surface properties Phong illumination model is coupled with a material (e.g., color) Add small polygons

More information

CS559 Computer Graphics Fall 2015

CS559 Computer Graphics Fall 2015 CS559 Computer Graphics Fall 2015 Midterm Exam Thursday October 27th 2015 Time: 2 hrs Name University ID Part #1 Part #2 Part #3 Part #4 Part #5 Part #6 TOTAL 1 1. [5 4% = 20%] MULTIPLE CHOICE SECTION.

More information

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

Midterm Exam Fundamentals of Computer Graphics (COMP 557) Thurs. Feb. 19, 2015 Professor Michael Langer Midterm Exam Fundamentals of Computer Graphics (COMP 557) Thurs. Feb. 19, 2015 Professor Michael Langer The exam consists of 10 questions. There are 2 points per question for a total of 20 points. You

More information

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

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting Ray Casting COMP 175: Computer Graphics April 26, 2018 1/41 Admin } Assignment 4 posted } Picking new partners today for rest of the assignments } Demo in the works } Mac demo may require a new dylib I

More information

CS4202: Test. 1. Write the letter corresponding to the library name next to the statement or statements that describe library.

CS4202: Test. 1. Write the letter corresponding to the library name next to the statement or statements that describe library. CS4202: Test Name: 1. Write the letter corresponding to the library name next to the statement or statements that describe library. (4 points) A. GLUT contains routines that use lower level OpenGL commands

More information

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]

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] 6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, 2011 9:05-12pm Two hand-written sheet of notes (4 pages) allowed NAME: 1 / 17 2 / 12 3 / 35 4 / 8 5 / 18 Total / 90 1 SSD [ /17]

More information

Effects needed for Realism. Ray Tracing. Ray Tracing: History. Outline. Foundations of Computer Graphics (Spring 2012)

Effects needed for Realism. Ray Tracing. Ray Tracing: History. Outline. Foundations of Computer Graphics (Spring 2012) Foundations of omputer Graphics (Spring 202) S 84, Lecture 5: Ray Tracing http://inst.eecs.berkeley.edu/~cs84 Effects needed for Realism (Soft) Shadows Reflections (Mirrors and Glossy) Transparency (Water,

More information

Ray Casting. Outline. Similar to glulookat derivation. Foundations of Computer Graphics

Ray Casting. Outline. Similar to glulookat derivation. Foundations of Computer Graphics Foundations of omputer Graphics Online Lecture 10: Ray Tracing 2 Nuts and olts amera Ray asting Outline amera Ray asting (choose ray directions) Ravi Ramamoorthi Outline in ode Image Raytrace (amera cam,

More information

CS451Real-time Rendering Pipeline

CS451Real-time Rendering Pipeline 1 CS451Real-time Rendering Pipeline JYH-MING LIEN DEPARTMENT OF COMPUTER SCIENCE GEORGE MASON UNIVERSITY Based on Tomas Akenine-Möller s lecture note You say that you render a 3D 2 scene, but what does

More information

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects Basic Ray Tracing Rendering: Reality Eye acts as pinhole camera Photons from light hit objects Rendering: Reality Eye acts as pinhole camera Photons from light hit objects Rendering: Reality Eye acts as

More information

ALGEBRA 2 W/ TRIGONOMETRY MIDTERM REVIEW

ALGEBRA 2 W/ TRIGONOMETRY MIDTERM REVIEW Name: Block: ALGEBRA W/ TRIGONOMETRY MIDTERM REVIEW Algebra 1 Review Find Slope and Rate of Change Graph Equations of Lines Write Equations of Lines Absolute Value Functions Transformations Piecewise Functions

More information

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007 Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007 Programming For this assignment you will write a simple ray tracer. It will be written in C++ without

More information

Name. EE 4702 Final Exam. Friday, 7 December 2012, 12:30-14:30 CST. Exam Total. Alias. (100 pts) Good Luck!

Name. EE 4702 Final Exam. Friday, 7 December 2012, 12:30-14:30 CST. Exam Total. Alias. (100 pts) Good Luck! Name EE 4702 Final Exam Friday, 7 December 2012, 12:30-14:30 CST Alias Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Exam Total (20 pts) (20 pts) (100 pts) Good Luck! Problem 1: [15 pts]the

More information

Motivation. Sampling and Reconstruction of Visual Appearance. Effects needed for Realism. Ray Tracing. Outline

Motivation. Sampling and Reconstruction of Visual Appearance. Effects needed for Realism. Ray Tracing. Outline Sampling and Reconstruction of Visual Appearance CSE 274 [Fall 2018], Special Lecture Ray Tracing Ravi Ramamoorthi http://www.cs.ucsd.edu/~ravir Motivation Ray Tracing is a core aspect of both offline

More information

CS559 Computer Graphics Fall 2015

CS559 Computer Graphics Fall 2015 CS559 Computer Graphics Fall 2015 Midterm Exam Thursday October 27th 2015 Time: 2 hrs Name University ID Part #1 Part #2 Part #3 Part #4 Part #5 Part #6 TOTAL 1 1. [5 4% = 20%] MULTIPLE CHOICE SECTION.

More information

CS 130 Exam I. Fall 2015

CS 130 Exam I. Fall 2015 S 3 Exam I Fall 25 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

More information

CS Simple Raytracer for students new to Rendering

CS Simple Raytracer for students new to Rendering CS 294-13 Simple Raytracer for students new to Rendering Ravi Ramamoorthi This assignment should be done only by those small number of students who have not yet written a raytracer. For those students

More information

CS384G Midterm Examination Spring 2008

CS384G Midterm Examination Spring 2008 CS384G Midterm Examination Spring 2008 Each problem section is worth the indicated number of points. Show all work on these pages and don t forget to put your name on one of them! 1. (15 pts) In the two

More information

CEng 477 Introduction to Computer Graphics Fall 2007

CEng 477 Introduction to Computer Graphics Fall 2007 Visible Surface Detection CEng 477 Introduction to Computer Graphics Fall 2007 Visible Surface Detection Visible surface detection or hidden surface removal. Realistic scenes: closer objects occludes the

More information

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

THE AUSTRALIAN NATIONAL UNIVERSITY Final Examinations (Semester 2) COMP4610/COMP6461 (Computer Graphics) Final Exam THE AUSTRALIAN NATIONAL UNIVERSITY Final Examinations (Semester 2) 2015 COMP4610/COMP6461 (Computer Graphics) Final Exam Writing Period: 3 hours duration Study Period: 15 minutes duration. During this

More information

CS 4620 Program 3: Pipeline

CS 4620 Program 3: Pipeline CS 4620 Program 3: Pipeline out: Wednesday 14 October 2009 due: Friday 30 October 2009 1 Introduction In this assignment, you will implement several types of shading in a simple software graphics pipeline.

More information

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker CMSC427 Advanced shading getting global illumination by local methods Credit: slides Prof. Zwicker Topics Shadows Environment maps Reflection mapping Irradiance environment maps Ambient occlusion Reflection

More information

Ray Tracer Due date: April 27, 2011

Ray Tracer Due date: April 27, 2011 Computer graphics Assignment 4 1 Overview Ray Tracer Due date: April 27, 2011 In this assignment you will implement the camera and several primitive objects for a ray tracer, and a basic ray tracing algorithm.

More information

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

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic. Shading Models There are two main types of rendering that we cover, polygon rendering ray tracing Polygon rendering is used to apply illumination models to polygons, whereas ray tracing applies to arbitrary

More information

DH2323 DGI13. Lab 2 Raytracing

DH2323 DGI13. Lab 2 Raytracing DH2323 DGI13 Lab 2 Raytracing In this lab you will implement a Raytracer, which draws images of 3D scenes by tracing the light rays reaching the simulated camera. The lab is divided into several steps.

More information

The feature set you are required to implement in your ray tracer is as follows (by order from easy to hard):

The feature set you are required to implement in your ray tracer is as follows (by order from easy to hard): Ray Tracing exercise TAU, Computer Graphics, 0368.3014, semester B Go to the Updates and FAQ Page Overview The objective of this exercise is to implement a ray casting/tracing engine. Ray tracing is a

More information

Introduction to Visualization and Computer Graphics

Introduction to Visualization and Computer Graphics Introduction to Visualization and Computer Graphics DH2320, Fall 2015 Prof. Dr. Tino Weinkauf Introduction to Visualization and Computer Graphics Visibility Shading 3D Rendering Geometric Model Color Perspective

More information

CS 4620 Midterm, March 21, 2017

CS 4620 Midterm, March 21, 2017 CS 460 Midterm, March 1, 017 This 90-minute exam has 4 questions worth a total of 100 points. Use the back of the pages if you need more space. Academic Integrity is expected of all students of Cornell

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Last Time? The Traditional Graphics Pipeline Participating Media Measuring BRDFs 3D Digitizing & Scattering BSSRDFs Monte Carlo Simulation Dipole Approximation Today Ray Casting / Tracing Advantages? Ray

More information

Texture Mapping and Sampling

Texture Mapping and Sampling Texture Mapping and Sampling CPSC 314 Wolfgang Heidrich The Rendering Pipeline Geometry Processing Geometry Database Model/View Transform. Lighting Perspective Transform. Clipping Scan Conversion Depth

More information

TSBK03 Screen-Space Ambient Occlusion

TSBK03 Screen-Space Ambient Occlusion TSBK03 Screen-Space Ambient Occlusion Joakim Gebart, Jimmy Liikala December 15, 2013 Contents 1 Abstract 1 2 History 2 2.1 Crysis method..................................... 2 3 Chosen method 2 3.1 Algorithm

More information

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Learn the basic design of a graphics system Introduce

More information

Rasterization Overview

Rasterization Overview Rendering Overview The process of generating an image given a virtual camera objects light sources Various techniques rasterization (topic of this course) raytracing (topic of the course Advanced Computer

More information

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM NAME: Login name: Computer Science 46 Midterm 3//4, :3PM-:5PM This test is 5 questions, of equal weight. Do all of your work on these pages (use the back for scratch space), giving the answer in the space

More information

CS559 Computer Graphics Fall 2015

CS559 Computer Graphics Fall 2015 CS559 Computer Graphics Fall 2015 Practice Midterm Exam Time: 2 hrs 1. [XX Y Y % = ZZ%] MULTIPLE CHOICE SECTION. Circle or underline the correct answer (or answers). You do not need to provide a justification

More information

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Shadow Algorithms. CSE 781 Winter Han-Wei Shen Shadow Algorithms CSE 781 Winter 2010 Han-Wei Shen Why Shadows? Makes 3D Graphics more believable Provides additional cues for the shapes and relative positions of objects in 3D What is shadow? Shadow:

More information

TDA361/DIT220 Computer Graphics, January 15 th 2016

TDA361/DIT220 Computer Graphics, January 15 th 2016 TDA361/DIT220 Computer Graphics, January 15 th 2016 EXAM (Same exam for both CTH- and GU students) Friday January 15 th, 2016, 8.30 12.30 Examiner Ulf Assarsson, tel. 0701-738535 Permitted Technical Aids

More information

Shading, Advanced Rendering. Week 7, Wed Feb 28

Shading, Advanced Rendering. Week 7, Wed Feb 28 University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Shading, Advanced Rendering Week 7, Wed Feb 28 http://www.ugrad.cs.ubc.ca/~cs314/vjan2007 Reading for Today and Tomorrow

More information

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches: Surface Graphics Objects are explicitely defined by a surface or boundary representation (explicit inside vs outside) This boundary representation can be given by: - a mesh of polygons: 200 polys 1,000

More information

Recall: Indexing into Cube Map

Recall: Indexing into Cube Map Recall: Indexing into Cube Map Compute R = 2(N V)N-V Object at origin Use largest magnitude component of R to determine face of cube Other 2 components give texture coordinates V R Cube Map Layout Example

More information

The University of Calgary

The University of Calgary The University of Calgary Department of Computer Science Final Examination, Questions ENEL/CPSC 555 Computer Graphics Time: 2 Hours Closed Book, calculators are permitted. The questions carry equal weight.

More information

Queen s University CISC 454 Final Exam. April 19, :00pm Duration: 3 hours. One two sided aid sheet allowed. Initial of Family Name:

Queen s University CISC 454 Final Exam. April 19, :00pm Duration: 3 hours. One two sided aid sheet allowed. Initial of Family Name: Page 1 of 11 Queen s University CISC 454 Final Exam April 19, 2005 2:00pm Duration: 3 hours One two sided aid sheet allowed. Initial of Family Name: Student Number: (Write this at the top of every page.)

More information

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing CS 543 - Computer Graphics: Introduction to Ray Tracing by Robert W. Lindeman gogo@wpi.edu (with help from Peter Lohrmann ;-) View Volume View volume similar to gluperspective Angle Aspect Near? Far? But

More information

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing CS 543 - Computer Graphics: Introduction to Ray Tracing by Robert W. Lindeman gogo@wpi.edu (with help from Peter Lohrmann ;-) View Volume View volume similar to gluperspective Angle Aspect Near? Far? But

More information

CMSC427 Final Practice v2 Fall 2017

CMSC427 Final Practice v2 Fall 2017 CMSC427 Final Practice v2 Fall 2017 This is to represent the flow of the final and give you an idea of relative weighting. No promises that knowing this will predict how you ll do on the final. Some questions

More information

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

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008. CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions The Midterm Exam was given in class on Thursday, October 23, 2008. 1. [4 pts] Drawing Where? Your instructor says that objects should always be

More information

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

Midterm Exam CS 184: Foundations of Computer Graphics page 1 of 11 Midterm Exam CS 184: Foundations of Computer Graphics page 1 of 11 Student Name: Class Account Username: Instructions: Read them carefully! The exam begins at 2:40pm and ends at 4:00pm. You must turn your

More information

Computer Graphics and Image Processing Ray Tracing I

Computer Graphics and Image Processing Ray Tracing I Computer Graphics and Image Processing Ray Tracing I Part 1 Lecture 9 1 Today s Outline Introduction to Ray Tracing Ray Casting Intersecting Rays with Primitives Intersecting Rays with Transformed Primitives

More information

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

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students) TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students) Saturday, January 13 th, 2018, 08:30-12:30 Examiner Ulf Assarsson, tel. 031-772 1775 Permitted Technical Aids None, except

More information

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

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows Recollection Models Pixels Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows Can be computed in different stages 1 So far we came to Geometry model 3 Surface

More information

Introduction to Ray-tracing Objectives

Introduction to Ray-tracing Objectives Introduction to Ray-tracing Objectives Define ray-tracing as a means of rendering Ray-tracing for spheres Combining with shading model An algorithm framework 2 1 Light vs. Rendering 3 (Local) Ray-tracing

More information

Viewing and Ray Tracing. CS 4620 Lecture 4

Viewing and Ray Tracing. CS 4620 Lecture 4 Viewing and Ray Tracing CS 4620 Lecture 4 2014 Steve Marschner 1 Projection To render an image of a 3D scene, we project it onto a plane Most common projection type is perspective projection 2014 Steve

More information

Computer Graphics. Lecture 9 Environment mapping, Mirroring

Computer Graphics. Lecture 9 Environment mapping, Mirroring Computer Graphics Lecture 9 Environment mapping, Mirroring Today Environment Mapping Introduction Cubic mapping Sphere mapping refractive mapping Mirroring Introduction reflection first stencil buffer

More information

Viewing and Ray Tracing

Viewing and Ray Tracing Viewing and Ray Tracing CS 4620 Lecture 4 2018 Steve Marschner 1 Projection To render an image of a 3D scene, we project it onto a plane Most common projection type is perspective projection 2018 Steve

More information

9. Illumination and Shading

9. Illumination and Shading 9. Illumination and Shading Approaches for visual realism: - Remove hidden surfaces - Shade visible surfaces and reproduce shadows - Reproduce surface properties Texture Degree of transparency Roughness,

More information

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.

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. CS 184: Foundations of Computer Graphics page 1 of 10 Student Name: Class Account Username: Instructions: Read them carefully! The exam begins at 2:40pm and ends at 4:00pm. You must turn your exam in when

More information

GPU Programming EE Final Examination

GPU Programming EE Final Examination Name GPU Programming EE 4702-1 Final Examination Friday, 11 December 2015 15:00 17:00 CST Alias Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Exam Total (20 pts) (15 pts) (15 pts) (20 pts)

More information

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation Lecture 17: Shading in OpenGL CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL shading methods - per vertex shading

More information

A simple OpenGL animation Due: Wednesday, January 27 at 4pm

A simple OpenGL animation Due: Wednesday, January 27 at 4pm CMSC 23700 Winter 2010 Introduction to Computer Graphics Project 1 January 12 A simple OpenGL animation Due: Wednesday, January 27 at 4pm 1 Summary This project is the first part of a three-part project.

More information

Ray Tracing Part 1. CSC418/2504 Introduction to Computer Graphics. TA: Muhammed Anwar & Kevin Gibson

Ray Tracing Part 1. CSC418/2504 Introduction to Computer Graphics. TA: Muhammed Anwar & Kevin Gibson Ray Tracing Part 1 CSC418/2504 Introduction to Computer Graphics TA: Muhammed Anwar & Kevin Gibson Email: manwar@cs.toronto.edu Overview Introduction / Motivation Rasterization vs Ray Tracing Basic Pseudocode

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Last Time? The Traditional Graphics Pipeline Reading for Today A Practical Model for Subsurface Light Transport, Jensen, Marschner, Levoy, & Hanrahan, SIGGRAPH 2001 Participating Media Measuring BRDFs

More information

Ray Tracing. Outline. Ray Tracing: History

Ray Tracing. Outline. Ray Tracing: History Foundations of omputer Graphics Online Lecture 9: Ray Tracing 1 History and asic Ray asting Ravi Ramamoorthi Effects needed for Realism (Soft) Shadows Reflections (Mirrors and Glossy) Transparency (Water,

More information

Discrete Techniques. 11 th Week, Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of

Discrete Techniques. 11 th Week, Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of Discrete Techniques 11 th Week, 2010 Buffer Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of bits/pixel Pixel OpenGL Frame Buffer OpenGL Buffers Color buffers

More information

Ambien Occlusion. Lighting: Ambient Light Sources. Lighting: Ambient Light Sources. Summary

Ambien Occlusion. Lighting: Ambient Light Sources. Lighting: Ambient Light Sources. Summary Summary Ambien Occlusion Kadi Bouatouch IRISA Email: kadi@irisa.fr 1. Lighting 2. Definition 3. Computing the ambient occlusion 4. Ambient occlusion fields 5. Dynamic ambient occlusion 1 2 Lighting: Ambient

More information

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19 Lecture 17: Recursive Ray Tracing Where is the way where light dwelleth? Job 38:19 1. Raster Graphics Typical graphics terminals today are raster displays. A raster display renders a picture scan line

More information

COMP 175 COMPUTER GRAPHICS. Lecture 11: Recursive Ray Tracer. COMP 175: Computer Graphics April 9, Erik Anderson 11 Recursive Ray Tracer

COMP 175 COMPUTER GRAPHICS. Lecture 11: Recursive Ray Tracer. COMP 175: Computer Graphics April 9, Erik Anderson 11 Recursive Ray Tracer Lecture 11: Recursive Ray Tracer COMP 175: Computer Graphics April 9, 2018 1/40 Note on using Libraries } C++ STL } Does not always have the same performance. } Interface is (mostly) the same, but implementations

More information

Photorealism. Photorealism: Ray Tracing. Ray Tracing

Photorealism. Photorealism: Ray Tracing. Ray Tracing CS 460 Computer Graphics Professor Richard Eckert Ray Tracing Texture Mapping Radiosity Photorealism April 30, 2004 Photorealism -- Taking into Account Global Illumination Light can arrive at surfaces

More information

Lecture 11: Ray tracing (cont.)

Lecture 11: Ray tracing (cont.) Interactive Computer Graphics Ray tracing - Summary Lecture 11: Ray tracing (cont.) Graphics Lecture 10: Slide 1 Some slides adopted from H. Pfister, Harvard Graphics Lecture 10: Slide 2 Ray tracing -

More information

Scanline Rendering 2 1/42

Scanline Rendering 2 1/42 Scanline Rendering 2 1/42 Review 1. Set up a Camera the viewing frustum has near and far clipping planes 2. Create some Geometry made out of triangles 3. Place the geometry in the scene using Transforms

More information

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

SUMMARY. CS380: Introduction to Computer Graphics Ray tracing Chapter 20. Min H. Kim KAIST School of Computing 18/05/29. Modeling CS380: Introduction to Computer Graphics Ray tracing Chapter 20 Min H. Kim KAIST School of Computing Modeling SUMMARY 2 1 Types of coordinate function Explicit function: Line example: Implicit function:

More information

Ray-Tracing. Misha Kazhdan

Ray-Tracing. Misha Kazhdan Ray-Tracing Misha Kazhdan Ray-Tracing In graphics, we often represent the surface of a 3D shape by a set of triangles. Goal: Ray-Tracing Take a collection of triangles representing a 3D scene and render

More information

Shadow Techniques. Sim Dietrich NVIDIA Corporation

Shadow Techniques. Sim Dietrich NVIDIA Corporation Shadow Techniques Sim Dietrich NVIDIA Corporation sim.dietrich@nvidia.com Lighting & Shadows The shadowing solution you choose can greatly influence the engine decisions you make This talk will outline

More information

Definition. Blending & Compositing. Front & Back Buffers. Left & Right Buffers. Blending combines geometric objects. e.g.

Definition. Blending & Compositing. Front & Back Buffers. Left & Right Buffers. Blending combines geometric objects. e.g. Blending & Compositing COMP 3003 Autumn 2005 Definition Blending combines geometric objects e.g. transparency Compositing combines entire images multi-pass textures accumulating results Both depend on

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Final Projects Proposals due Thursday 4/8 Proposed project summary At least 3 related papers (read & summarized) Description of series of test cases Timeline & initial task assignment The Traditional Graphics

More information

E.Order of Operations

E.Order of Operations Appendix E E.Order of Operations This book describes all the performed between initial specification of vertices and final writing of fragments into the framebuffer. The chapters of this book are arranged

More information

Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker

Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker Rendering Algorithms: Real-time indirect illumination Spring 2010 Matthias Zwicker Today Real-time indirect illumination Ray tracing vs. Rasterization Screen space techniques Visibility & shadows Instant

More information

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

CSE Intro to Computer Graphics. ANSWER KEY: Midterm Examination. November 18, Instructor: Sam Buss, UC San Diego CSE 167 - Intro to Computer Graphics ANSWER KEY: Midterm Examination November 18, 2003 Instructor: Sam Buss, UC San Diego Write your name or initials on every page before beginning the exam. You have 75

More information