Right-handed Coordinates System

Slides:



Advertisements
Similar presentations
Computer Graphics Lecture 8 Arbitrary Viewing II: More Projection, Clipping and Mathematics of 3D Viewing.
Advertisements

1 Computer Graphics Chapter 8 3D Transformations.
1 3D Sensing Camera Model and 3D Transformations Camera Calibration (Tsai’s Method) Depth from General Stereo (overview) Pose Estimation from 2D Images.
Objectives Derive the perspective projection matrices used for standard OpenGL projections Derive the perspective projection matrices used for standard.
Viewing Transformations
Viewing Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7 Wen-Chieh (Steve) Lin Institute of Multimedia.
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
04 – Geometric Transformations Overview Geometric Primitives –Points, Lines, Planes 2D Geometric Transformations –Translation, Rotation, Scaling, Affine,
CS 325 Introduction to Computer Graphics 02 / 17 / 2010 Instructor: Michael Eckmann.
Camera. Content Coordinate systems and transformations Viewing coordinates Coordinate transformation matrix Projections Window and viewport Acknowledgments:
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Programming 3D Applications CE Displaying Computer Graphics Week 3 Lecture 5 Bob Hobbs Faculty of Computing, Engineering and Technology Staffordshire.
CS 325 Introduction to Computer Graphics 02 / 22 / 2010 Instructor: Michael Eckmann.
CSE Real Time Rendering Week 5. Slides(Some) Courtesy – E. Angel and D. Shreiner.
2003CS Hons RW778 Graphics1 Chapter 7: Three-Dimensional Viewing Chapter 5: Camera with parallel projection Chapter 5: Camera with parallel projection.
CGPage: 1 東吳資訊管理 江清水 Computer Game : Basic 1.Computer Graphics and Its application 2.2D Coordinate Geometry 3.1 2D geometry -- points and polygons 3.2.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Jinxiang Chai CSCE 441 Computer Graphics 3-D Viewing 0.
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
Ta: Ryan Freedman Sushma Kini Chi Zhou.  Pipeline  Clipping  Transformation, homogeneous coordinates  Lighting  Perspective  Viewing.
III- 1 III 3D Transformation Homogeneous Coordinates The three dimensional point (x, y, z) is represented by the homogeneous coordinate (x, y, z, 1) In.
CS 376 Introduction to Computer Graphics 02 / 21 / 2007 Instructor: Michael Eckmann.
2D Transformation Homogenous Coordinates Scale/Rotate/Reflect/Shear: X’ = XT Translate: X’ = X + T Multiple values for the same point e.g., (2, 3, 6)
CS 376 Introduction to Computer Graphics 02 / 14 / 2007 Instructor: Michael Eckmann.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
Perspective View Volume View Volume Far Near Window Far Near Window Center of Projection Center of Projection (a) Original Orientation (b) After Transformation.
Computer Graphics Lecture 19 PROJECTIONS I Taqdees A. Siddiqi
Outline 3D Viewing Required readings: HB 10-1 to 10-10
CS552: Computer Graphics Lecture 9: Perspective Projection.
2D Geometry - points and polygons
Chapter 11 Three-Dimensional Geometric and Modeling Transformations
Three Dimensional Viewing
Visible Surface Detection
Perspective projection
Viewing Viewing and viewing space (camera space)
Computer Graphics CC416 Week 14 3D Graphics.
Geometric Transformations
Intro to 3D Graphics.
3D Viewing cgvr.korea.ac.kr.
Prof. Lizhuang Ma Shanghai Jiao Tong University
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
CSCE 441 Computer Graphics 3-D Viewing
Introduction to Computer Graphics CS 445 / 645
CSC461: Lecture 20 Parallel Projections in OpenGL
Viewing in 3D Chapter 6.
2D Transformations y y x x y x.
CENG 477 Introduction to Computer Graphics
Projections and Normalization
Three-Dimensional Graphics
CSC461: Lecture 19 Computer Viewing
WINDOWING AND CLIPPING
Three Dimensional Viewing
OpenGL 2D Viewing Pipeline
Chapter IV Spaces and Transforms
Computer Graphics Lecture 20
Planar Geometric Projection Classes
3D Sensing Camera Model and 3D Transformations
[ ] 5.2 3D Geometry We can use the way to represent 3D points
WINDOWING AND CLIPPING
Andries van Dam September 18, D Viewing III
Last Time Canonical view pipeline Projection Local Coordinate Space
3D Graphics.
Chap 3 Viewing Pipeline Reading:
Viewing (Projections)
Prof. Lizhuang Ma Shanghai Jiao Tong University
Rendering – Matrix Transformations and the Graphics Pipeline
THREE-DIMENSIONAL VIEWING
컴퓨터 그래픽스를 위한 기하학적 기초 (Line Geometry for Computer Graphics)
The Pinhole Camera Model
Presentation transcript:

Right-handed Coordinates System X Y Y X X Y Left-handed Coordinates System X Y Y X X Y We will use vight-handed Coordinates System in our class.

[ ] 5.2 3D Geometry We can use the way to represent 3D points and polyhedras as the way to represent 2D points and polygons. For example: Y X Z (0,2,0) (0,0,0) (3,0,0) (0,0,1) [ ] 0 0 0 3 0 0 0 2 0 0 0 1 represents a tetrahedron In homogenlous coordinates system represents the same tetrahedron

5.3 3D Transformations Let's discuss 3D transformations, going directly to matrix and functional forms: (1) Translation: [x' y' z' 1] = [x y z 1] * [ ] (2) Scaling: (3) Rotation: Rotating about X(Y or Z) does not change X's. The value of Y' and Z' does not depend on X. Row 4 and column 4 are always the same. The problem is to locate sin, -sin and cos.

(a) Rotate about Z: Y X Z (b) Rotate about Y: [y' z' 1] = [y z 1] *[ ] Eye [y' z' 1] = [y z 1] *[ ] cosq sinq 0 -sinq cosq 0 0 0 1 [x' y' z' 1] = [x y z 1] *[ ] cosq sinq 0 0 -sinq cosq 0 0 0 0 1 0 0 0 0 1 X X Y Z Z

[z' x' 1] = [z x 1] *[ ] [x' z' 1] = [x z 1] *[ ] cosq sinq 0 -sinq cosq 0 0 0 1 [x' z' 1] = [x z 1] *[ ] cosq -sinq 0 sinq cosq 0 0 0 1 [x' y' z' 1] = [x y z 1] *[ ] cosq 0 -sinq 0 0 1 0 0 sinq 0 cosq 0 0 0 0 1 (c) Rotate about X: X Y Z [y' z' 1] = [y z 1] *[ ] cosq sinq 0 -sinq cosq 0 0 0 1 [x' y' z' 1] = [x y z 1] *[ ] 1 0 0 0 0 cosq sinq 0 0 -sinq cosq 0 0 0 0 1

Rotate the block counterwisely p/2 Homework: Rotate the block counterwisely p/2 degree about X, Y, Z axis respectively. Find new coordinate for each vertex. Z X Y Z X Y Rotate about X (0,3,0) (1,0,0) (0,0,2) Rotate about Y Z X Y Z X Y Rotate about Z

6.1 Projection Different eye position has different view.

After the projection, the distance between your eyes and the object vertices is unknown. With the help of hidden-line removal algorithm, you can know which vertex is closer to you.

Orthgraphic Parallel Projections vs. Perspective Projections The center of projection is located at infinity and the projectors are prependicular to the projection plane . P77. Example 5.1 (2,2) (6,5) + | _ (0,0) window (1,1) (1/2,1/2) cxv = 3/4 cyv = 3/4 sxv = 1/2 syv = 1/2 cxw = 4 sxw = 4 cyw = 3.5 syw = 3 = 7/2 sxv/sxw = 1/8 syv/syw = 1/6 -cxw * 1/8 + 3/4 = 1/4 -cyw * 1/6 + 3/4 = -7/12 + 8/12 = 1/6 Mmap = [ ] 1/8 0 0 0 1/6 0 1/4 1/6 1 Perspective projections: The center of projection is located at a finite distance from the projection plane.

Orthgraphic parallel Projection : [x,y,z] [x,y,0] Y X Z P77. Example 5.1 (2,2) (6,5) + | _ (0,0) window (1,1) (1/2,1/2) cxv = 3/4 cyv = 3/4 sxv = 1/2 syv = 1/2 cxw = 4 sxw = 4 cyw = 3.5 syw = 3 = 7/2 sxv/sxw = 1/8 syv/syw = 1/6 -cxw * 1/8 + 3/4 = 1/4 -cyw * 1/6 + 3/4 = -7/12 + 8/12 = 1/6 Mmap = [ ] Projection Plane : XY-Plane (Z=0) Projector : parallel to Z axis The Problem for finding projection point are simple: project to [ x y 0 ] [ x y z ] will 1/8 0 0 0 1/6 0 1/4 1/6 1

Perspective Projection : How to get a picture? (1) Freeze the scene. (2) Freeze you head (eyes). Perspective:

What information we need to project a picture into a projection plane via perspective projection? (1) eye position (2) object position (3) picture plane Anything else? (4) Up direction

Y X Z Up1 = [ ] Up2 = [ ] Up3 = [ ] 1 1 1 P77. Example 5.1 window (2,2) (6,5) + | _ (0,0) window (1,1) (1/2,1/2) cxv = 3/4 cyv = 3/4 sxv = 1/2 syv = 1/2 cxw = 4 sxw = 4 cyw = 3.5 syw = 3 = 7/2 Z sxv/sxw = 1/8 syv/syw = 1/6 -cxw * 1/8 + 3/4 = 1/4 -cyw * 1/6 + 3/4 = -7/12 + 8/12 = 1/6 Mmap = [ ] 1/8 0 0 0 1/6 0 1/4 1/6 1 Up1 = [ ] Up2 = [ ] Up3 = [ ] 1 1 1

Consider the eye coordinate system: Projection plane: XY-plane (Z=0) Eye position: [0 0 d] Projector: the line from [x y z] to a given eye position. The problem for finding projection point becomes: Find the intersection point for projcetion plane and projector. Xe Ye Ze [x y z] [xp yp 0] [0 0 d] = Eye Position

(1) Look alone the -Xe direction: (2) Look alone the -Ye direction: Xe Ye Ze [x y z] [xp yp 0] [0 0 d] = Eye Position Ye (x,y,z) y yp Ze d -z yp : y = d : d-z yp= (d/(d-z)) * y (x,y,z) Ze Xe xp -z x d Xe Ye Ze [x y z] [xp yp 0] [0 0 d] = Eye Position xp : x = d : d-z xp= (d/(d-z)) * x

(3) Represented in matrix form : xp = (d/(d-z)) * x yp= (d/(d-z)) * y [xp yp 0 1]=[x y z 1][ ] d/(d-z) 0 0 0 0 d/(d-z) 0 0 0 0 0 0 0 0 0 1 In homogeneous coordinates system, the points [ x y z 1] and [wx wy wz w] (w*0) represents the same points. So, the point [xp yp 0 1] = [dx/(d-z) dy/(d-z) 0 1] = [x y 0 1-(z/d)] =[x y z 1][ ] 1 0 0 0 0 1 0 0 0 0 0 -1/d 0 0 0 1

(a) How to draw a 3D line into the picture plane ? (4) Questions : (a) How to draw a 3D line into the picture plane ? (b) What happens when Z (c) What about d Y [xt yt zt] [x't y't 0] . [xf yf zf] [x'f y'f 0] (2) - infinity (3) infinity X Z

. . . Exercise: (1) Draw The rectangle whose vertices are P=(10,10,-10), Q=(-10,10,-10) R=(-10,10,10), S=(10,10,10) and XY plane is projection plane, (0,0,15) is the eye position. Y P77. Example 5.1 Y (2,2) (6,5) + | _ (0,0) window (1,1) (1/2,1/2) 1 cxv = 3/4 cyv = 3/4 sxv = 1/2 syv = 1/2 Q P cxw = 4 sxw = 4 cyw = 3.5 syw = 3 = 7/2 2 4 X S R . 3 . X . sxv/sxw = 1/8 syv/syw = 1/6 -cxw * 1/8 + 3/4 = 1/4 -cyw * 1/6 + 3/4 = -7/12 + 8/12 = 1/6 Mmap = [ ] (0,0,5) Z (0,0,15) 1/8 0 0 0 1/6 0 1/4 1/6 1

. . . (2) Move your eye from (0,0,15) to ((0,0,15), what you will see? Q P 2 4 S R 3 P77. Example 5.1 . . X X . (0,0,5) Z (2,2) (6,5) + | _ (0,0) window (0,0,15) (1,1) (1/2,1/2) cxv = 3/4 cyv = 3/4 sxv = 1/2 syv = 1/2 cxw = 4 sxw = 4 cyw = 3.5 syw = 3 = 7/2 sxv/sxw = 1/8 syv/syw = 1/6 -cxw * 1/8 + 3/4 = 1/4 -cyw * 1/6 + 3/4 = -7/12 + 8/12 = 1/6 Mmap = [ ] 1/8 0 0 0 1/6 0 1/4 1/6 1

(d) How about z > d (i.e., point is behind the eye) ? (e) How about z d (i.e., point is near the eye) ? X Y Z Y Y X X Z Z

In general, we may want to observe object from some other position (in 6.2 View Transformation In general, we may want to observe object from some other position (in stead of (0,0,d)) and direction (in stead of - Ze), say from point (xf , yf ,zf ) to point (xt ,yt ,zt ). Notice that the world data and view vector now are given in world coordinates, not eye coordinates. Yw (Xf ,Yf ,Zf ) view (Xt ,Yt ,Zt ) vector Xw world data representing object Zw

We must transform the object data from world coordinates into eye coordinates before we can perform orthographic parallel or perspective projection . This transformation called viewing transformation. Where is the eye coordinate system? We make the arbitrary Ye (Up direction) which perpedicular to Ze Ye Yw Xe Ze Xw world data Zw

We want a "neat" viewing transformation, V, such that [xe ye ze 1] = [xw yw zw 1] * V i.e., multiply all world points by V and it will be just as if the eye was at (0,0,d) or (0,0, ), depend on perspeative or orthographic parallel projection, looking at (0,0,0). Visualize the process as transforming the Ze and Ye axes to Zw and Yw axes. This is accomplished using four basic transformations: 1. Translate the vector so that (xt , yt , zt ) = (0, 0, 0). 2. Rotate the result so that the transformed (xf , yf , zf )' swings into the Yw-Zw plane. 3. Rotate the result so that (xf , yf , zf )'' swings down onto the Zw axis. 4. Rotate this result so that Ye swings down onto the Yw axis.

Step 1. The first step is just a simple translation. Yw Ye Xe Ze Xw Zw T1 = = [ ]

Step 2. Rotate a degrees about Yw to swing eye' into the Yw-Zw plane. tan(2p- a)=X'/Z'=tan(- a) a = Check the sign (check rotation direction) Step 3. Swing eye'' down by b degrees to (0,0,d) by rotating eye'' about Xw. b = Yw eye'' eye' b Xw a Zw

Step 4. Rotate Xe about Zw q degrees. (asswne Xe = (X3, Y3, 0)) Now, the eye coordinate system and world coordinate system are shown in the following picture. Step 4. Rotate Xe about Zw q degrees. (asswne Xe = (X3, Y3, 0)) q = -tan-1 Y3'/X3' Yw Ye Xe q q Xw Ze Zw

Our transformation equation becomes: [xe ye ze 1] = [xw yw zw 1] T1 R2 R3 R4 To check your transformatios, try: eye = (0,1,0) aim = (0,0,0) Ye = (1,0,0) Xw Yw Zw (0,1,0)w (1,0,0)w (0,0,1)w Ze Ye Xe

Try again with Ye = (0,0,1) and other values are the same. Homework: Try again with Ye = (0,0,1) and other values are the same. P77. Example 5.1 Yw (2,2) (6,5) + | _ (0,0) window (1,1) (1/2,1/2) cxv = 3/4 cyv = 3/4 sxv = 1/2 syv = 1/2 cxw = 4 sxw = 4 cyw = 3.5 syw = 3 = 7/2 (0,1,0)w (0,0,1)e sxv/sxw = 1/8 syv/syw = 1/6 -cxw * 1/8 + 3/4 = 1/4 -cyw * 1/6 + 3/4 = -7/12 + 8/12 = 1/6 Mmap = [ ] (0,0,0)w (0,0,0)e 1/8 0 0 0 1/6 0 1/4 1/6 1 Xw (1,0,0)w (-1,0,0)e (0,0,1)w (0,1,0)e Zw

(1) A front clipping plane at z=zfront 6.3 View Volume We saw that as z -> d, severe distortion occures, like a "fisheye" lens. Also, data far from the observer (z << 0) becomes dots! To eliminate these effects, we'll introduce two clipping planes, parallel to the Xe-Ye plane: (1) A front clipping plane at z=zfront (2) A back clipping plane at z=zback This creates a viewing volume, which is a pyramid, and is now a 6-sided frustum. Ye Back Clipping Plane Xe Ze Projection Plane Front Clipping Plane

Now the full clipping procedure becomes: 6.3 Z-Clipping Now the full clipping procedure becomes: (1) Clip on front and back planes. (2) Perspective projection to 2D window. (3) Clip on the 2D window. To determine the visibility of a point P(x,y,z), just test its z value: If ((z > zfront) or (z<zback)) then "Invisible", else "Visible". (1) Under what conditions that a line segment will not be clipped? P1 = (X1, Y1, Z1) P2 = (X2, Y2, Z2) Zback Z1, Z2 Zfront (2) How to clip a line segment using Z-clipping? (1) Z = Z1 + (Z2-Z1)t (2)replace Z = Zfront or Zend , find t (3)find (X Y Z) = (X1 Y1 Z1) + t(X2-X1, Y2-Y1, Z2-Z1)

Three types of perspective projections: (1) one-point (2) two-point (3) three-point