Introduction to 3D Graphics Lecture 3: General Camera Model Anthony Steed University College London.

Slides:



Advertisements
Similar presentations
Points, Vectors, Lines, Spheres and Matrices
Advertisements

Transformations We want to be able to make changes to the image larger/smaller rotate move This can be efficiently achieved through mathematical operations.
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
2D Geometric Transformations
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
3-D Geometry.
CS 376 Introduction to Computer Graphics 02 / 26 / 2007 Instructor: Michael Eckmann.
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
Computer Graphics (Fall 2005) COMS 4160, Lecture 2: Review of Basic Math
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
CS 450: Computer Graphics 2D TRANSFORMATIONS
Lecture 7: Matrix-Vector Product; Matrix of a Linear Transformation; Matrix-Matrix Product Sections 2.1, 2.2.1,
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 2: Review of Basic Math
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices n New stuff Homogenous co-ordinates 3D transformations as matrices.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 3: Transformations 1
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Introduction to 3D Graphics Lecture 4: Scenes and Scene Graphs Anthony Steed University College London.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Transformations Dr. Amy Zhang.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Computer Graphics Bing-Yu Chen National Taiwan University.
1 Ray Tracing Polyhedra ©Anthony Steed
Mathematics for Computer Graphics. Lecture Summary Matrices  Some fundamental operations Vectors  Some fundamental operations Geometric Primitives:
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
2 COEN Computer Graphics I Evening’s Goals n Discuss the mathematical transformations that are utilized for computer graphics projection viewing.
1 General Camera ©Anthony Steed Overview n Simple camera is limiting and it is necessary to model a camera that can be moved n We will define.
Matrices A matrix is a table or array of numbers arranged in rows and columns The order of a matrix is given by stating its dimensions. This is known as.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
CS 376 Introduction to Computer Graphics 02 / 23 / 2007 Instructor: Michael Eckmann.
Introduction to 3D Graphics Lecture 2: Mathematics of the Simple Camera Anthony Steed University College London.
Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
CS 325 Introduction to Computer Graphics 02 / 26 / 2010 Instructor: Michael Eckmann.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Affine Transformations.
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other Transformations.
1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations.
Geometric Transformations
Graphics CSCI 343, Fall 2015 Lecture 16 Viewing I
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 3: Transformations 1
Computer Graphics Matrices
1 Projection: Completing the Camera Model ©Yiorgos Chrysanthou 2001, Anthony Steed
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Graphics Lecture 2: Slide 1 Lecture 2 Transformations for animation.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
Computer Graphics I, Fall 2010 Transformations.
4. Affine transformations. Reading Required:  Watt, Section 1.1. Further reading:  Foley, et al, Chapter  David F. Rogers and J. Alan Adams,
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
3D Ojbects: Transformations and Modeling. Matrix Operations Matrices have dimensions: Vectors can be thought of as matrices: v=[2,3,4,1] is a 1x4 matrix.
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
CSE 167 [Win 17], Lecture 3: Transformations 1 Ravi Ramamoorthi
Math Fundamentals Maths revisit.
Transforms.
2D Transformations with Matrices
Review: Transformations
Introduction to Computer Graphics CS 445 / 645
Review: Transformations
Points, Vectors, Lines, Spheres and Matrices
With an immediate use for it
Chapter IV Spaces and Transforms
Ray Tracing Polyhedra ©Anthony Steed
Linear Algebra A gentle introduction
Presentation transcript:

Introduction to 3D Graphics Lecture 3: General Camera Model Anthony Steed University College London

Overview n More Maths –Rotations and translations –Homogenous co-ordinates n General Camera –Specification –Mapping to world coordinates

Vectors and Matrices n Matrix is an array of numbers with dimensions M (rows) by N (columns) –3 by 6 matrix –element 2,3 is (3) is (3) n Vector can be considered a 1 x M matrix –

Types of Matrix n Identity matrices - I n Diagonal n Symmetric –Diagonal matrices are (of course) symmetric –Identity matrices are (of course) diagonal

Operation on Matrices n Addition –Done elementwise n Transpose –“Flip” (M by N becomes N by M)

Operations on Matrices n Multiplication –Only possible to multiply of dimensions n x 1 by y 1 and x 2 by y 2 iff y 1 = x 2 –resulting matrix is x 1 by y 2 n e.g. Matrix A is 2 by 3 and Matrix by 3 by 4 –resulting matrix is 2 by 4 n Just because A x B is possible doesn’t mean B x A is possible!

Matrix Multiplication Order n A is n by k, B is k by m n C = A x B defined by n BxA not necessarily equal to AxB

Example Multiplications

Inverse n If A x B = I and B x A = I then A = B -1 and B = A -1

3D Transforms n In 3-space vectors are transformed by 3 by 3 matrices

Scale n Scale uses a diagonal matrix n Scale by 2 along x and -2 along z

Rotation n Rotation about z axis n Note z values remain the same whilst x and y change Y X

Rotation X, Y and Scale n About X n About Y n Scale (should look familiar)

Homogenous Points n Add 1D, but constrain that to be equal to 1 (x,y,z,1) n Homogeneity means that any point in 3-space can be represented by an infinite variety of homogenous 4D points –( ) = ( ) = ( ) n Why? –4D allows as to include 3D translation in matrix form

Homogenous Vectors n Vectors != Points n Remember points can not be added n If A and B are points A-B is a vector n Vectors have form (x y z 0) n Addition makes sense

Translation in Homogenous Form n Note that the homogenous component is preserved (* * * 1), and aside from the translation the matrix is I

Putting it Together n R is rotation and scale components n T is translation component

Order Matters n Composition order of transforms matters –Remember that basic vectors change so “direction” of translations changed

Overview n More Maths –Rotations and translations –Homogenous co-ordinates n General Camera –Specification –Mapping to world coordinates

Simple Camera (Cross Section) Z-Z Y d COP y max y min

General Camera n View Reference Point (VRP) –where the camera is n View Plane Normal (VPN) –where the camera points n View Up Vector (VUV) –which way is up to the camera n X (or U-axis) forms LH system

UVN Co-ordindates n View Reference Point (VRP) –origin of VC system n View Plane Normal (VPN) –Z (or N-axis) of VC system n View Up Vector (VUV) –determines Y (or V-axis) of VCS n X (or U-axis) forms LH system

World Coords and Viewing Coords Y X Z V U N VUV VRP We want to find a general transform (EQ1) of the above form that will map WC to VC

View from the Camera VUV N and VPN into the page U V XY Z xmin, ymin xmax, ymax

Finding the basis vectors n Step 1 - find n n Step 2 - find u n Step 3 - find v

Finding the Mapping (1) n u,v,n must rotate under R to i,j,k of viewing space n Both basis are normalised so this is a pure rotation matrix –recall in this case R T = R -1

Finding the Mapping (2) n In uvn system VRP (q) is ( ) n And we know from EQ1 so

Complete Mapping n Complete matrix

For you to check n If n Then

Using this for Ray-Casting n Use a similar camera configuration (COP is usually, but not always on -n) n To trace object must either –transform spheres into VC –transform rays into WC

Ray-casting n Transforming rays into WC –Transform end-point once –Find direction vectors through COP as before –Transform vector by –Intersect spheres in WC

Ray-casting n Transforming spheres into VC –Centre of sphere is a point so can be transformed as usual (WC to VC) –Radius of sphere is unchanged by rotation and translation (and spheres are spheroids if there is a non-symmetric scale)

Tradeoff n If more rays than spheres do the former –transform spheres into VC n For more complex scenes e.g. with polygons –transform rays into WC

Alternative Forms of the Camera n Simple “Look At” –Give a VRP and a target (TP) –VPN = TP-VRP –VUV = (0 1 0) (i.e. “up” in WC) n Field of View –Give horizontal and vertical FOV or one or the other and an aspect ratio –Calculate viewport and proceed as before

Animated Cameras n Animate VRP (observer-cam) n Animate VPN (look around) n Animate TP (track-cam) n Animate COP –along VPN - zoom –orthogonal to VPN - distort

Summary n We set up the mathematics of transformations between co-ordinate spaces n We created a more general camera which we can use to create views of our scenes from arbitrary positions n Formulation of mapping from WC to VC (and back)