THE CAMERA TRANSFORM

Similar documents
THE VIEWING TRANSFORMATION

On-Line Computer Graphics Notes CLIPPING

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

RASTERIZING POLYGONS IN IMAGE SPACE

CT5510: Computer Graphics. Transformation BOCHANG MOON

THE DEPTH-BUFFER VISIBLE SURFACE ALGORITHM

SPLITTING THE CUBIC UNIFORM B-SPLINE CURVE

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

CSE452 Computer Graphics

Rational Numbers: Graphing: The Coordinate Plane

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Visualisation Pipeline : The Virtual Camera

Lecture 4. Viewing, Projection and Viewport Transformations

A MATRIX FORMULATION OF THE CUBIC BÉZIER CURVE

QUADRATIC UNIFORM B-SPLINE CURVE REFINEMENT

1 OpenGL - column vectors (column-major ordering)

The points (2, 2, 1) and (0, 1, 2) are graphed below in 3-space:

Math 7 Glossary Terms

CSE328 Fundamentals of Computer Graphics

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

Three-Dimensional Viewing Hearn & Baker Chapter 7

Problem 2. Problem 3. Perform, if possible, each matrix-vector multiplication. Answer. 3. Not defined. Solve this matrix equation.

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

UNIT 2 2D TRANSFORMATIONS

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

EECS 487, Fall 2005 Exam 2

Object Representation Affine Transforms. Polygonal Representation. Polygonal Representation. Polygonal Representation of Objects

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

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

Alaska Mathematics Standards Vocabulary Word List Grade 7

Planar homographies. Can we reconstruct another view from one image? vgg/projects/singleview/

CS 4204 Computer Graphics

Computer Graphics 7: Viewing in 3-D

Viewing. Reading: Angel Ch.5

Cylinders and Quadric Surfaces A cylinder is a three dimensional shape that is determined by

3D Computer Graphics. Jared Kirschner. November 8, 2010

Raycasting. Chapter Raycasting foundations. When you look at an object, like the ball in the picture to the left, what do

ECS 178 Course Notes REFINEMENT

Viewing with Computers (OpenGL)

Geometry for Computer Graphics Part 1

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

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

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

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

Models and The Viewing Pipeline. Jian Huang CS456

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

TRANSFORMATIONS AND CONGRUENCE

Module 6: Pinhole camera model Lecture 32: Coordinate system conversion, Changing the image/world coordinate system

Review Exercise. 1. Determine vector and parametric equations of the plane that contains the

Overview. By end of the week:

CS 130 Final. Fall 2015

Section 12.1 Translations and Rotations

Chapter 5. Projections and Rendering

Creating Mercator s Map Projection

Parallel and perspective projections such as used in representing 3d images.

Chapter 1. Linear Equations and Straight Lines. 2 of 71. Copyright 2014, 2010, 2007 Pearson Education, Inc.

CSAP Achievement Levels Mathematics Grade 6 March, 2006

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th

4.5 VISIBLE SURFACE DETECTION METHODES

Interactive Math Glossary Terms and Definitions

Multiply using the grid method.

2D and 3D Transformations AUI Course Denbigh Starkey

3D Mathematics. Co-ordinate systems, 3D primitives and affine transformations

3D Viewing Episode 2

Shadows in Computer Graphics

Chapter 8 Three-Dimensional Viewing Operations

Example 1: Give the coordinates of the points on the graph.

Minimum-Volume Box Containing a Set of Points

Three Dimensional Geometry. Linear Programming

Analytic Geometry Vocabulary Cards and Word Walls Important Notes for Teachers:

On-Line Geometric Modeling Notes REFINEMENT

Homework #1. Displays, Alpha Compositing, Image Processing, Affine Transformations, Hierarchical Modeling

Computer Graphics II

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

Midterm Exam CS 184: Foundations of Computer Graphics page 1 of 11

Last week. Machiraju/Zhang/Möller

K-5 Mathematics Missouri Learning Standards: Grade-Level Expectations

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

Specifying Complex Scenes

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

Section Graphs and Lines

Learning Log Title: CHAPTER 3: PORTIONS AND INTEGERS. Date: Lesson: Chapter 3: Portions and Integers

Interesting Application. Linear Algebra

Answers to practice questions for Midterm 1

Standard 1 Students will expand number sense to include integers and perform operations with whole numbers, simple fractions, and decimals.

Basics of Computational Geometry

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

x ~ Hemispheric Lighting

Number/Computation. addend Any number being added. digit Any one of the ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9

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

9. Visible-Surface Detection Methods

SNAP Centre Workshop. Graphing Lines

Computer Graphics. Ch 6. 3D Viewing

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

Lecture No Perspective Transformation (course: Computer Vision)

Reflections, Translations, and Dilations

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

Area. Angle where two rays. Acute angle. Addend. a number to be added. an angle measuring less than 90 degrees. or line segments share an endpoint

Graphics (INFOGR ): Example Exam

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

Transcription:

On-Line Computer Graphics Notes THE CAMERA TRANSFORM Kenneth I. Joy Visualization and Graphics Research Group Department of Computer Science University of California, Davis Overview To understanding the rendering process, you must master the procedure that specifies a camera and then constructs a transformation that projects a three-dimensional scene onto a two-dimensional screen. This procedure has two several components: First, the specification of a camera model; second, the conversion of the scene s coordinates from Cartesian space to the space of the camera; and finally the specification of a viewing transformation that projects that scene into image space The Camera Model We specify our initial camera model by identifying the following parameters. 1. A scene, consisting of polygonal elements each represented by their vertices, 2. A point that represents the camera position C = (x c, y c, z c ), 3. A point that represents the center-of-attention of the camera (i.e. where the camera is looking) A = (x a, y a, z a ), 4. A field-of-view angle, α, representing the angle subtended at the apex of the viewing pyramid. 5. The specification of near and far bounding planes. These planes considered perpendicular to the direction-of-view vector at a distance of n and f from the camera, respectively.

far plane near plane The specification of C, A and α forms a viewing volume in the shape of a pyramid with the camera position C at the apex of the pyramid and the vector A C forming the axis of the pyramid. This pyramid is commonly referred to as the viewing pyramid. The specification of the near and far planes forms a truncated viewing pyramid which gives the region of space which contains the primary portion of the scene to be viewed 1. The viewing transform, transforms this truncated pyramid onto the image space volume 1 x, y, z 1. The Camera Transform Given the definition of a camera (C, A, α, n, f), the camera transformation is a combination of a transform that first converts the coordinates of the Cartesian frame to the local coordinates of the camera s frame, 1 We note that objects may extend outside the trunchated pyramid. In many situations polygons will lie between the near plane and the camera, or, in the distance beyond the far plane. 2

far plane near plane and second, applies the viewing transform. These two transformations are usually multiplied together to form a single 4 4 matrix that is applied to all points of the scene. Defining a Frame at the Camera Position The main idea here is to define a frame at the camera position. Given such a frame F camera = ( u, v, w, C), we generate a transformation that converts the Cartesian Frame coordinates to the camera s frame. To define a frame at the camera position is easy and there are actually an number of ways of doing this. One of the vectors is obvious that is, we want w = C A C A (the transformed camera should be looking along the negative w axis). In order to define the other vectors that make up the frame, we must make an assumption. We assume that the vertical direction of the camera must be in the plane defined by w and the vector y =< 0, 1, 0 >. This frequently happens when you are taking a picture, if you think about it and it actually fairly easy 3

to arrange. See the following figure for an illustration of this process. In the figure, the dotted line is the direction of view, and should be placed on the negative z axis by the transformation. To define u and v we utilize the following steps define u = y w y w, define v = w u. This insures that v is in the y- w plane. This also insures that the vectors are all unit vectors, and that they are mutually perpendicular. We note that this works well, except when you wish to have the camera look in the direction < 0, 1, 0 > or < 0, 1, 0 >. In these cases, either y = w or y = w and y w = 0, and we cannot calculate a frame in this manner. However, we can utilize another vector as the up direction to utilize with w to obtain u. Calculating the Matrix To calculate the actual matrix that implements the transformation, we can write each of the vectors < 1, 0, 0 >, < 0, 1, 0 > and < 0, 0, 1 > as a linear combination of u, v, and w (Since the vectors defining F camera are linearly independent). In addition, we can write the vector (0, 0, 0) C as a linear combination of u, v and w. Thus we can calculate the values e i,j, where < 1, 0, 0 > = e 1,1 u + e 1,2 v + e 1,3 w < 0, 1, 0 > = e 2,1 u + e 2,2 v + e 2,3 w < 0, 0, 1 > = e 3,1 u + e 3,2 v + e 3,3 w (0, 0, 0) = e 4,1 u + e 4,2 v + e 4,3 w + C 4

These equations can be solved by Cramers Rule,: To obtain < 1, 0, 0 >= e 1,1 u + e 1,2 v + e 1,3 w, we have e 1,1 = e 1,2 = e 1,3 = (< 1, 0, 0 > v) w, ( u < 1, 0, 0 >) w, and ( u v) < 1, 0, 0 > To obtain < 0, 1, 0 >= e 2,1 u + e 2,2 v + e 2,3 w, we have (< 0, 1, 0 > v) w e 2,1 =, ( u < 0, 1, 0 >) w e 2,2 =, and ( u v) < 0, 1, 0 > e 2,3 = And to obtain < 0, 0, 1 >= e 3,1 u + e 3,2 v + e 3,3 w, we have In addition, if t = (0, 0, 0) C, then we have to get t = e 4,1 u + e 4,2 v + e 4,3 w. (< 0, 0, 1 > v) w e 3,1 =, ( u < 0, 0, 1 >) w e 3,2 =, and ( u v) < 0, 0, 1 > e 3,3 = e 4,1 = ( t v) w, e 4,2 = ( u t) w, and e 4,3 = ( u v) t The matrix that convets the coordinates of objects in the frame F camera into coordinates for the frame 5

F C is given by e 1,1 e 1,2 e 1,3 0 e 2,1 e 2,2 e 2,3 0 e 3,1 e 3,2 e 3,3 0 e 4,1 e 4,2 e 4,3 1 Any point P = (x, y, z) can be written in the frame F C by < 1, 0, 0 > [ ] < 0, 1, 0 > x y z 1 < 0, 0, 1 > (0, 0, 0) But by the above calculations this is equal to [ x y z 1 ] e 1,1 e 1,2 e 1,3 0 e 2,1 e 2,2 e 2,3 0 e 3,1 e 3,2 e 3,3 0 e 4,1 e 4,2 e 4,3 1 u v w C which implies that the coordinate [ x y z 1 ] e 1,1 e 1,2 e 1,3 0 e 2,1 e 2,2 e 2,3 0 e 3,1 e 3,2 e 3,3 0 e 4,1 e 4,2 e 4,3 1 is the coordinate of the point in the frame F camera. We note, that by our construction, the frame F camera is an orthonormal frame (all vectors are unit vectors and are mutually perpendicular) and in this case the equations above simplify tremendously. In particular, 6

all the denominators u ( v w) = 1, and we can simplify the numerators utilizing the identities u v = w v w = u w u = v to obtain e 1,1 = u < 1, 0, 0 > e 1,2 = v < 1, 0, 0 > e 1,3 = w < 1, 0, 0 > e 2,1 = u < 0, 1, 0 > e 2,2 = v < 0, 1, 0 > e 2,3 = w < 0, 1, 0 > e 3,1 = u < 0, 0, 1 > e 3,2 = v < 0, 0, 1 > e 3,3 = w < 0, 0, 1 > e 4,1 = u t e 4,2 = v t e 4,3 = w t The first few of these are extremely simple, as, for example u < 1, 0, 0 > is just the first coordinate of u, etc. Overview The camera transform is a Cartesian-frame-to-frame transform. This is combined with the viewing transform to give a transformation that converts a scene into image space. 7

All contents copyright (c) 1996, 1997, 1998, 1999 Computer Science Department, University of California, Davis All rights reserved. 8