Download presentation
Presentation is loading. Please wait.
Published byIsabel Robertson Modified over 9 years ago
1
Transformations: Projection CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003
2
David Luebke 2 1/24/2016 Admin ● Assn 1 due…
3
David Luebke 3 1/24/2016 Admin ● Assn 1 due… now ■ Any issues?
4
David Luebke 4 1/24/2016 Recap: 3-D Rotation Matrices ● An arbitrary rotation about A can be formed by compositing several canonical rotations together ● We can express each rotation as a matrix ● Compositing transforms == multiplying matrices ● Thus we can express the final rotation as the product of canonical rotation matrices ● Thus we can express the final rotation with a single matrix!
5
David Luebke 5 1/24/2016 Recap: Compositing Matrices ● We have the following matrices: p: The point to be rotated about A by R y : Rotate about Y by R x : Rotate about X by R z : Rotate about Z by R x -1 : Undo rotation about X by R y -1 : Undo rotation about Y by ● Thus: p’ = R y -1 R x -1 R z R x R y p
6
David Luebke 6 1/24/2016 Recap: Rotation Matrices ● Rotation matrix is orthogonal ■ Columns/rows linearly independent ■ Columns/rows sum to 1 ● The inverse of an orthogonal matrix is its transpose:
7
David Luebke 7 1/24/2016 Recap: Homogeneous Coordinates ● Homogeneous coordinates: represent coordinates in 3 dimensions with a 4-vector (Note that typically w = 1 in object coordinates)
8
David Luebke 8 1/24/2016 Recap: Homogeneous Coordinates ● Homogeneous coordinates seem unintuitive, but they make graphics operations much easier ● Our transformation matrices are now 4x4:
9
David Luebke 9 1/24/2016 Recap: Homogeneous Coordinates ● Homogeneous coordinates seem unintuitive, but they make graphics operations much easier ● Our transformation matrices are now 4x4:
10
David Luebke 10 1/24/2016 Recap: Homogeneous Coordinates ● Homogeneous coordinates seem unintuitive, but they make graphics operations much easier ● Our transformation matrices are now 4x4:
11
David Luebke 11 1/24/2016 Recap: Homogeneous Coordinates ● Homogeneous coordinates seem unintuitive, but they make graphics operations much easier ● Our transformation matrices are now 4x4:
12
David Luebke 12 1/24/2016 Recap: Homogeneous Coordinates ● Homogeneous coordinates seem unintuitive, but they make graphics operations much easier ● Our transformation matrices are now 4x4:
13
David Luebke 13 1/24/2016 Recap: Translation Matrices ● Now that we can represent translation as a matrix, we can composite it with other transformations ● Ex: rotate 90° about X, then 10 units down Z:
14
David Luebke 14 1/24/2016 Recap: Translation Matrices ● Now that we can represent translation as a matrix, we can composite it with other transformations ● Ex: rotate 90° about X, then 10 units down Z:
15
David Luebke 15 1/24/2016 Recap: Translation Matrices ● Now that we can represent translation as a matrix, we can composite it with other transformations ● Ex: rotate 90° about X, then 10 units down Z:
16
David Luebke 16 1/24/2016 Recap: Translation Matrices ● Now that we can represent translation as a matrix, we can composite it with other transformations ● Ex: rotate 90° about X, then 10 units down Z:
17
David Luebke 17 1/24/2016 More On Homogeneous Coords ● What effect does the following matrix have? ● Conceptually, the fourth coordinate w is a bit like a scale factor
18
David Luebke 18 1/24/2016 More On Homogeneous Coords ● Intuitively: ■ The w coordinate of a homogeneous point is typically 1 ■ Decreasing w makes the point “bigger”, meaning further from the origin ■ Homogeneous points with w = 0 are thus “points at infinity”, meaning infinitely far away in some direction. (What direction?) ■ To help illustrate this, imagine subtracting two homogeneous points
19
David Luebke 19 1/24/2016 Perspective Projection ● In the real world, objects exhibit perspective foreshortening: distant objects appear smaller ● The basic situation:
20
David Luebke 20 1/24/2016 Perspective Projection ● When we do 3-D graphics, we think of the screen as a 2-D window onto the 3-D world: How tall should this bunny be?
21
David Luebke 21 1/24/2016 Perspective Projection ● The geometry of the situation is that of similar triangles. View from above: ● What is x’? P (x, y, z)X Z View plane d (0,0,0) x’ = ?
22
David Luebke 22 1/24/2016 Perspective Projection ● Desired result for a point [x, y, z, 1] T projected onto the view plane: ● What could a matrix look like to do this?
23
David Luebke 23 1/24/2016 A Perspective Projection Matrix ● Answer:
24
David Luebke 24 1/24/2016 A Perspective Projection Matrix ● Example: ● Or, in 3-D coordinates:
25
David Luebke 25 1/24/2016 A Perspective Projection Matrix ● OpenGL’s gluPerspective() command generates a slightly more complicated matrix: ■ Can you figure out what this matrix does?
26
David Luebke 26 1/24/2016 Projection Matrices ● Now that we can express perspective foreshortening as a matrix, we can composite it onto our other matrices with the usual matrix multiplication ● End result: can create a single matrix encapsulating modeling, viewing, and projection transforms ■ Though you will recall that in practice OpenGL separates the modelview from projection matrix (why?)
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.