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

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

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

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

Geometric transformations in 3D and coordinate frames. Computer Graphics CSE 167 Lecture 3

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

Projection and viewing. Computer Graphics CSE 167 Lecture 4

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

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

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices

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

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

Viewing with Computers (OpenGL)

Geometric transformations assign a point to a point, so it is a point valued function of points. Geometric transformation may destroy the equation

GEOMETRIC TRANSFORMATIONS AND VIEWING

CSE 167: Lecture 11: Textures 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Introduction to Computer Graphics Lecture #2: Coordinate Transformations

CSE328 Fundamentals of Computer Graphics

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Viewing and Projection

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

Overview. By end of the week:

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

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

Specifying Complex Scenes

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

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

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

Perspective projection and Transformations

CV: 3D sensing and calibration

Exercise Max. Points Total 80

CSE 167: Introduction to Computer Graphics Lecture #11: Visibility Culling

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

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

Camera Model and Calibration

CMPSCI 670: Computer Vision! Image formation. University of Massachusetts, Amherst September 8, 2014 Instructor: Subhransu Maji

3.1 Viewing and Projection

COSC579: Scene Geometry. Jeremy Bolton, PhD Assistant Teaching Professor

Discriminant Functions for the Normal Density

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

Introduction to Computer Vision

Computer Graphics 7: Viewing in 3-D

Viewing and Projection

Viewing and Projection

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

Scene Modeling for a Single View

THE VIEWING TRANSFORMATION

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

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

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

CSE 167: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Camera Model and Calibration. Lecture-12

Computer Vision CS 776 Fall 2018

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

CS452/552; EE465/505. Geometry Transformations

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

Exercise Max. Points Total 90

Geometric camera models and calibration

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

CS4670: Computer Vision

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

CIS 580, Machine Perception, Spring 2016 Homework 2 Due: :59AM

Game Architecture. 2/19/16: Rasterization

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

Figure 1. Lecture 1: Three Dimensional graphics: Projections and Transformations

Computer Graphics: Viewing in 3-D. Course Website:

Models and The Viewing Pipeline. Jian Huang CS456

CSE452 Computer Graphics

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

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

Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

3D Viewing. CS 4620 Lecture 8

3D Viewing Episode 2

Prof. Feng Liu. Fall /19/2016

Chapter 5. Projections and Rendering

CIS 580, Machine Perception, Spring 2015 Homework 1 Due: :59AM

Viewing. Reading: Angel Ch.5

3D Geometry and Camera Calibration

CSC 305 The Graphics Pipeline-1

Announcements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard

Physics 1C Lecture 26A. Beginning of Chapter 26

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

CSE 252B: Computer Vision II

Announcement. Project 1 has been posted online and in dropbox. Due: 11:59:59 pm, Friday, October 14

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

CSE 167: Introduction to Computer Graphics Lecture 11: Scene Graph 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

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

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

Computer Graphics: Geometric Transformations

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

Linear and Affine Transformations Coordinate Systems

Translations. Geometric Image Transformations. Two-Dimensional Geometric Transforms. Groups and Composition

Computer Vision Projective Geometry and Calibration. Pinhole cameras

CSE 167: Introduction to Computer Graphics Lecture 12: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

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

Scene Modeling for a Single View

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

The Graphics Pipeline and OpenGL I: Transformations!

Image warping , , Computational Photography Fall 2017, Lecture 10

Shadows in Computer Graphics

Advanced Lighting Techniques Due: Monday November 2 at 10pm

Transcription:

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

Announcements Project 1 due tomorrow (Friday), presentation in CSE lab 260, starting at 1:30pm, ending no sooner than 2:15pm As soon as you get to the lab, add your name to the bottom of the list on the whiteboard. Put a * next to your name if you have class at 2pm you will get priority. Have homework assignment ready to demonstrate. Have source code on hand we might ask questions about it. Project 2 due Friday October 11 th Discussion by Krishna on Monday 3-3:50pm at Center Hall 105. 2

Lecture Overview Concatenating Transformations Coordinate Transformation Typical Coordinate Systems Projection 3

How to rotate around a Pivot Point? Rotation around origin: p = R p Rotation around pivot point: p =? 4

Video Linear Algebra applied to 3D Graphics http://www.youtube.com/watch?v=smanlptmawe 5

Rotating point p around a pivot point 1. Translation T 2. Rotation R 3. Translation T -1 p = T -1 R T p 6

Concatenating transformations Given a sequence of transformations M 3 M 2 M 1 Note: associativity applies: 7

Lecture Overview Concatenating Transformations Coordinate Transformation Typical Coordinate Systems Projection 8

Coordinate System Given point p in homogeneous coordinates: Coordinates describe the point s 3D position in a coordinate system with basis vectors x, y, z and origin o: 9

Example: Cartesian and Polar Coordinates Cartesian Coordinates Polar Coordinates Images: Wikipedia 10

Cartesian and Polar Coordinates The point s position can be expressed in cartesian coordinates [2,3] or polar coordinates [3.6, 56.31degrees] Both describe the same point! 11

Coordinate Transformation Original xyzo coordinate system New uvwq coordinate system Goal: Find coordinates of p xyz in new uvwq coordinate system 12

Coordinate Transformation Express coordinates of xyzo reference frame with respect to uvwq reference frame: 13

Coordinate Transformation Point p expressed in new uvwq reference frame: 14

Coordinate Transformation 15

Coordinate Transformation Inverse transformation Given point P uvw w.r.t. reference frame uvwq: Coordinates P xyz w.r.t. reference frame xyzo are calculated as: 16

Lecture Overview Concatenating Transformations Coordinate Transformation Typical Coordinate Systems Projection 17

Typical Coordinate Systems In computer graphics, we typically use at least three coordinate systems: World coordinate system Camera coordinate system Object coordinate system Camera coordinates Object coordinates World coordinates

World Coordinates Common reference frame for all objects in the scene No standard for coordinate system orientation If there is a ground plane, usually x/y is horizontal and z points up (height) In OpenGL x/y is screen plane, z points out of the screen Camera coordinates Object coordinates World coordinates 19

Object Coordinates Local coordinates in which points and other object geometry are given Often origin is in geometric center, on the base, or in a corner of the object Depends on how object is generated or used. Camera coordinates Object coordinates Source: http://motivate.maths.org World coordinates 20

Object Transformation The transformation from object to world coordinates is different for each object. Defines placement of object in scene. Given by model matrix (model-to-world transformation) M. Camera coordinates Object coordinates World coordinates 21

Camera Coordinate System Origin defines center of projection of camera x-y plane is parallel to image plane z-axis is perpendicular to image plane Camera coordinates Object coordinates World coordinates 22

Camera Coordinate System The Camera Matrix defines the transformation from camera to world coordinates Placement of camera in world Camera coordinates Object coordinates World coordinates 23

Camera Matrix Construct from center of projection e, look at d, upvector up: Camera coordinates 24 World coordinates

Camera Matrix Construct from center of projection e, look at d, upvector up: Camera coordinates 25 World coordinates

Camera Matrix z-axis x-axis y-axis 26

Transforming Object to Camera Coordinates Object to world coordinates: M Camera to world coordinates: C Point to transform: p Resulting transformation equation: p = C -1 M p Camera coordinates Object coordinates World coordinates 27

Tips for Notation Indicate coordinate systems with every point or matrix Point: p object Matrix: M object world Resulting transformation equation: p camera = (C camera world ) -1 M object world p object Helpful hint: in source code use consistent names Point: p_object or p_obj or p_o Matrix: object2world or obj2wld or o2w Resulting transformation equation: wld2cam = inverse(cam2wld); p_cam = p_obj * obj2wld * wld2cam; 28

Inverse of Camera Matrix How to calculate the inverse of the camera matrix C -1? Generic matrix inversion is complex and computeintensive Affine transformation matrices can be inverted more easily Observation: Camera matrix consists of rotation and translation: R x T Inverse of rotation: R -1 = R T Inverse of translation: T(t) -1 = T(-t) Inverse of camera matrix: C -1 = T -1 x R -1 29

Objects in Camera Coordinates We have things lined up the way we like them on screen x to the right y up -z into the screen Objects to look at are in front of us, i.e. have negative z values But objects are still in 3D Next step: project scene to 2D plane 30

Lecture Overview Concatenating Transformations Coordinate Transformation Typical Coordinate Systems Projection 31

Projection Goal: Given 3D points (vertices) in camera coordinates, determine corresponding image coordinates Transforming 3D points into 2D is called Projection OpenGL supports two types of projection: Orthographic Projection (=Parallel Projection) Perspective Projection 32

Orthographic Projection Can be done by ignoring z-coordinate Use camera space xy coordinates as image coordinates Project points to x-y plane along parallel lines Often used in graphical illustrations, architecture, 3D modeling 33

Perspective Projection Most common for computer graphics Simplified model of human eye, or camera lens (pinhole camera) Things farther away appear to be smaller Discovery attributed to Filippo Brunelleschi (Italian architect) in the early 1400 s 34

Pinhole Camera San Diego, May 20 th, 2012 35

Perspective Projection Project along rays that converge in center of projection Center of projection 3D scene 2D image plane 36

Perspective Projection Parallel lines are no longer parallel, converge in one point 37 Earliest example: La Trinitá (1427) by Masaccio

Video UC Berkeley Professor Ravi Ramamoorthi on Perspective Projection http://www.youtube.com/watch?v=vpnjbvzhncq 38

Perspective Projection From law of ratios in similar triangles follows: y ' y1 y = 1 y ' = d z1 z 1 d Similarly: x ' = x1d z 1 By definition: z ' = d Image plane We can express this using homogeneous coordinates and 4x4 matrices as follows 39

Perspective Projection x ' = y ' = z ' = d x1d z1 y1d z 1 Projection matrix Homogeneous division 40

Perspective Projection Projection matrix P Using projection matrix, homogeneous division seems more complicated than just multiplying all coordinates by d/z, so why do it? It will allow us to: Handle different types of projections in a unified way Define arbitrary view volumes 41