The View Matrix Lecture 20 Mon, Oct 24, 2005.

Slides:



Advertisements
Similar presentations
3D Transformations Assist. Prof. Dr. Ahmet Sayar
Advertisements

Computer Graphics: 3D Transformations
2D Geometric Transformations
This terms course Last term we both worked on learning 2 things –Processing –The concepts of graphics etc. This term will focus more on the basic concepts.
2 COEN Computer Graphics I Evening’s Goals n Discuss the fundamentals of lighting in computer graphics n Analyze OpenGL’s lighting model n Show.
Lecture 4: 3D Rendering Pipeline (I) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.
Basic mathematics for geometric modeling. Coordinate Reference Frames Cartesian Coordinate (2D) Polar coordinate x y (x, y) r 
Representation CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Introduction to 3D viewing 3D is just like taking a photograph!
III. Multi-Dimensional Random Variables and Application in Vector Quantization.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
TWO DIMENSIONAL GEOMETRIC TRANSFORMATIONS CA 302 Computer Graphics and Visual Programming Aydın Öztürk
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
2D Transformations.
Course 12 Calibration. 1.Introduction In theoretic discussions, we have assumed: Camera is located at the origin of coordinate system of scene.
2003CS Hons RW778 Graphics1 Chapter 5: Transforming Objects 5.2 Introduction to Transformations 5.2 Introduction to Transformations –Affine transformations.
Shadows via Projection Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 5, 2003.
Exam Review Questions. Problem: A cube has vertices with world coordinates: (1, 0, 0) (2, 0, 0) (1, 1, 0) (2, 1, 0) (1, 0, 1) (2, 0, 1) (1, 1, 1) (2,
Transformations of Objects – 3D
The View Matrix Lecture 21 Fri, Oct 17, The View Matrix The function gluLookAt() creates a matrix representing the transformation from world coordinates.
1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations.
Geometric Transformations
III. Multi-Dimensional Random Variables and Application in Vector Quantization.
CSCI480/582 Lecture 8 Chap.2.1 Principles of Key-framing Techniques Feb, 9, 2009.
Graphics CSCI 343, Fall 2015 Lecture 16 Viewing I
Composite 3D Transformations. Example of Composite 3D Transformations Try to transform the line segments P 1 P 2 and P 1 P 3 from their start position.
Introduction to Computer Graphics: Viewing Transformations Rama C
Projectile Motion Projectiles at an Angle. Last lecture, we discussed projectiles launched horizontally. Horizontal projectiles are just one type of projectile.
1 Representation. 2 Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames.
Composing Transformations
CS 4731: Computer Graphics Lecture 12: More 3D Viewing Emmanuel Agu.
OpenGL and You I Cast, Therefore I Am. Ray Casting Idea is simple, implementation takes some work –Cast rays as if you were the camera –Determine intersection.
1 Dr. Scott Schaefer 3D Transformations. 2/149 Review – Vector Operations Dot Product.
 A vector is a mathematical object that has both magnitude (size) and direction  Students will be able to use basic vector operations and the dot product.
Transformations in 3D Lecture 17 Mon, Oct 6, 2003.
End effector End effector - the last coordinate system of figure Located in joint N. But usually, we want to specify it in base coordinates. 1.
Vectors – The Cross Product Lecture 13 Wed, Sep 24, 2003.
Coordinate Systems Lecture 20 Wed, Oct 15, Object Coordinates Each object has its own “local” coordinate system, called object coordinates. Normally.
Building a Camera in a Program Need: To have fine control over camera movements we create and manipulate our own camera in a program Steps: 1.Create Camera.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
Vectors – The Dot Product Lecture 12 Mon, Sep 22, 2003.
The three basis vectors are mutually perpendicular.
University of North Carolina at Greensboro
Modeling Transformations
Lecture 10 Geometric Transformations In 3D(Three- Dimensional)
Viewing Viewing and viewing space (camera space)
Computer Graphics CC416 Week 14 3D Graphics.
Review: 3D Transforms Continued
3D Geometric Transformation
Dr. Venkat Kaushik Phys 211, Lecture 4, Sep 01, 2015
Lecture Rigid Body Dynamics.
Vectors Vector: a quantity that has both magnitude (size) and direction Examples: displacement, velocity, acceleration Scalar: a quantity that has no.
A Camera Class for OpenGL
Basic Coordinate Systems & VR
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
3D Transformation Pipeline
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
Computer Graphics : Viewing in 3D_4
FP1 Matrices Transformations
Homogeneous Transformation Matrices
Computing the velocity field
Three-Dimensional viewing
The height of the building
Viewing and Perspective Transformations
Projection in 3-D Glenn G. Chappell
The Modelview Matrix Lecture 8 Mon, Sep 10, 2007.
Creating Meshes Through Functions
The View Frustum Lecture 10 Fri, Sep 14, 2007.
Displacement, speed, velocity, acceleration and momentum
Presentation transcript:

The View Matrix Lecture 20 Mon, Oct 24, 2005

The View Matrix The view matrix is the matrix that transforms the world coordinates into the camera coordinates. For this reason, gluLookAt() should be called before the model transformations, such as rotating or translating individual objects, so that it will affect the entire scene.

The View Matrix The function gluLookAt() creates the view matrix and multiplies it by the current matrix on the modelview stack. The parameters to gluLookAt() are The eye point E, The look point L, The up vector up.

The uvn Camera Coordinate System In the camera coordinate system, the camera is Located at the origin Looking in the negative z-direction. Let the vectors u, v, and n be unit vectors in the x-, y-, and z-directions in the camera coordinate system. We will calculate u, v, and n from E, L, and up.

The Eye Coordinate System Let E be the eye position, L the look point, and up the up vector. up E L

The Eye Coordinate System Define N = E – L and n = N/|N|. E L up n N

The Eye Coordinate System The vector u must be perpendicular (and to the right) of n. Define U = up  n and u = U/|U|. up E L n u

The Eye Coordinate System We cannot assume that up is perpendicular to n. Therefore, let v be the unit vector v = n  u. up E L n u v

The View Matrix The coordinate system of the camera is determined by u, v, and n. The view matrix V must transform u, v, n into i, j, k: Vu = i Vv = j Vn = k

The View Matrix Therefore, the view matrix will be of the form ux uy uz a vx vy vz b nx ny nz c 1 V = for some values of a, b, and c.

The View Matrix To determine a, b, and c, use that fact that V also transforms E to the origin: VE = O. Thus, a = -(uxex + uyey + uzez) = -u  e b = -(vxex + vyey + vzez) = -v  e c = -(nxex + nyey + nzez) = -n  e where e = E – O.

The View Matrix Therefore, the matrix created by gluLookAt() is ux uy uz -u  e vx vy vz -v  e nx ny nz -n  e 1 V =

The View Matrix Verify that V transforms the points E  (0, 0, 0) = O E + u  (1, 0, 0) = i E + v  (0, 1, 0) = j E + n  (0, 0, 1) = k

Example Let E = (10, 5, 5), L = (0, 5, 0), and up = (1, 1, 0). Then N = E – L = (10, 0, 5). n = N/|N| = (2, 0, 1)/5. U = up  n = (1, -1, -2)/5. u = U/|U| = (1, -1, -2)/6. v = n  u = (1, 5, -2)/30.

Example Also e = E – O = (10, 5, 5). -e  u = -5/6. -e  v = 25/30. -e  n = 25/5.

Example Therefore, the view matrix is V = 1/6 -1/6 -2/6 -5/6 1/30 5/30 -2/30 25/30 2/5 0/5 1/5 25/5 1 V =

Example Read Run

Flying the Camera – Constant Speed Read Run

Flying the Camera – Acceleration Read Run

The Camera Class camera.h camera.cpp