Download presentation
Presentation is loading. Please wait.
1
Viewing Viewing and viewing space (camera space)
World space to viewing space transformation
2
World to Viewing Coordinates
Graphics display devices are 2D rectangular screens. Hence we need to understand how to transform our 3D world to a 2D surface Viewing the desired scene is analogous to taking pictures using a camera We now need to world coordinates viewing VIEWING TRANSFORMATION 4 4
3
Camera Analogy View is described in terms of:
camera position in world coordinate system camera direction (viewing direction) camera orientation: usually defined by the up vector aperture size: field of view
4
View Coordinate System
specify a view reference point in the world coordinate system. This can be any point along the camera direction, or the camera position itself specify the view plane normal N - this gives the camera, or Z direction specify the view-up direction, V - this gives the camera up direction, or Y direction xW yW zW P0 N V xW yW zW P0 N xW yW zW P0 v’ v n v=v’-(v.n) n 5 5
5
Viewing Coordinate System
We can construct a vector U perpendicular to both V and N, and this will correspond to the Xv axis. How? We can define U as right, V as up, and N as towards the viewer: a right handed system UV=N We can also define U as right, V as up and N as into the scene: a left handed system VU=N, in which bigger N values mean points are further away OpenGL is right handed P0 N V U yW xW zW 8 8
6
View Coordinate System
Some systems (e.g., OpenGL) allow you to specify a ‘look at’ point, Q, from which N is calculated as the direction to the ‘look at’ point from the view reference point xW yW zW P0 Q 6 6
7
World to Viewing Objects must be viewed in the viewing space
This can be done by aligning the view coordinate system with world coordinate system, e.g., view reference point is transformed to world origin, and U, V, N are aligned with X, Y, Z directions through rotations y (x0, y0, z0) x z 9 9
8
x y z World to Viewing Translate view origin to world origin, then align U, V and N axes with X, Y and Z directions by rotation R = Rz. Ry. Rx rotate around X to bring N into the X-Z plane rotate around Y to align N with Z rotate around Z to align V with Y An easier way to work out the rotation matrix R: U in world space should be (1,0,0) in view space V should be (0,1,0) N should be (0,0,1) So we have the following equations 1. R*(Ux, Uy, Uz,1)T = (1,0,0,1) 2. R*(Vx, Vy, Vz,1)T = (0,1,0,1) 3. R*(Nx, Ny, Nz,1)T = (0,0,1,1) P0 N V U Ux Uy Uz 1 (Ux, Uy, Uz,1)T = 11 11
9
World to Viewing Transformation
Remember U.U=1, U.V=0, U.N=0, V.N=0, so if we choose the rotation matrix as The equations 1,2,3 will be satisfied The rotation matrix is a “change of basis” matrix So viewing transformation from world space to viewing space is: M = RT R =
10
What’s Pw in viewing coordinates?
x y z u v n (0,0,1) Pw=(1,1,0) Intuitively, P in viewing coordinate is (-1,1,1), but how do we derive it? 1. Translate view origin to world origin with translation vector (0, 0, -1) 2. Multiply Pw by matrix M below to align viewing axes with world axes M = So Pw in viewing space is: Pv = M T Pw u, v, n in world space: u=(-1,0,0) v=(0,1,0) n=(0,0,-1)
11
OpenGL Viewing Coordinate System
The default camera is placed at the coordinate origin of world space (U aligned with the X axis, V aligned with Y, and N aligned with Z), looking along the negative z-direction, and the view plane is perpendicular to the viewing direction xv yv zv 6
12
Projection We need to transform from a special viewing coordinate system (camera on z-axis pointing along the axis) into a projection coordinate system viewing coordinates PROJECTION TRANSFORMATION projection coordinates 3 3
13
Parallel Projection - Two types
In parallel projection, the observer position is at an infinite distance, so the projection lines are parallel Orthographic parallel projection has view plane perpendicular to direction of projection Oblique parallel projection has view plane at an oblique angle to direction of projection P1 P2 view plane 14
14
Parallel Projection Calculation
xv yv zv looking along x-axis P (x,y,z) (xp,yp,d) yV viewing space d o - zV view plane yP = y Similarly, xP = x 15
15
Parallel Projection Calculation
So x = xp y = yp z = d The projection transformation matrix is simply If view plane is xoy plane, Then d=0 xp yp d 1 d/z 0 x y z 1 = projection space projection matrix viewing space 17
16
Perspective Projection
In a perspective projection, object positions are projected onto the view plane along lines which converge at the observer, or Centre of Projection (COP) Perspective projection gives realistic views, but does not preserve proportions - projections of distant objects are smaller than projections of objects of the same size which are closer to the view plane (fore-shortening) P1 P2 P1’ P2’ view plane camera 3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.