Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

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

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

CHAPTER 1 Graphics Systems and Models 3

Topics and things to know about them:

Computer Graphics I Lecture 11

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

Computer Graphics Ray Casting. Matthias Teschner

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

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

Pipeline Operations. CS 4620 Lecture 14

CS559 Computer Graphics Fall 2015

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

The University of Calgary

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

Pipeline Operations. CS 4620 Lecture 10

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed

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

Lecture 11: Ray tracing (cont.)

Computer Graphics CS 543 Lecture 13a Curves, Tesselation/Geometry Shaders & Level of Detail

Rasterization Overview

CS451Real-time Rendering Pipeline

Intro to Ray-Tracing & Ray-Surface Acceleration

Problem Max. Points Total 80

Direct Rendering of Trimmed NURBS Surfaces

Lecture IV Bézier Curves

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

Raycasting. Chapter Raycasting foundations. When you look at an object, like the ball in the picture to the left, what do

CS452/552; EE465/505. Clipping & Scan Conversion

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

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

CS 130 Exam I. Fall 2015

CS 130 Final. Fall 2015

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Mathematical Tools in Computer Graphics with C# Implementations Table of Contents

Introduction to Visualization and Computer Graphics

CS 325 Computer Graphics

Parametric curves. Brian Curless CSE 457 Spring 2016

Models and Architectures

CMSC427 Final Practice v2 Fall 2017

Graphics Hardware and Display Devices

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

CS 464 Review. Review of Computer Graphics for Final Exam

Example Examination 2IV

QUESTION BANK 10CS65 : COMPUTER GRAPHICS AND VISUALIZATION

The Traditional Graphics Pipeline

EECS 487, Fall 2005 Exam 2

Computer Graphics 1. Chapter 2 (May 19th, 2011, 2-4pm): 3D Modeling. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2011

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.

Hidden Surface Removal

Graphics and Interaction Rendering pipeline & object modelling

Complex Features on a Surface. CITS4241 Visualisation Lectures 22 & 23. Texture mapping techniques. Texture mapping techniques

Chapter 5. Projections and Rendering

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

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

Computer Graphics. Bing-Yu Chen National Taiwan University

Projections. Brian Curless CSE 457 Spring Reading. Shrinking the pinhole. The pinhole camera. Required:

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

9. Visible-Surface Detection Methods

Central issues in modelling

Viewing with Computers (OpenGL)

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

RASTERISED RENDERING

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

INFOGR Computer Graphics

CS 4620 Midterm, March 21, 2017

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

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.

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

Splines. Connecting the Dots

INFOGR Computer Graphics. Jacco Bikker - April-July Lecture 3: Ray Tracing (Introduction) Welcome!

The Traditional Graphics Pipeline

MA 323 Geometric Modelling Course Notes: Day 21 Three Dimensional Bezier Curves, Projections and Rational Bezier Curves

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics

Curve and Surface Basics

CEng 477 Introduction to Computer Graphics Fall 2007

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

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

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

CS 465 Program 4: Modeller

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

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

Design considerations

Final Exam CS 184: Foundations of Computer Graphics! page 1 of 12!

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

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

Rendering Curves and Surfaces. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

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

CS 4620 Program 3: Pipeline

Hidden surface removal. Computer Graphics

Information Coding / Computer Graphics, ISY, LiTH. Splines

In what follows, we will focus on Voronoi diagrams in Euclidean space. Later, we will generalize to other distance spaces.

Lecture 25: Bezier Subdivision. And he took unto him all these, and divided them in the midst, and laid each piece one against another: Genesis 15:10

COMPUTER GRAPHICS COURSE. Rendering Pipelines

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

Parametric curves. Reading. Curves before computers. Mathematical curve representation. CSE 457 Winter Required:

CPSC GLOBAL ILLUMINATION

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

Transcription:

Computer Graphics Instructor: Brian Curless CSE 457 Spring 2013 Homework #2 Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves Assigned: Sunday, May 12 th Due: Thursday, May 23 th at the beginning of class Directions: Please provide short written answers to the following questions, using this page as a cover sheet. Be sure to justify your answers when requested. Feel free to discuss the problems with classmates, but please answer the questions on your own. Be sure to write your name on your homework solution. You may (optionally) use this page as a cover sheet. 1

Problem 1. Z-buffer (10 points) The z-buffer algorithm can be improved by using an image space z-pyramid. The basic idea of the z-pyramid is to use the original z-buffer as the finest level in the pyramid, and then combine four z-values at each level into one z-value at the next coarser level by choosing the farthest (most negative) z from the observer. Every entry in the pyramid therefore represents the farthest (most negative) z for a square area of the z-buffer. In this problem, assume the image is always square with side length that is a power of 2. (Handling non-square, nonpowers-of-2 images is a simple generalization of this.) Before each primitive is rendered, the z-pyramid is updated to reflect the current state of the z-buffer. When you have a new primitive to draw, you are then testing against the current, up-to-date z-pyramid. A z-pyramid for a single 2x2 image is shown below: - - - - - - a) (2 points) At the coarsest level of the z-pyramid there is just a single z value. What does that z value represent? Suppose we wish to test the visibility of a triangle T. Let z T be the nearest z value of triangle T. R is a region on the screen that encloses the triangle T, and is the smallest region of the z-pyramid that does so. Let z R be the z value that is associated with region R in the z-pyramid. z R b) (2 points) What can we conclude if z R < z T? c) (2 points) What can we conclude if z T < z R? z R > z R If the visibility test is inconclusive, then the algorithm applies the same test recursively: it goes to the next finer level of the pyramid, where the region R is divided into four quadrants, and attempts to prove that triangle T is hidden in each of the quadrants of R that T intersects. Since it is expensive to compute the closest z value of T within each quadrant, the algorithm just uses the same z T (the nearest z of the entire triangle) in making the comparison in every quadrant. If, at the bottom of the pyramid, the test is still inconclusive, the algorithm resorts to ordinary z-buffered rasterization to resolve visibility. d) (4 points) Suppose that, instead of using the above algorithm, we decided to go to the expense of computing the closest z value of T within each quadrant. Finding the closest value amounts to clipping the triangle to each region and analytically solving for the closest z. This approach also applies to the finest level of the pyramid, where the pixels are abutting square regions. Would it then be possible to always make a definitive conclusion about the visibility of T within each pixel, without resorting to rasterization (effectively intersecting the viewing ray with the triangle)? Why or why not? 2

Problem 2. Projections (15 points) Imagine there is a pinhole camera located at the origin, COP 1, that is looking in the z direction. The projection plane (PP) is the plane z = z P (note z P is a negative number), so that the distance from COP 1 to PP is d = -z P, as shown in the figure below. Let there be two points in the scene, P = [0 y P z P 1] T and Q = [0 y P 2z P 1] T. z P P Q y P z P The projection matrix for this camera is 1 0 0 0 0 1 0 0 0 0 1/ z p 0 This projects P to the point [0 y P 1] T and Q to the point [0 ½y P 1] T. a) (4 points) Now, assume that the camera has moved to COP 2 (shown above) at [0 0-2z P 1] T. Assume PP stays at z = z P. Derive the new projection matrix that maps points onto PP. Show your work. b) (2 points) If your matrix in part a) is correct, point P should project to the same image point as before. Calculate the projection of point Q. How did the projection of point Q change when the camera moved from COP 1 to COP 2? c) (6 points) Suppose we want to keep the projection of Q constant at [0 ½y P 1] T. Suppose the center of projection is at COP = [0 0 z COP 1] T. To keep the projection of Q constant, we will need to vary the z- coordinate of PP; let the updated PP be z = z p. Solve for z p needed to keep Q s projection constant as z COP varies. Show your work. Note that the z-coordinate of Q is fixed at 2z P, but the z-coordinate of PP is now a variable, z p. d) (3 points) Now consider moving the COP infinitely far back along the positive z-axis while keeping PP at its original location, z = z P. Derive the new projection matrix for this case. Show your work. What is this sort of projection called? 3

Problem 3. Shading, displacement mapping, and normal mapping (30 points) In this problem, an opaque surface will be illuminated by one directional light source and will reflect light according to the following Phong shading equation: N L V R I A L k k B shadow d s Note the inclusion of a shadowing term, which takes on a value of 0 or 1. For simplicity, we will assume a monochrome world where I, L, k d, and k s are scalar values. Suppose a viewer is looking down at an infinite plane (the x-y plane) as illustrated below. The scene is illuminated by a directional light source, also pointing straight down on the scene. n s Answer the following questions below, giving brief justifications of each answer. Note that lighting and viewing directions are from the point of view of the light and viewer, respectively, and need to be negated when considering the surface-centric shading equation above. [In general, you don't need to solve equations and precisely plot functions. It is enough to describe the variables involved, how they relate to each other, and how this relationship will determine, e.g., the appearance of the surface. If you're more comfortable making the answers analytical with equations and plots, however, you are welcome to do so.] a) (2 points) Assume: Perspective viewer at (0,0,1) looking in the (0,0,-1) direction, angular field of view of 90 degrees, lighting direction of (0,0,-1), k d = 0.5, k s = 0. Describe the brightness variation over the image seen by the viewer. Justify your answer. b) (2 points) Assume: Perspective viewer at (0,0,1) looking in the (0,0,-1) direction,, angular field of view of 90 degrees, lighting direction of (0,0,-1), k d = 0.5, k s = 0.5, n s = 10. Describe the brightness variation over the image seen by the viewer. Justify your answer. c) (2 points) Assume: Orthographic viewer looking in the (0,0,-1) direction, lighting direction of (0,0,-1), k d = 0.5, k s = 0.5, n s = 10. Describe the brightness variation over the image seen by the viewer. Justify your answer. d) (3 points) Assume: Orthographic viewer looking in the (0,0,-1) direction, k d = 0.5, k s = 0. The lighting direction starts at (-sqrt(2)/2,0, -sqrt(2)/2) and then rotates around the z-axis. Describe the brightness variation over time, as seen by the viewer. Justify your answer. 4

Problem 3. (cont d) e) (3 points) Assume: Orthographic viewer looking in the (0,0,-1) direction, k d = 0.5, k s = 0.5, n s = 10. The lighting direction starts at (-sqrt(2)/2,0, -sqrt(2)/2) and then rotates around the z-axis. Describe the brightness variation over time, as seen by the viewer. Justify your answer. Suppose now the infinite plane is replaced with a surface z = cos(x): We can think of this as simply adding a displacement d=cos(x) in the normal direction to the x-y plane. f) (5 points) Assume: Orthographic viewer looking in the (0,0,-1) direction, lighting direction of (0,0,-1), k d = 0.5, k s = 0. At what values of x is the surface brightest? At what values is it dimmest? Describe the appearance of the surface. Justify your answers. g) (5 points) Assume: Orthographic viewer looking in the (0,0,-1) direction, lighting direction of (0,0,-1), k d =0, k s =0.5, n s =10. At what values of x is the surface brightest? Describe the appearance of the surface. How does the appearance change as n s increases to 100? Justify your answers. Suppose now that we simply keep the normals used in (f)-(g) and map them over the plane from the first part of the problem. The geometry will be flat, but the shading will be based on the varying normals. h) (5 points) Assume: Orthographic viewer looking in the (0,0,-1) direction, k d =0.5, k s =0. If we define the lighting to have direction (-sin, 0, -cos), will the normal mapped rendering look the same as the displacement mapped rendering for each of = 0, 10, and 80 degrees? Justify your answer. i) (3 points) Assume: Orthographic viewer, lighting direction of (0,0,-1), k d =0.5, k s =0. As we generally move the viewer around rotating it to various viewing direcitons will the normal mapped rendering look the same as the displacement mapped rendering? Justify your answer. 5

Problem 4. Ray intersection with implicit surfaces (24 points) There are many ways to represent a surface. One way is to define a function of the form f ( x, y, z) 0. Such a function is called an implicit surface representation. For example, the equation 2 2 2 2 f ( x, y, z) x y z r 0 defines a sphere of radius r. Suppose we wanted to ray trace a so-called tangle cube, described by the equation: 4 4 4 2 2 2 x y z 5x 5y 5z 12 0 In the figure below, the left column shows two renderings of the tangle cube, the middle column illustrates taking a slice through the x-y plane (at z = 0), and the right column shows a slice parallel to the x-y plane taken toward the bottom of the tangle cube (plane at z -1.5): In the next problem steps, you will be asked to solve for and/or discuss ray intersections with this primitive. Performing the ray intersections will amount to solving for the roots of a polynomial, much as it did for sphere intersection. For your answers, you need to keep a few things in mind: You will find as many roots as the order (largest exponent) of the polynomial. You may find a mixture of real and complex roots. When we say complex here, we mean a number that has a non-zero imaginary component. All complex roots occur in complex conjugate pairs. If A + ib is a root, then so is A ib. Sometimes a real root will appear more than once, i.e., has multiplicity > 1. Consider the case of sphere intersection, which we solve by computing the roots of a quadratic equation. A ray that intersects the sphere will usually have two distinct roots (each has multiplicity = 1) where the ray enters and leaves the sphere. If we were to take such a ray and translate it away from the center of the sphere, those roots get closer and closer together, until they merge into one root. They merge when the ray is tangent to the sphere. The result is one distinct real root with multiplicity = 2. (a) (9 points) Consider the ray td 0 0 0 d 1 1 0. Typically, we normalize d, but for simplicity (and without loss of generality) you can work with the un-normalized d as given here. Solve for all values of t where the ray intersects the tangle cube (including any negative values of t). Show your work. In the process of solving for t, you should have computed the roots of a polynomial. How many distinct real roots did you find? How many of them have multiplicity > 1? How many complex roots did you find? Which value of t represents the intersection we care about for ray tracing? P, where P and 6

Problem 4 (cont d) b) (15 points) What are all the possible combinations of roots when ray tracing this surface, not counting the one in part (a)? For each combination, describe the 4 roots as in part (a), draw a ray in the x-y plane that gives rise to that combination, and place a dot at each intersection point. Assume the origin of the ray is outside of the bounding box of the object. There are five diagrams below that have not been filled in. You may not need all five; on the other hand, if you can actually think of more distinct cases than spaces provided, then we might just give extra credit. The first one has already been filled in. (Note: not all conceivable combinations can be achieved on this particular implicit surface. For example, there is no ray that will give a root with multiplicity 4.) Please write on this page and include it with your homework solution. You do not need to justify your answers. # of distinct real roots: 4 # of distinct real roots: # of distinct real roots: # of real roots w/ multiplicity > 1: 0 # of real roots w/ multiplicity > 1: # of roots w/ multiplicity > 1: # of complex roots: 0 # of complex roots: # of complex roots: # of distinct real roots: # of distinct real roots: # of distinct real roots: # of real roots w/ multiplicity > 1: # of real roots w/ multiplicity > 1: # of real roots w/ multiplicity > 1: # of complex roots: # of complex roots: # of complex roots: 7

Problem 5. Parametric curves (21 points) In this problem, we will explore the construction of parametric. Please write on the pages for this problem and include them with your homework solution. a) (3 points) Given the following Bezier control points, construct all of the de Casteljau lines and points needed to evaluate the curve at u=1/4. Label this point Q(1/4). b) (6 points) For the same Bezier control points, shown again below, construct all of the de Casteljau lines and points needed to evaluate the curve at u=1/2. Label this point Q(1/2).Then add the point from part (a) and label it Q(1/4). Now sketch the path the Bezier curve will take. The curve does not need to be exact, but it should conform to some of the geometric properties of Bezier curves (convex hull condition, tangency at endpoints). 8

Problem 5 (cont d) c) (6 points) Given the following Catmull-Rom control points, construct all of the lines and points needed to generate the Bezier control points for the Catmull-Rom curve. Use a tension value of =1. Assume that we insert phantom control points C -1 =C 0 and C 4 =C 3, so that the spline is endpoint interpolating. You must mark each Bezier point (including any that coincide with a Catmull-Rom control point) with an X, but you do not need to label it (i.e., no need to give each Bezier point a name). Sketch the resulting spline curve, respecting the properties of Bezier curves noted above. d) (6 points) Given the following de Boor points, construct all of the lines and points needed to generate the Bezier control points for the B-spline. Assume that we insert phantom control points B -2 =B -1 =B 0 and B 5 =B 4 =B 3, so that the spline is endpoint interpolating. You must mark each Bezier point (including any that coincide with a de Boor point) with an X, but you do not need to label it (i.e., no need to give each Bezier point a name). Sketch the resulting spline curve, respecting the properties of Bezier curves noted above. 9