CS559 Computer Graphics Fall 2015

Similar documents
CS559 Computer Graphics Fall 2015

CS559 Computer Graphics Fall 2015

CS 130 Final. Fall 2015

CS 4620 Midterm 1. Tuesday 22 October minutes

CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014

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

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

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

Institutionen för systemteknik

CS 130 Exam I. Fall 2015

CS 559 Computer Graphics Midterm Exam March 22, :30-3:45 pm

Homework #1. Displays, Alpha Compositing, Image Processing, Affine Transformations, Hierarchical Modeling

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

CS 130 Exam I. Fall 2015

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Topics and things to know about them:

CS 4620 Midterm, March 21, 2017

12.4 Rotations. Learning Objectives. Review Queue. Defining Rotations Rotations

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

Rasterization. COMP 575/770 Spring 2013

Deferred Rendering Due: Wednesday November 15 at 10pm

CS 4620 Program 3: Pipeline

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

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

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

CMSC427 Final Practice v2 Fall 2017

CS 4620 Midterm, October 23, 2018 SOLUTION

Computer Viewing. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

CSC 471 midterm 2 Winter Name:

Ray Tracer Due date: April 27, 2011

Drawing Fast The Graphics Pipeline

Computer Graphics Coursework 1

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

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

CS559 Computer Graphics Fall 2015

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

Hidden surface removal. Computer Graphics

GPU Programming EE Practice Midterm Examination

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

CS452/552; EE465/505. Intro to Lighting

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

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

CS 464 Review. Review of Computer Graphics for Final Exam

Pipeline Operations. CS 4620 Lecture 14

Assignment 6: Ray Tracing

CS 184, Fall 1996 Midterm #1 Professor: unknown

Illumination & Shading I

The University of Calgary

Computer Viewing. Prof. George Wolberg Dept. of Computer Science City College of New York

Graphics for VEs. Ruth Aylett

Answers. (1) Parallelogram. Remember: A four-sided flat shape where the opposite sides are parallel is called a parallelogram. Here, AB DC and BC AD.

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

CS4620/5620: Lecture 14 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]

Geometry. Oklahoma Math Day INSTRUCTIONS:

Homework 3: Programmable Shaders

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

Texture. Texture Mapping. Texture Mapping. CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

Answers to practice questions for Midterm 1

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

2D transformations: An introduction to the maths behind computer graphics


CS Simple Raytracer for students new to Rendering

I can identify reflections, rotations, and translations. I can graph transformations in the coordinate plane.

Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001

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.

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

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

8.1 Geometric Queries for Ray Tracing

The Humble Tetrahedron

Answer Key: Three-Dimensional Cross Sections

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

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

Drawing in 3D (viewing, projection, and the rest of the pipeline)

PLC Papers. Created For:

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

SFU CMPT 361 Computer Graphics Fall 2017 Assignment 2. Assignment due Thursday, October 19, 11:59pm

[175 points] The purpose of this assignment is to give you practice with shaders in OpenGL.

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

Properties of a Circle Diagram Source:

MAKE GEOMETRIC CONSTRUCTIONS

Geometry - Chapter 1 - Corrective #1

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

Einführung in Visual Computing

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

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

Section 12.1 Translations and Rotations

Computergrafik. Matthias Zwicker. Herbst 2010

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

CS 354R: Computer Game Technology

Learning Log Title: CHAPTER 6: TRANSFORMATIONS AND SIMILARITY. Date: Lesson: Chapter 6: Transformations and Similarity

Triangle Rasterization

Module 2 Test Study Guide. Type of Transformation (translation, reflection, rotation, or none-of-theabove). Be as specific as possible.

CS 184, Fall 1996 Midterm #1 Professor: unknown

Problem 2.1. Complete the following proof of Euclid III.20, referring to the figure on page 1.

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

Complex Shading Algorithms

Transcription:

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. Circle or underline the correct answer (or answers). ou do not need to provide a justification for your answer(s). (1) The construction of the camera transform (e.g. via the TGWL lookat method) requires us to provide an up vector as one of the inputs. Which of the following statements about this vector are true? Write the letters of ALL correct answers here: (a) The up vector will be used as one of the basis vectors of the camera coordinate system. (b) The up vector will be perpendicular to at least one of the basis vectors of the camera coordinate system. (c) The construction of the camera transform requires that the up vector must be perpendicular to the gaze direction (i.e. the vector from the eye location to the lookat or target location). (2) Any point P in the plane of a triangle ABC can be written as a linear combination P = αa + βb + γc where α, β and γ are the barycentric coordinates of P (to be clear, the variables P, A, B, C are the position vectors of the respective points in this expression). Let us now consider the special case when the point P actually lies on the triangle edge AB. Which of the following statements would be true in that case? Write the letters of ALL correct answers here: (a) It must be the case that α + β = 1. (b) It must be the case that 0 α 1 and 0 β 1 (c) It must be the case that α = β = 0. b ab (3) If our shaders require per-fragment normals, it is quite typical for the vertex shader to assign the per-vertex normals (which would have been vertex attributes) to a varying variable so that the fragment shader can access this information (interpolated from vertices to fragment locations). It is also quite frequent that the fragment shader would start by normalizing the value it receives in this varying variable, prior to using it. Is this really necessary, and if so, why? Write the letter the ONE most correct answer here: (a) The fragment shader needs to normalize the vector it receives, to ensure that it is actually perpendicular to the triangle. (b) We normalize to ensure that the length of the normal vector is equal to one, while keeping its direction unchanged. (c) We only need to normalize (to unit length) if the original pervertex normals were not guaranteed to be unit-length. b 2

(4) Which of the following statements about the painter s algorithm are correct? Write the letters of ALL correct answers here: bc (a) It prevents unnecessary drawing of triangles that will be fully hidden behind other triangles. (b) It needs to repeat the sorting of triangles if the camera position moves. (c) It can fail to produce the right result when some of the triangles to be drawn intersect one another. (5) How can the host program communicate data to the fragment shader? Write the letter the ONE most correct answer here: (a) The host program can specify the values of varying variables (b) It is not possible. The fragment shader can only access data given to it by the vertex shader. (c) The fragment shader can access uniform variables, which are set by the host program, and also receive information indirectly via the vertex shader. c 3

2. [24%] SHORT ANSWER SECTION. Answer each of the following questions in no more than 1-3 sentences. (a) [6%] In many cases it is sufficient to pass a single, combined MVP (Model-View-Projection) matrix to the vertex shader, since the shader can directly apply this transform to vertex positions in local coordinates, to calculate the respective Normalized Device Coordinates (which is what gl_position must be set to). Can you describe a set of circumstances where we would instead need to pass down to the shaders more transforms than just the MVP matrix? (for example, a case where we would need to pass separately the ModelView MV matrix in addition to the combined MVP transform?) The most common case is when the normal vector (passed as a vertex attribute) needs to be transformed within the shaders. The matrix that transforms the normals could be computed from the Model-View matrix (although it would have been much more efficient to just pass it in as a separate matrix), but not from the aggregate MVP matrix that includes the projection as well. Also, in certain instances we may want to pass the ModelView (MV) matrix separately to the shaders for transforming point locations to camera coordinates, e.g. for computing specular lighting. (b) [6%] Can the following be done in the Vertex shader, in the Fragment shader, in Either the vertex or fragment shader, or in Neither of them? (Write V, F, E, or N next to each question below. ou don t need to provide an explanation, unless you really feel that your answer comes with significant caveats.) N Divide a triangle into smaller triangles E Compute specular lighting N Compute the texture coordinates for the center of a triangle (i.e. at the point with barycentric coordinates ( 1 3, 1 3, 1 3 )). For the last question: Note that each instance of the vertex program will be given the information pertaining to a specific vertex; it will not have the information to combine several vertices (the three vertices of the triangle) to average their texture coordinates. The fragment shader does get access to interpolated data in the interior of a triangle, but we do not explicitly control which interior point (e.g. the center) will be processed by it. 4

(c) [12%] Here is a list of some tasks that can be done in the vertex shader. Some of them could be done in the fragment shader. For each of the following, say if it would be possible to do this task in the fragment shader. If it is possible, explain how you would decide between which shader to do this in; if it is not possible to use the fragment shader, explain why not. i. Do texture color lookups. It is possible, and generally preferable to do texture lookups in the fragment shader, since doing that in the vertex shader would only interpolate the textured color from the vertices of each triangle (thus preventing the opportunity for texture to vary nontrivially within each triangle. That being said, if the size of the triangles is so small (and we have a lot of them) so that we will only render a few pixels per triangle, doing the texture lookup per-vertex might be acceptable. ii. Compute diffuse shading. Can be done in either shader, the result will be higher quality if done in the fragment shader. However, if the 3 per-vertex normals of every triangle are exactly equal, the result would be the same regardless of whether the diffuse color was computed in vertex or fragment shader (diffuse color depends on normal and light direction). iii. Change the shape of the object being drawn, for example by stretching or shearing it (independent of any transformations that have been handed down to the shaders by the host program). Only the vertex shader can actually modify the positions of vertices being drawn (by setting the value of gl_position) 5

3. [14%] Consider the texture map illustrated in the image below: 1 0.5 U O 0.5 1 V We want to apply this texture to four separate squares, such that the textured squares appear as follows: (1,1) (1,0) (1,0.5) (1,1) (0,1) (0,0) (0.5,0,5) (0.5,0) (0,0.5) (0,0.5) (0,1) (1,0.5) (1,0.5) (1,0) (0,0) (1,0) For each vertex of each of the four squares, write the texture coordinates that we need to associate with this vertex in order to produce the desired apperance. Write the coordinates in the form (u, v) directly next to each vertex. 6

4. [14%] We have implemented a function drawlink() that draws the pointed stick-shaped object shown on the left. Subsequently we used this function to draw the more complex shape shown on the right: O L=100 O drawlink() This was done via hierarchical modeling, as shown in the code below: context.save(); drawlink(); context.translate(100,0); context.save(); context.rotate(-math.pi/4); drawlink(); context.translate(100,0); context.save(); context.rotate(math.pi/4); context.scale(0.5,1); drawlink(); context.restore(); context.save(); context.rotate(-math.pi/4); context.scale(0.5,1); drawlink(); context.restore(); context.restore(); context.save(); context.rotate(math.pi/2); drawlink(); context.restore(); context.restore(); // Line "A" // Line "B" // Line "C" // Line "D" (a) Draw the shape that the code above would produce, if we removed lines marked A and D. (b) Draw the shape that the code above would produce, if we removed lines marked B and C. Hints: Since the -axis is pointing down, positive angles will be oriented clockwise, and negative ones counter-clockwise. Also, a friendly reminder that PI/4=45 degrees. 7

Commenting out lines A and D yields: Commenting out lines B and C yields: 8

5. [14%] We want to draw a model of the four-legged table shown below (the Z- side view will look the same as the - view shown here just replace the -axis with the Z-axis in the illustration to the right). L=1 O Z L=10 (or Z) L=8 L=2 L=20 Let s assume that we have been given the two routines drawcube() and drawcylinder() that draw a unit-edge cube as seen on the left, and a cylinder with radius 1 (diameter 2) and unit height as seen on the right. L=1 h=1 Z D=2 drawcylinder() Z drawcube() Write a program, in pseudo-code, to draw the table using a hierarchical modeling approach. our code can call the functions drawcube() and drawcylinder() when needed, and you can also use the Canvas-like save()/restore() functions to manipulate the transform stack. ou can use functions like scale(a,b,c), translate(a,b,c) and rotate(angle) (similarly for rotate/rotatez) to multiply the current (top-of-stack) transformation with the respective scale/translation/rotation. 9

One of many possible correct solutions: function drawtop(){ save(); translate(-10,0,-10); scale(20,1,20); drawcube(); restore(); } function drawleg(){ save(); translate(0,-10,0); scale(1,10,1); drawcylinder(); restore(); } function drawtable(){ drawtop(); save();translate(-8,0,-8);drawleg();restore(); save();translate(8,0,-8);drawleg();restore(); save();translate(-8,0,8);drawleg();restore(); save();translate(8,0,8);drawleg();restore(); } 10

6. [14%] The image below has been produced by a certain set of parameters for ambient, diffuse and specular lighting. Each one of the following images was created by either increasing or decreasing just one of the following parameters, relative to the image above. The Ambient lighting coefficient. The Diffuse reflection coefficient. The Specular reflection coefficient. The Specular Exponent. D E A S In each of the boxes provided, write A, D, S or E to indicate the parameter that changed, with an up- or down-arrow to indicate if the parameter was increased or decreased. 11