CSE452 Computer Graphics

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

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE328 Fundamentals of Computer Graphics

Three-Dimensional Viewing Hearn & Baker Chapter 7

Models and The Viewing Pipeline. Jian Huang CS456

Viewing. Reading: Angel Ch.5

Camera Model and Calibration

Viewing with Computers (OpenGL)

Computer Graphics with OpenGL ES (J. Han) Chapter IV Spaces and Transforms

Camera Model and Calibration. Lecture-12

Viewing. Announcements. A Note About Transformations. Orthographic and Perspective Projection Implementation Vanishing Points

THE VIEWING TRANSFORMATION

INTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52

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

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

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

Perspective Mappings. Contents

INTRODUCTION TO COMPUTER GRAPHICS. cs123. It looks like a matrix Sort of. Viewing III. Projection in Practice 1 / 52

3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing

Geometry: Outline. Projections. Orthographic Perspective

CS 112 The Rendering Pipeline. Slide 1

Linear and Affine Transformations Coordinate Systems

CV: 3D sensing and calibration

Lecture 4. Viewing, Projection and Viewport Transformations

Graphics pipeline and transformations. Composition of transformations

Specifying Complex Scenes

Rasterization Overview

OpenGL Transformations

Projection and viewing. Computer Graphics CSE 167 Lecture 4

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes

Chapter 8 Three-Dimensional Viewing Operations

3D Geometry and Camera Calibration

CMSC427 Transformations II: Viewing. Credit: some slides from Dr. Zwicker

CS 4204 Computer Graphics

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

Computer Vision. Coordinates. Prof. Flávio Cardeal DECOM / CEFET- MG.

CS 325 Computer Graphics

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside

Perspective transformations

1 OpenGL - column vectors (column-major ordering)

Culling. Computer Graphics CSE 167 Lecture 12

Computer Graphics: Geometric Transformations

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

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

Motivation. What we ve seen so far. Demo (Projection Tutorial) Outline. Projections. Foundations of Computer Graphics

To Do. Motivation. Demo (Projection Tutorial) What we ve seen so far. Computer Graphics. Summary: The Whole Viewing Pipeline

THE CAMERA TRANSFORM

Lecture 4: 3D viewing and projections

Overview. By end of the week:

Viewing. Part II (The Synthetic Camera) CS123 INTRODUCTION TO COMPUTER GRAPHICS. Andries van Dam 10/10/2017 1/31

CSC 305 The Graphics Pipeline-1

Computer Graphics 7: Viewing in 3-D

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

Rigid Body Motion and Image Formation. Jana Kosecka, CS 482

SUMMARY. CS380: Introduction to Computer Graphics Projection Chapter 10. Min H. Kim KAIST School of Computing 18/04/12. Smooth Interpolation

Computer Graphics. Lecture 04 3D Projection and Visualization. Edirlei Soares de Lima.

Geometric Transformations

Rendering Pipeline and Coordinates Transforms

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

3D Viewing. CS 4620 Lecture 8

COMP Computer Graphics and Image Processing. a6: Projections. In part 2 of our study of Viewing, we ll look at. COMP27112 Toby Howard

To Do. Demo (Projection Tutorial) Motivation. What we ve seen so far. Outline. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 5: Viewing

The Graphics Pipeline and OpenGL I: Transformations!

Evening s Goals. Mathematical Transformations. Discuss the mathematical transformations that are utilized for computer graphics

Transforms. COMP 575/770 Spring 2013

Implementing a virtual camera. Graphics 2. Creating a view of the scene an outline. Virtual camera - definitions

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

Computer Graphics. P05 Viewing in 3D. Part 1. Aleksandra Pizurica Ghent University

Computer Graphics Viewing

Projection Lecture Series

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

UNIT 2 2D TRANSFORMATIONS

CS488. Implementation of projections. Luc RENAMBOT

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

Projection: Mapping 3-D to 2-D. Orthographic Projection. The Canonical Camera Configuration. Perspective Projection

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

Visualisation Pipeline : The Virtual Camera

CT5510: Computer Graphics. Transformation BOCHANG MOON

Graphics 2009/2010, period 1. Lecture 6: perspective projection

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

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S

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

file:///c /Documents%20and%20Settings/Jason%20Raftery/My%20Doc...e%20184%20-%20Spring%201998%20-%20Sequin%20-%20Midterm%202.htm

3-D D Euclidean Space - Vectors

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

The Importance of Matrices in the DirectX API. by adding support in the programming language for frequently used calculations.

Transformations Week 9, Lecture 18

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

Rendering If we have a precise computer representation of the 3D world, how realistic are the 2D images we can generate? What are the best way to mode

The Graphics Pipeline and OpenGL I: Transformations!

Camera Calibration. COS 429 Princeton University

GEOMETRIC TRANSFORMATIONS AND VIEWING

CS251 Spring 2014 Lecture 7

COMP3421. Vector geometry, Clipping

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

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

(Refer Slide Time: 00:01:26)

DD2423 Image Analysis and Computer Vision IMAGE FORMATION. Computational Vision and Active Perception School of Computer Science and Communication

Computer Graphics with OpenGL ES (J. Han) Chapter VII Rasterizer

Transcription:

CSE45 Computer Graphics Lecture 8: Computer Projection CSE45 Lecture 8: Computer Projection 1

Review In the last lecture We set up a Virtual Camera Position Orientation Clipping planes Viewing angles Orthographic/Perspective We are ready to project! U P d n d f L q w q h d f w h d n L U P CSE45 Lecture 8: Computer Projection

Preview CSE45 Lecture 8: Computer Projection 3 Near plane Film plane Far plane Viewpor t

Preview The perspective view frustum (i.e., a truncated pyramid) is non-trivial to clip against CSE45 Lecture 8: Computer Projection 4

How do you clip? CSE45 Lecture 8: Computer Projection 5

How do you clip? Check against six planes? Project to a film plane and check against near and far planes? An elegant solution that does clipping and also projection together CSE45 Lecture 8: Computer Projection 6

Preview We first transform the frustum to a canonical volume CSE45 Lecture 8: Computer Projection 7

Canonical View Volume X CSE45 Lecture 8: Computer Projection 8

Canonical View Volume X 1 CSE45 Lecture 8: Computer Projection 9

Canonical View Volume {-1,1,1} {-1,1,0} Far Clipping Plane {-1,-1,1} {1,1,1} {1,-1,1} X 1 {1,1,0} {1,-1,0} Near Clipping Plane Projectors (parallel to ) CSE45 Lecture 8: Computer Projection 10

Canonical View Volume Canonical view volume makes things easy: Easy clipping: Clip against the coordinates range X -1<x<1, -1<y<1, 0<z<1 1 CSE45 Lecture 8: Computer Projection 11

Canonical View Volume Canonical view volume makes things easy: Easy clipping: Clip against the coordinates range -1<x<1, -1<y<1, 0<z<1 X 1 Easy projecting: drop the coordinate! (because viewing plane is the X plane, and projectors are parallel to axis) (Xc, c, c) Coordinates in the canonical volume (Xc, c) Projected D coordinates CSE45 Lecture 8: Computer Projection 1

Viewing Transformation The transformation that warps the perspective frustum to the canonical view volume Transforms world coordinates {x w,y w,z w } into canonical coordinates {x c,y c,z c } U L q w P d n {x w,y w,z w } q h {x c,y c,z c } X d f 1 CSE45 Lecture 8: Computer Projection 13

Camera Coordinate System First, let s setup a coordinate system for the camera Origin at the camera Three axes: right (u), straight-up (v), negative look (n) Unit vectors forming an orthonormal, right-hand basis n u v P U L CSE45 Lecture 8: Computer Projection 14

Camera Coordinate System Computing n Opposite to look vector L, normalized n = - L L n L P CSE45 Lecture 8: Computer Projection 15

Camera Coordinate System Computing v Projection of up vector U onto the camera plane, normalized n v P U L CSE45 Lecture 8: Computer Projection 16

Camera Coordinate System Computing v Projection of up vector U onto the camera plane, normalized n v P U L CSE45 Lecture 8: Computer Projection 17

Camera Coordinate System Computing u Cross product of v and n n u v P U L CSE45 Lecture 8: Computer Projection 18

Camera Coordinate System Computing u Cross product of v and n n u v P U L CSE45 Lecture 8: Computer Projection 19

Camera Coordinate System Summary Three axes, computed from look vector L and up vector U: n v U L u,v,n form a camera coordinate system u P CSE45 Lecture 8: Computer Projection 0

Computing Viewing Transformation Two steps Step 1: align camera coordinate system P,u,v,n with world coordinate system O,X,, Step : scale and stretch the frustum to the cuboid CSE45 Lecture 8: Computer Projection 1

Step1 X 1 v n u CSE45 Lecture 8: Computer Projection

Step1 v 1 X n u CSE45 Lecture 8: Computer Projection 3

Step1 n v u 1 X CSE45 Lecture 8: Computer Projection 4

Step 1 First, translate the eye point P to the origin Let P have coordinates (p x,p y,p z ) O (P) CSE45 Lecture 8: Computer Projection 5

Step 1 (cont) Then, rotate the three axes u,v,n to X,, Let s set up the equation to solve for the rotation matrix (R): Note the homogenous coordinates for a vector ends with 0! In matrix form: R u x v x n x 0 u y v y n y 0 u z v z n z 0 0 0 0 1 = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 CSE45 Lecture 8: Computer Projection 6

Step 1 (cont) This is a matrix inversion problem: u x v x n x 0 R = M - 1 u where M = y v y n y 0 u z v z n z 0 0 0 0 1 Since M is an orthonormal matrix: R = M T CSE45 Lecture 8: Computer Projection 7

Step 1 - Done Eye point at origin, looking down negative z axis (v) (n) (P) (u) X 1 CSE45 Lecture 8: Computer Projection 8

Step X 1 CSE45 Lecture 8: Computer Projection 9

Step Some preparations First, make width/height angles to be π/ Non-uniform scaling in X, coordinates q h h h 1 A look down the X axis CSE45 Lecture 8: Computer Projection 30

Step Some preparations First, make width/height angles to be π/ Non-uniform scaling in X, coordinates q h h h 1 A look down the X axis CSE45 Lecture 8: Computer Projection 31

I hate cotangent, arctan, cosecant... Why call arctan? According to wikipedia the arc whose cosine is x the angle whose cosine is x is the same as CSE45 Lecture 8: Computer Projection 3

Step (cont) Some preparations Next, push the far plane from =-d f to =-1 Uniform scaling in all three coordinates S xyz = 1 df 0 0 0 0 1 df 0 0 0 0 1 df 0 0 0 0 1 d f 1 CSE45 Lecture 8: Computer Projection 33

Step (cont) Where we are now: 1 -d n /d f -1-1 A look down the X axis (same picture when looking down ) CSE45 Lecture 8: Computer Projection 34

Step (cont) Perspective transformation Stretching and flipping the truncated pyramid to the cuboid Change range: ([-d n /d f,-1] -> [0,1]) Stretch in X plane: Non-uniform stretching based on z 1-1 1 0 -d n /d f -1 A look down the X axis CSE45 Lecture 8: Computer Projection 35

Homogeneous coordinate revisited is deep and has interesting meanings... https://en.m.wikipedia.org/wiki/homogeneous_coordinates In short (x, y, z, 1) and (x, y, z, ) are the same point. (x, y, z, 1) and (-3x, -3y, -3z, -3) are the same point. CSE45 Lecture 8: Computer Projection 36

Step (cont) Perspective transformation D = 1 0 0 0 0 1 0 0 0 0 1 k- 1 0 0-1 0 k k- 1, where k = d n d f Applying D to homogeneous coordinates: Converting from homogeneous coordinates {x,y,z,w} to Cartesian coordinates (divide x,y,z by w) CSE45 Lecture 8: Computer Projection 37

Step (cont) Perspective transformation 1 -k -1 1 0-1 A look down the X axis CSE45 Lecture 8: Computer Projection 38

Putting Together Translation: Rotation: Scaling: T R S xy, S xyz Perspective transformation: D World-to-camera transformation (v) (P) (n) (u) T, R S xy, S xyz, D X 1 CSE45 Lecture 8: Computer Projection 39

Putting Together Complete viewing transformation to bring a point canonical volume: q' = D S xyz S xy R T q q to the (v) T, R (n) (P) (u) S xy, S xyz, D X 1 CSE45 Lecture 8: Computer Projection 40

Clipping After transformation into the canonical volume, each object will be clipped against 6 cuboid faces. Point clipping: checking coordinates range Edge clipping: computing line/plane intersections We will discuss a D version in next lecture. Triangle clipping: can be done by line/plane intersections CSE45 Lecture 8: Computer Projection 41

Projecting Dropping z coordinate Resulting points have range: -1<=x<=1, -1<=y<=1 X 1 CSE45 Lecture 8: Computer Projection 4

Viewport Transform Get viewport (pixel) coordinates Viewport coordinate {0,0} is at top-left corner (0,0) X 1 (0,b-1) (a-1,0) (a-1,b-1) If the viewport is a pixels wide and b pixels high, what is the pixel coordinates for a projected point {x,y}? CSE45 Lecture 8: Computer Projection 43