Viewing and Projection

Similar documents
Viewing and Projection

Viewing and Projection

Viewing and Projection

3.1 Viewing and Projection

Reminder: Affine Transformations. Viewing and Projection. Shear Transformations. Transformation Matrices in OpenGL. Specification via Ratios

Geometric transformations

Topic 3: 2D Transformations 9/10/2016. Today s Topics. Transformations. Lets start out simple. Points as Homogeneous 2D Point Coords

Rigid Body Transformations

MA1008. Calculus and Linear Algebra for Engineers. Course Notes for Section B. Stephen Wills. Department of Mathematics. University College Cork

Stained Glass Design. Teaching Goals:

CS-C3100 Computer Graphics, Fall 2016 Ray Casting II Intersection Extravaganza

Ray surface intersections

HW Stereotactic Targeting

CS380: Computer Graphics Modeling Transformations. Sung-Eui Yoon ( 윤성의 ) Course URL:

50 AMC LECTURES Lecture 2 Analytic Geometry Distance and Lines. can be calculated by the following formula:

Fundamental Types of Viewing

Lecture 7: Building 3D Models (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

CPSC (T1) 2nd Midterm Exam

2D Projective transformation

Pythagoras theorem and trigonometry (2)

Lecture 4 Single View Metrology

Overview. Viewing and perspectives. Planar Geometric Projections. Classical Viewing. Classical views Computer viewing Perspective normalization

1 Drawing 3D Objects in Adobe Illustrator

Overview. By end of the week:

Three-Dimensional Graphics III. Guoying Zhao 1 / 67

Section 10.4 Hyperbolas

Orientation & Quaternions. CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2017

MATH 2530: WORKSHEET 7. x 2 y dz dy dx =

Lecture 5: Spatial Analysis Algorithms

Tilt-Sensing with Kionix MEMS Accelerometers

Modeling and Simulation of Short Range 3D Triangulation-Based Laser Scanning System

GEOMETRIC TRANSFORMATIONS AND VIEWING

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

Topics in Analytic Geometry

CHAPTER III IMAGE DEWARPING (CALIBRATION) PROCEDURE

Transformations Computer Graphics I Lecture 4

If f(x, y) is a surface that lies above r(t), we can think about the area between the surface and the curve.

1. SEQUENCES INVOLVING EXPONENTIAL GROWTH (GEOMETRIC SEQUENCES)

Transformations Computer Graphics I Lecture 4

6.3 Volumes. Just as area is always positive, so is volume and our attitudes towards finding it.

CSE328 Fundamentals of Computer Graphics

AVolumePreservingMapfromCubetoOctahedron

ANALYTICAL GEOMETRY. The curves obtained by slicing the cone with a plane not passing through the vertex are called conics.

a(e, x) = x. Diagrammatically, this is encoded as the following commutative diagrams / X

15. 3D-Reconstruction from Vanishing Points

Introduction Transformation formulae Polar graphs Standard curves Polar equations Test GRAPHS INU0114/514 (MATHS 1)

Illumination and Shading

Surfaces. Differential Geometry Lia Vas

AML710 CAD LECTURE 16 SURFACES. 1. Analytical Surfaces 2. Synthetic Surfaces

ZZ - Advanced Math Review 2017

Lecture 5: Transforms II. Computer Graphics and Imaging UC Berkeley CS184/284A

MATH 25 CLASS 5 NOTES, SEP

Recap: rigid motions. [L7] Robotics (ME671): Forward Kinematics. Recap: homogeneous transforms. Robot Kinematics Suril Shah IIT Jodhpur

Ray Casting II. Courtesy of James Arvo and David Kirk. Used with permission.

9.1 apply the distance and midpoint formulas

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

such that the S i cover S, or equivalently S

Functor (1A) Young Won Lim 8/2/17

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

3D Viewing. With acknowledge to: Ed Angel. Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Yoplait with Areas and Volumes

Overview of Projections: From a 3D world to a 2D screen.

CS 548: COMPUTER GRAPHICS REVIEW: OVERVIEW OF POLYGONS SPRING 2015 DR. MICHAEL J. REALE

Functor (1A) Young Won Lim 10/5/17

Chap 3 Viewing Pipeline Reading: Angel s Interactive Computer Graphics, Sixth ed. Sections 4.1~4.7

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Class-XI Mathematics Conic Sections Chapter-11 Chapter Notes Key Concepts

Introduction to Computer Graphics 4. Viewing in 3D

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus

1 Quad-Edge Construction Operators

6.2 Volumes of Revolution: The Disk Method

Right Angled Trigonometry. Objective: To know and be able to use trigonometric ratios in rightangled

x )Scales are the reciprocal of each other. e

CSE 167: Introduction to Computer Graphics Lecture #3: Coordinate Systems

Physics 208: Electricity and Magnetism Exam 1, Secs Feb IMPORTANT. Read these directions carefully:

Optical Engineering. Course outline. Exercise. Generation of upright, magnified image

Unit 5 Vocabulary. A function is a special relationship where each input has a single output.

Computer Graphics I Lecture 11

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

4452 Mathematical Modeling Lecture 4: Lagrange Multipliers

EXPONENTIAL & POWER GRAPHS

4-1 NAME DATE PERIOD. Study Guide. Parallel Lines and Planes P Q, O Q. Sample answers: A J, A F, and D E

Clipping and Scan Conversion

Automated Stereo Camera Calibration System

Geometry: Outline. Projections. Orthographic Perspective

Math 35 Review Sheet, Spring 2014

Step-Voltage Regulator Model Test System

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

A TRIANGULAR FINITE ELEMENT FOR PLANE ELASTICITY WITH IN- PLANE ROTATION Dr. Attia Mousa 1 and Eng. Salah M. Tayeh 2

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

Determining the spatial orientation of remote sensing sensors on the basis of incomplete coordinate systems

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

What do all those bits mean now? Number Systems and Arithmetic. Introduction to Binary Numbers. Questions About Numbers

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

CS 418: Interactive Computer Graphics. Projection

Iterated Integrals. f (x; y) dy dx. p(x) To evaluate a type I integral, we rst evaluate the inner integral Z q(x) f (x; y) dy.

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

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

Approximation by NURBS with free knots

CS-184: Computer Graphics. Today. Clipping. Hidden Surface Removal. Tuesday, October 7, Clipping to view volume Clipping arbitrary polygons

Transcription:

15-462 Computer Grphics I Lecture 5 Viewing nd Projection Sher Trnsformtion Cmer Positioning Simple Prllel Projections Simple Perspective Projections [Angel, Ch. 5.2-5.4] Jnury 30, 2003 [Red s Drem, Pixr, 1987] Frnk Pfenning Crnegie Mellon University http://www.cs.cmu.edu/~fp/courses/grphics/ Trnsformtion Mtrices in OpenGL Trnsformtion mtrices in OpenGl re vectors of 16 vlues (column-mjor mtrices) In gllodmtrixf(glflot *m); m = {m 1, m 2,..., m 16 } represents Some books trnspose ll mtrices! 01/30/2003 15-462 Grphics I 2 Pondering Trnsformtions Derive trnsformtion given some prmeters Choose prmeters crefully Consider geometric intuition, bsic trigonometry Compose trnsformtion from others Use trnsltions to nd from origin Test if mtrix describes some trnsformtion Determine ction on bsis vectors Mening of dot product nd cross product Sher Trnsformtions x-sher scles x proportionl to y Leves y nd z vlues fixed 01/30/2003 15-462 Grphics I 3 01/30/2003 15-462 Grphics I 4 Specifiction vi Angle cot(θ) = (x -x)/y x = x + y cot(θ) y = y z = z y Specifiction vi Rtios Sher in both x nd z direction Leve y fixed Slope α for x-sher, γ for z-sher Solve (x,y) (x,y ) y Yields θ x -x x 01/30/2003 15-462 Grphics I 5 01/30/2003 15-462 Grphics I 6 1

Composing Trnsformtions Every ffine trnsformtion is composition of rottions, sclings, nd trnsltions How do we compose these to form n x-sher? Exercise! Thinking in Frmes Action on frme determines ffine trnsfn. Frme given by bsis vectors nd origin xz-sher: preserve bsis vectors u x nd u z Move u y = [0 1 0 0] T to u v = [α 1 γ 0] T 01/30/2003 15-462 Grphics I 7 01/30/2003 15-462 Grphics I 8 Preservtion of Origin Preserve origin P 0 Outline Sher Trnsformtion Cmer Positioning Simple Prllel Projections Simple Perspective Projections Results comprise columns of the trnsfn. mtrix 01/30/2003 15-462 Grphics I 9 01/30/2003 15-462 Grphics I 10 Cmer in Modeling Coordintes Cmer position is identified with frme Either move nd rotte the objects Or move nd rotte the cmer Initilly, pointing in negtive z-direction Initilly, cmer t origin Moving Cmer nd World Frme Move world frme reltive to cmer frme gltrnsltef(0.0, 0.0, -d); moves world frme 01/30/2003 15-462 Grphics I 11 01/30/2003 15-462 Grphics I 12 2

Order of Viewing Trnsformtions Think of moving the world frme Viewing trnsfn. is inverse of object trnsfn. Order opposite to object trnsformtions glmtrixmode(gl_modelview); gllodidentity(); gltrnsltef(0.0, 0.0, -d); /*T*/ glrottef(-90.0, 0.0, 1.0, 0.0); /*R*/ The Look-At Function Convenient wy to position cmer glulookat(e x, e y, e z, x, y, z, p x, p y, p z ); e = eye point = t point p = up vector p e 01/30/2003 15-462 Grphics I 13 01/30/2003 15-462 Grphics I 14 Implementing the Look-At Function (1) Trnsform world frme to cmer frme Compose rottion R with trnsltion T W = T R (2) Invert W to obtin viewing trnsformtion V V = W -1 = (T R) -1 = R -1 T -1 Derive R, then T, then R -1 T -1 World Frme to Cmer Frme I Cmer points in negtive z direction n = ( e) / e is unit norml to R mps [0 0-1 0] T to [n x n y n z 0] T e p n 01/30/2003 15-462 Grphics I 15 01/30/2003 15-462 Grphics I 16 World Frme to Cmer Frme II R mps y to projection of p onto α = (p n) / n = p n v 0 = p α n v = v 0 / v 0 p World Frme to Cmer Frme III x is orthogonl to n nd v in u = n v (u, v, -n) is right-hnded p V 0 e α n u v e n 01/30/2003 15-462 Grphics I 17 01/30/2003 15-462 Grphics I 18 3

Summry of Rottion glulookat(e x, e y, e z, x, y, z, p x, p y, p z ); n = ( e) / e v = (p (p n) n) / p (p n) n u = n v World Frme to Cmer Frme IV Trnsltion of origin to e = [e x e y e z 1] T 01/30/2003 15-462 Grphics I 19 01/30/2003 15-462 Grphics I 20 Cmer Frme to World Frme V = W -1 = (T R) -1 = R -1 T -1 R is rottion, so R -1 = R T Putting it Together Clculte V = R -1 T -1 T is trnsltion, so T -1 negtes displcement This is different from book [Angel, Ch. 5.2.2] There, u, v, n re right-hnded (here: u, v, -n) 01/30/2003 15-462 Grphics I 21 01/30/2003 15-462 Grphics I 22 Other Viewing Functions Roll (bout z), pitch (bout x), yw (bout y) Outline Sher Trnsformtion Cmer Positioning Simple Prllel Projections Simple Perspective Projections Assignment 2 poses relted problem 01/30/2003 15-462 Grphics I 23 01/30/2003 15-462 Grphics I 24 4

Projection Mtrices Recll geometric pipeline Projection tkes 3D to 2D Projections re not invertible Projections lso described by mtrix Homogenous coordintes crucil Prllel nd perspective projections Orthogrphic Projections Prllel projection Projectors perpendiculr to projection plne Simple, but not relistic Used in blueprints (multiview projections) 01/30/2003 15-462 Grphics I 25 01/30/2003 15-462 Grphics I 26 Orthogrphic Projection Mtrix Project onto z = 0 x p = x, y p = y, z p = 0 In homogenous coordintes Perspective Perspective chrcterized by foreshortening More distnt objects pper smller Prllel lines pper to converge Rudimentry perspective in cve drwings 01/30/2003 15-462 Grphics I 27 01/30/2003 15-462 Grphics I 28 Discovery of Perspective Middle Ages Foundtion in geometry (Euclid) Murl from Pompeii Art in the service of religion Perspective bndoned or forgotten Ottonin mnuscript, c. 1000 01/30/2003 15-462 Grphics I 29 01/30/2003 15-462 Grphics I 30 5

Renissnce Rediscovery, systemtic study of perspective Filippo Brunelleschi Florence, 1415 Perspective Viewing Mthemticlly More on history of perspective (icscis) http://www.cyberus.c/~icscis/icscis.htm y/z = y p /d so y p = y/(z/d) Note this is non-liner! 01/30/2003 15-462 Grphics I 31 01/30/2003 15-462 Grphics I 32 Exploiting the 4 th Dimension Perspective projection is not ffine: Perspective Projection Mtrix Represent multiple of point hs no solution for M Ide: represent point [x y z 1] T by line in 4D Solve for rbitrry w 0 with 01/30/2003 15-462 Grphics I 33 01/30/2003 15-462 Grphics I 34 Perspective Division Normlize [x y z w] T to [(x/w) (y/w) (z/w) 1] T Perform perspective division fter projection Prllel Viewing in OpenGL glortho(xmin, xmx, ymin, ymx, ner, fr) Projection in OpenGL is more complex z min = ner, z mx = fr 01/30/2003 15-462 Grphics I 35 01/30/2003 15-462 Grphics I 36 6

Perspective Viewing in OpenGL Two interfces: glfrustum nd gluperspective glfrustum(xmin, xmx, ymin, ymx, ner, fr); Field of View Interfce gluperspective(fovy, spect, ner, fr); ner nd fr s before Fovy specifies field of view s height (y) ngle z min = ner, z mx = fr 01/30/2003 15-462 Grphics I 37 01/30/2003 15-462 Grphics I 38 Mtrices for Projections in OpenGL Next lecture: Use sher for predistortion Use projections for fke shdows Other kinds of projections Announcements Assignment 1 due Thursdy midnight (100 pts) Lte policy Up to 3 dys ny time, no penlty No other lte hnd-in permitted Assignment 2 out Thursdy (1 week, 50 pts) Extr credit policy Up to 20% of ssignment vlue Recorded seprtely Weighed for borderline cses Remember: no collbortion on ssignments! 01/30/2003 15-462 Grphics I 39 01/30/2003 15-462 Grphics I 40 Looking Ahed Lighting nd shding Video: Red s Drem, John Lsseter, Pixr,1987 http://www.pixr.com/shorts/rd/index.html 01/30/2003 15-462 Grphics I 41 7