Last week. Machiraju/Zhang/Möller

Similar documents
CS452/552; EE465/505. Geometry Transformations

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

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

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics I. Guoying Zhao 1 / 52

Last week. Machiraju/Zhang/Möller/Fuhrmann

Objectives. Geometry. Coordinate-Free Geometry. Basic Elements. Transformations to Change Coordinate Systems. Scalars

Today s Agenda. Geometry

Objectives. Geometry. Basic Elements. Coordinate-Free Geometry. Transformations to Change Coordinate Systems. Scalars

Transformations Computer Graphics I Lecture 4

Lecture 4: Transformations and Matrices. CSE Computer Graphics (Fall 2010)

Three Main Themes of Computer Graphics

Supplement to Lecture 16

BASIC ELEMENTS. Geometry is the study of the relationships among objects in an n-dimensional space

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

Image Formation. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Intro to Ray-Tracing & Ray-Surface Acceleration

521493S Computer Graphics Exercise 2 Solution (Chapters 4-5)

CT5510: Computer Graphics. Transformation BOCHANG MOON

Transformations Computer Graphics I Lecture 4

3D GRAPHICS. design. animate. render

Geometric Queries for Ray Tracing

CS 130 Exam I. Fall 2015

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

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

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

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

Transformations. CSCI 420 Computer Graphics Lecture 4

Transformations in Ray Tracing. MIT EECS 6.837, Durand and Cutler

Photorealism: Ray Tracing

Ray Tracing. Foley & Van Dam, Chapters 15 and 16

DRAFT: Mathematical Background for Three-Dimensional Computer Graphics. Jonathan R. Senning Gordon College

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Graphics Pipeline 2D Geometric Transformations

CHAPTER 1 Graphics Systems and Models 3

Basic Elements. Geometry is the study of the relationships among objects in an n-dimensional space

Computer Graphics I Lecture 11

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

3D Viewing. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

CS354 Computer Graphics Ray Tracing. Qixing Huang Januray 24th 2017

Graphics and Interaction Transformation geometry and homogeneous coordinates

2D Object Definition (1/3)

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

Image Formation. Introduction to Computer Graphics. Machiraju/Zhang/Möller/Klaffenböck

Ray Tracing. Outline. Ray Tracing: History

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

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

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

CS 130 Final. Fall 2015

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

3D Rendering. Course Syllabus. Where Are We Now? Rendering. 3D Rendering Example. Overview. Rendering. I. Image processing II. Rendering III.

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

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

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

Transformations. CSCI 420 Computer Graphics Lecture 5

Transformations. OpenGL Transformations. 4x4 Model-view Matrix (this lecture) OpenGL Transformation Matrices. 4x4 Projection Matrix (next lecture)

Lecture 11: Ray tracing (cont.)

Shading, Advanced Rendering. Week 7, Wed Feb 28

The Three Dimensional Coordinate System

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Stereo Vision. MAN-522 Computer Vision

CPSC GLOBAL ILLUMINATION

Chapter 5. Projections and Rendering

Ray scene intersections

3D Viewing. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

3D Rendering and Ray Casting

Computer Graphics. Lecture 02 Graphics Pipeline. Edirlei Soares de Lima.

Computer Graphics Ray Casting. Matthias Teschner

Transforms. COMP 575/770 Spring 2013

Shadows in Computer Graphics

1999, Denis Zorin. Ray tracing

Lecture 1. Computer Graphics and Systems. Tuesday, January 15, 13

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

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

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

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

Intro to Modeling Modeling in 3D

CS 130 Exam I. Fall 2015

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

Sung-Eui Yoon ( 윤성의 )

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

3D Rendering Pipeline (for direct illumination)

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

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

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

CS5620 Intro to Computer Graphics

Direct Rendering of Trimmed NURBS Surfaces

Computer Graphics and Image Processing Ray Tracing I

Recursive Ray Tracing. Ron Goldman Department of Computer Science Rice University

Camera Placement for Ray Tracing

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

Computer Graphics. Si Lu. Fall uter_graphics.htm 11/22/2017

CS452/552; EE465/505. Intro to Lighting

EECE 478. Learning Objectives. Learning Objectives. Linear Algebra and 3D Geometry. Linear algebra in 3D. Coordinate systems

Effects needed for Realism. Computer Graphics (Fall 2008) Ray Tracing. Ray Tracing: History. Outline

Ray casting. Ray casting/ray tracing

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

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

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

Transcription:

Last week Machiraju/Zhang/Möller 1

Overview of a graphics system Output device Input devices Image formed and stored in frame buffer Machiraju/Zhang/Möller 2

Introduction to CG Torsten Möller 3

Ray tracing: the algorithm for each pixel on screen determine ray from eye through pixel if ray shoots into infinity, return a background color if ray shoots into light source, return light color appropriately find closest intersection of ray with an object cast off shadow ray (towards light sources) if shadow ray hits a light source, compute light contribution according to some illumination model cast reflected and refracted ray, recursively calculate pixel color contribution return pixel color after some absorption Most expensive Machiraju/Zhang/Möller 4

The z-buffer algorithm operations vs. per-pixel for ray tracing Simple and often accelerated with hardware Works regardless of the order in which the polygons are processed no need to sort them back to front A visibility algorithm and not designed to compute colors WebGL implements this fundamental algorithm gl.enable(gl.depth_test); gl.clear(gl.color_buffer_bit gl.depth_buffer_bit); Machiraju/Zhang/Möller 5

The algorithm for each polygon in the scene project its vertices onto viewing (image) plane end if for each pixel inside the polygon formed on viewing plane determine point on polygon corresponding to this pixel get pixel color according to some illumination model get depth value for this pixel (distance from point to plane) if depth value < stored depth value for the pixel end if update pixel color in frame buffer update depth value in depth buffer (z-buffer) Question: What does the depth buffer store after running the z-buffer algorithm for the scene? Does polygon order change depth? Image? Machiraju/Zhang/Möller 6

Geometric Basics Introduction to Computer Graphics Torsten Möller Machiraju/Zhang/Möller

Graphics Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Texture/ Color Realism Machiraju/Zhang/Möller 8

Reading Chapter 4 of Angel Chapter 7 of Foley, van Dam, Machiraju/Zhang/Möller 9

Schedule Geometry basics Affine transformations Use of homogeneous coordinates Concatenation of transformations 3D transformations Transformation of coordinate systems Transform the transforms Transformations in OpenGL Machiraju/Zhang/Möller 10

Why do we need transformations? Need to transform objects from object coordinate system (OCS) to world CS Need to transform objects from world CS to the coordinate system of the camera (ViewCS) Need to transform objects from VCS into an WebGL window/viewport (DisplayCS) Object may move (translate or rotate) or deform (scale, shear, or general non-rigid deformation) WCS VCS DCS OCS Machiraju/Zhang/Möller 11

Geometry basics Scalar, point, and vector Vector space and affine space Basic point and vector operations Sided-ness test Lines, planes, and triangles Linear independence Coordinate systems and frames Machiraju/Zhang/Möller 13

Scalar, point, and vector Point: a location in space Specified by a k-tuple for k-d points Always given with respect to some coordinate system Scalar: a quantity, e.g., edge length Vector: a directed line segment between points Spaces: vector space, affine space, Euclidean space, etc. P = x y z Machiraju/Zhang/Möller 14

Vector space A set of vectors with scalar multiplications and vector additions Scalar-vector multiplication u = αv Vector-vector addition: w = u + v Expressions such as v = u + 2w 3r make sense in a vector space But vectors lack position Inadequate for representing geometry we need positions, which are given by points Machiraju/Zhang/Möller 15

Affine space A vector space + points = affine space Operations Vector-vector addition Scalar-vector multiplication Point-vector addition Affine sum of points and convex sums A vector space + distance/norm = Euclidean space Machiraju/Zhang/Möller 16

Geometry basics Scalar, point, and vector Vector space and affine space Basic point and vector operations Sided-ness test Lines, planes, and triangles Linear independence Coordinate systems and frames Machiraju/Zhang/Möller 17

Basic point and vector operations point point = vector point + vector = point vector operations: scalar * vector = vector vector + vector = vector vector vector = scalar, the dot product vector vector = vector, the cross product u v v u Right-hand rule Machiraju/Zhang/Möller 18

More on dot product u v = ux vx + uy vy + uz vz u u = u 2 is always non-negative u v is commutative and distributive over additions u v = u v cos θ Two vectors u and v are orthogonal if and only if u v = 0 If v is normalized, i.e., v = 1, then u v gives the projection of u in the direction of v Machiraju/Zhang/Möller 19

More on cross product Cross product u v is a vector perpendicular to u and v frequently used to compute the normal to a plane Direction of the cross product is determined by the right hand rule u v = - v u Wikipedia u v = u v sin θ = area of the parallelogram u v v u Wikipedia Machiraju/Zhang/Möller 20

More on cross product How to compute? use determinant i j k u1 u2 u3 v1 v2 v3 Wikipedia Machiraju/Zhang/Möller 21

Affine and convex sums Addition of two arbitrary points is not defined in an affine space But consider two points P and Q with Q = P + αv, we can always find a point R such that v = R P so now we have Q = P + α(r P) or Q = αr + (1 α)p Thus, affine sum (combination) of points can be defined t1p1 + t2p2 + + tnpn, t1 + t2 + + tn = 1 Convex sum (combination) of points t1p1 + + tnpn, where t1 + + tn = 1 and ti 0 for all i Machiraju/Zhang/Möller 22

Convex hull Convex hull of a set of points: set of convex combination of these points Alternatively, the convex hull is the smallest convex object containing the set of points Formed by shrink wrapping points Useful in, e.g., fast collision detection Machiraju/Zhang/Möller 23

Sided-ness test On which side does a point V lie with respect to a line, specified by a vector u? Solution 1: use an implicit line or plane equation; plug in the point coordinates and check the sign Solution 2: in 2D, let the z coordinate be zero, compute a cross product and check the sign of the z component Solution 3: find a vector u perpendicular to u; check sign of u v ( u y, u x ) u = (u x, u y ) V u V V u u V Machiraju/Zhang/Möller 24

Geometry basics Scalar, point, and vector Vector space and affine space Basic point and vector operations Sided-ness test Lines, planes, and triangles Linear independence Coordinate systems and frames Machiraju/Zhang/Möller 25

Line representations Consider all points of the form P(α) = P 0 + αd this is the set of all points lying on a line that passes through P 0 in the direction of the vector d Known as the parametric form of the line Given two points R and Q on the line, we have Other representations Explicit: y = mx + h Implicit: ax + by + c = 0 x(α) = α R x + (1 α) Q x y(α) = α R y + (1 α) Q y Machiraju/Zhang/Möller 26

Ray and line segment If α 0, then P(α) is the ray leaving P 0 in the direction of the vector d For the two-point representation x(α) = α R x + (1 α) Q x Ԧv y(α) = α R y + (1 α) Q y if 1 α 0, then we get all the points on the line segment joining R and Q Machiraju/Zhang/Möller 27

Parametric plane representation A plane can be defined by a point and two vectors or by three points P Ԧv P P (a, b) (a, b) R u R Q P(a, b) = R + a u + b Ԧv P(a, b) = R + a(q R) + b(p R) Ԧv u Machiraju/Zhang/Möller 28

Implicit plane equation F(x, y, z) = ax + by + cz + d = 0 Typically, (a, b, c) is the unit normal of the plane If F(x 0, y 0, z 0 ) < 0, point (x 0, y 0, z 0 ) is below the plane (w. r. t. the normal) (a, b, c) If F(x 0, y 0, z 0 ) > 0, point (x 0, y 0, z 0 ) is above the plane In general, the distance from a point (x 0, y 0, z 0 ) to the plane is given by d Machiraju/Zhang/Möller 29

Triangle and barycentric coordinates convex sum of P and Q convex sum of S(α) & R T is a convex sum of P, Q, and R. The weights are called the barycentric coodinates of T Machiraju/Zhang/Möller 30

Coordinate system (CS) and frame n linearly independent vectors of an n-d vector space define a coordinate system (CS), e.g., Cartesian CS The vectors are called the basis vectors Any vector in the space can be written as a linear sum of the basis vectors in a unique way An origin O, the reference point, along with a set of basis vectors form a frame Any point P = O + linear sum of basis vectors Coefficients of the sum: coordinates of point P Machiraju/Zhang/Möller 31

From one CS to another Express point given in one frame/cs in another CS In 2D, need to solve system of two equations Assume the two CS have the same origin P = (1, 2) T P = (x, y) T Basis: (1, 1) T and (0, 1) T New set of basis: (-1,1) T and (1, 0) T Need to find x and y such that 1*(1,1) T + 2*(0,1) T = x*(2,3) T + y*( 1, 2) T Alternatively (in matrix notation) Machiraju/Zhang/Möller 32

Change of CS This reduces to a change of basis vectors With the 2D basis vectors u (u ) and v (v ), find a 2 2 matrix M such that [u v] M = [u v ], thus M = [u v] 1 [u v ] Then P(u, v ) = M 1 P(u, v) for all points P The matrix transforms points from one CS, with basis u and v, to another CS, with basis u and v M is also called the change of basis matrix Machiraju/Zhang/Möller 33

Next Lecture: 2-dimensional transformations Machiraju/Zhang/Möller