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

Similar documents
Lecture 4: Viewing. Topics:

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

Models and The Viewing Pipeline. Jian Huang CS456

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

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

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

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

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

Geometry: Outline. Projections. Orthographic Perspective

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

Prof. Feng Liu. Fall /19/2016

Lecture 4. Viewing, Projection and Viewport Transformations

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

Viewing COMPSCI 464. Image Credits: Encarta and

CS 543: Computer Graphics. Projection

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

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

CS 4731/543: Computer Graphics Lecture 5 (Part I): Projection. Emmanuel Agu

Three-Dimensional Viewing Hearn & Baker Chapter 7

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

Computer Graphics 7: Viewing in 3-D

Computer Graphics. Chapter 10 Three-Dimensional Viewing

Getting Started. Overview (1): Getting Started (1): Getting Started (2): Getting Started (3): COSC 4431/5331 Computer Graphics.

CS Computer Graphics: Transformations & The Synthetic Camera

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

CS 428: Fall Introduction to. Viewing and projective transformations. Andrew Nealen, Rutgers, /23/2009 1

CSE328 Fundamentals of Computer Graphics

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

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

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

Drawing in 3D (viewing, projection, and the rest of the pipeline)

CS 4204 Computer Graphics

Viewing/Projections III. Week 4, Wed Jan 31

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

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

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

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

CPSC 314, Midterm Exam 1. 9 Feb 2007

Game Architecture. 2/19/16: Rasterization

CSE528 Computer Graphics: Theory, Algorithms, and Applications

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

CPSC 314, Midterm Exam. 8 March 2010

Viewing/Projections IV. Week 4, Fri Feb 1

GRAFIKA KOMPUTER. ~ M. Ali Fauzi

Viewing with Computers (OpenGL)

CPSC 314, Midterm Exam. 8 March 2013

What does OpenGL do?

7. 3D Viewing. Projection: why is projection necessary? CS Dept, Univ of Kentucky

3.1 Viewing and Projection

Viewing/Projection IV. Week 4, Fri Jan 29

Overview. By end of the week:

CSC 305 The Graphics Pipeline-1

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

Movie: Geri s Game. Announcements. Ray Casting 2. Programming 2 Recap. Programming 3 Info Test data for part 1 (Lines) is available

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

Viewing. Reading: Angel Ch.5

Computer Graphics. Ch 6. 3D Viewing

Lecture 5: Viewing. CSE Computer Graphics (Fall 2010)

3D Viewing. CS 4620 Lecture 8

Viewing and Projection

Viewing and Modeling

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

Classical and Computer Viewing. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Drawing in 3D (viewing, projection, and the rest of the pipeline)

Drawing in 3D (viewing, projection, and the rest of the pipeline)

1 OpenGL - column vectors (column-major ordering)

Describe the Orthographic and Perspective projections. How do we combine together transform matrices?

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

Viewing in 3D (Chapt. 6 in FVD, Chapt. 12 in Hearn & Baker)

Perspective matrix, OpenGL style

CS 351: Perspective Viewing

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

Fundamental Types of Viewing

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

One or more objects A viewer with a projection surface Projectors that go from the object(s) to the projection surface

p =(x,y,d) y (0,0) d z Projection plane, z=d

Realtime 3D Computer Graphics & Virtual Reality. Viewing

Computer Graphics. Chapter 7 2D Geometric Transformations

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

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

3D Viewing. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 9

Rasterization Overview

Computer Graphics. Jeng-Sheng Yeh 葉正聖 Ming Chuan University (modified from Bing-Yu Chen s slides)

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

The View Frustum. Lecture 9 Sections 2.6, 5.1, 5.2. Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2011

COMP30019 Graphics and Interaction Perspective Geometry

Viewing and Projection

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

CSE452 Computer Graphics

3D Viewing Episode 2

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

Topics and things to know about them:

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

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

CITSTUDENTS.IN VIEWING. Computer Graphics and Visualization. Classical and computer viewing. Viewing with a computer. Positioning of the camera

CS354 Computer Graphics Viewing and Modeling

COMS 4160: Problems on Transformations and OpenGL

Computer Viewing Computer Graphics I, Fall 2008

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

Transcription:

Projection: Mapping 3-D to 2-D Our scene models are in 3-D space and images are 2-D so we need some wa of projecting 3-D to 2-D The fundamental approach: planar projection first, we define a plane in 3-D space this is the image plane (or film plane) then project scene onto this plane and map to the window viewport Need to address two basic issues how to define plane how to define mapping onto plane Orthographic Projection Arguabl the simplest projection image plane is perpendicular to one of the coordinate axes project onto plane b dropping that coordinate (x,, ) (x, ) or (x, ) or (, ) OpenGL glortho(left, right, bottom, top, near, far) assumes image plane perpendicular to axis in other words, it s the x-plane projects points (x,, ) (x, ) top also defines viewport mapping defines rectangle on x-plane this gets mapped to window left bottom right Perspective Projection The Canonical Camera Configuration But we naturall see things in perspective objects appear smaller the farther awa the are lenses bend (and hence focus) incoming light in orthographic projection, all ras are parallel Want to derive perspective transformation in particular, a matrix representation We ve been using pinhole camera models draw ras thru focal point and points on object some of these lines will intersect the image plane this defines our projection into 2-D all points along a ra project to same point can project lines b projecting endpoints focal point d x image plane First, we fix a canonical camera focal point at origin looking along axis image plane parallel to x plane located distance d from origin called the focal length

Effect of Perspective Projection on Points We project points thru the line connecting them to the focal point given a point, we want to know where this line hits the image plane Effect of Perspective Projection on Points We project points thru the line connecting them to the focal point given a point, we want to know where this line hits the image plane Can easil compute this using similar triangles image plane =d object point (x,, ) image point ((d/)x, (d/), d) object point (x,, ) focal point (,, ) focal point (,, ) Perspective Projection as a Transformation This homogeneous matrix performs perspective projection 1 1 P = 1 1 d It s operation on an given point is 1 x x 1 = 1 1 1 d d Perspective Projection as a Transformation This homogeneous matrix performs perspective projection 1 1 P = 1 1 d And when we do the homogeneous division d we get exactl the point we want x x onl keep x and coordinates d d d 1

Completing the Projection More Convenient Perspective Specification The image plane itself is infinite must map a rectangular region of it to the viewport defined b (left, right, top, bottom) coordinates Could alwas use glfrustum(left, right, bottom, top, near, far) this is certainl sufficient but it s inconvenient We also customaril define near & far clipping planes these are expressed as distances from the viewpoint the should alwas be positive nothing nearer than near will be drawn don t want to draw things behind the image plane nothing further than far will be drawn distance far-near should be small use fixed precision numbers to represent depth between them Generall want to use: gluperspective(fov, aspect, near, far) viewport is alwas centered about axis specifies the field of view along the axis the angle θ made b the sides of the frustum and the aspect ratio of the viewport θ this is just (width / height) OpenGL glfrustum(left, right, bottom, top, near, far) Viewing Volumes The sides of the viewport define an infinite pramid focal point at apex, extending outward through space Adding in the clipping planes, we get a truncated pramid this is called a frustum Can think of this as the viewing volume nothing outside of it is visible projection warps this to a rectangular prism Transformation for Viewing Volumes a P= b max + min max min 1 Zmax 2 max min max min -1 Zmin Z Preserves depth order 1 Z

We Need More General Cameras So far, we ve assumed a canonical camera configuration focal point at the origin image plane parallel to x-plane This is prett limited, we want greater flexibilit deriving general projection matrices is painful but we can transform world so camera is canonical tpicall called the viewing transformation Naturall, there are several was of setting this up we ll focus on the OpenGL supported mechanism the one in the book is gratuitousl complex Specifing General Camera Configurations First, we want to allow focal point to be anwhere in space call this position lookfrom, or just from Next, we need to specif the orientation of the camera define what it s pointing at: lookat lookat lookfrom will define the axis of projection define vertical axis of image: vup essentiall a twist parameter about the lookat axis Converting Camera to Canonical Form Our camera is parameteried b three vectors lookfrom, lookat, and vup We want to transform into canonical camera position 1. translate lookfrom to the origin translate b lookfrom 2. rotate lookat lookfrom to the axis Axis: Angle: u= ( lookat lookfrom) 1 θ = sin ( u / L) where L= lookat lookfrom 3. rotate about so that vup lies inside the - plane OpenGL Transformation Matrices OpenGL maintains two different matrices one to hold the camera projection matrix and one to hold everthing else select current matrix with glmatrixmode(which) which is GL_MODELVIEW or GL_PROJECTION glfrustum() and friends multipl the current matrix just like gltranslate(), glscale(), glrotate() Vertices are transformed in the following manner Model-view Projection Perspective division

OpenGL Viewing Transformations Specif camera configuration with glulookat(ex, e, e, ax, a, a, ux, u, u) Demo See Links web page for link to OpenGL tutors These are our three camera vectors lookfrom (ex, e, e) lookat (ax, a, a) vup (ux, u, u) Tpical Transformation Setup: glmatrixmode(gl_projection); glloadidentit(); gluperspective(fov, aspect, Near, Far); glmatrixmode(gl_modelview); glloadidentit(); glulookat(ex, e, e, ax, a, a,, 1, );