Lecture Set 11 Viewing Transformations CS5600 Computer Graphics by Rich Riesenfeld 5 March 2002 Homogeneous Coordinates An infinite number of points correspond to x y 1 They constitute the whole line tx ty t w tx ty t x y 1 w 1 y x Illustration Old Style Simple Transformation Sequence for 3D Viewing CS5600 3 Simple Viewing Transformation Example Points A B C D E F G H X 1 1 1 1 1 1 1 1 Y 1 1 1 1 1 1 1 1 Z 1 1 1 1 1 1 1 1 CS5600 4 Simple Cube Viewed from 6 8 7 5 z E 1 1 1 H 1 1 1 G 1 1 1 F 1 1 1 y D 1 1 1 A 1 1 1 C 1 1 1 x B 1 1 1 Topology of Cube A B C D E F G H A 0 1 0 1 1 0 0 0 B 1 0 1 0 0 1 0 0 C 0 1 0 1 0 0 1 0 D 1 0 1 0 0 0 0 1 E 1 0 0 0 0 1 0 1 F 0 1 0 0 1 0 1 0 G 0 0 1 0 0 1 0 1 H 0 0 0 1 1 0 1 0 CS5600 H G E F A D C B 6 Topology of Cube A B D E B A C F C B D G D A C H E A F H F B E G G C F H H D E G H G E F A D C CS5600 B 7 Simple Example Give a Cube with corners 1 1 1 View from Eye Position 6 8 7 5 Look at Origin 0 0 0 Up is in z direction CS5600 8 Translate Origin by T 1 z z z x x y x y y 6 8 0 CS5600 9 Simple Viewing Transformation Example 1 0 T1 0 0 0 1 0 0 0 6 0 8 1 7 5 0 1 CS5600 10 Build LH Coord with T 2 z y e z x e z e y x x CS5600 6 8 0 y 11 Build LH Coord with T 2 1 0 0 0 T2 0 1 0 0 CS5600 0 0 1 0 0 0 0 1 12 Rotate about y with T 3 z ze y xe 8 CS5600 x z y 10 6 x ye 6 8 0 13 Simple Viewing Transformation Example 8 0 T3 6 0 0 6 0 1 0 0 0 8 0 0 0 1 CS5600 where cos 8 10 sin 6 10 14 Rotate about x axis with T 4 z ye 7 5 y xe x z ze y 10 x CS5600 15 Look at the 3 4 5 Right Triangle 10 4 7 5 3 5 cos 4 5 12 sin 3 CS5600 5 5 16 Simple Viewing Transformation Examle 1 0 0 0 0 8 6 0 T4 0 6 8 0 0 0 0 1 where cos 4 sin 3 CS5600 5 5 17 View on 10x10 screen 20 away 20 10 30 10 CS5600 18 Map to canonical frustum 20 45 20 CS5600 19 Scale x y by 2 for normalization Will view a 20 x20 screen from 20 away Scale to standard viewing frustum 2 0 N 0 0 0 0 0 2 0 0 0 1 0 0 0 1 CS5600 20 Simple Viewing Transformation Example 1 6 72 N T4T3T2T1 48 0 1 2 0 96 64 1 6 6 0 0 CS5600 0 0 12 5 1 21 Clipping not needed so project Porthographic 1 0 0 0 0 1 0 0 0 0 0 0 CS5600 0 0 0 1 22 Transformation of Cube 1 6 72 48 0 1 2 0 96 1 6 64 6 0 0 0 1 0 1 12 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 8 0 4 2 8 0 4 2 8 0 4 2 8 0 4 1 84 3 28 1 36 0 08 1 36 0 08 1 84 3 28 12 94 11 98 13 26 14 22 11 74 10 78 12 06 13 02 1 1 1 1 1 1 1 1 CS5600 23 Cube Transformed for Viewing Pts X A 2 8 B C D E F G H 0 4 2 8 0 4 2 8 0 4 2 8 0 4 08 1 36 08 1 84 3 28 11 74 10 78 12 06 13 02 Y 1 84 3 28 1 36 Z 12 94 11 98 13 26 14 22 CS5600 24 Transformed Cube H 0 4 3 28 G 2 8 1 84 E 2 8 1 36 F 0 4 08 Pt X Y A 2 8 1 84 B 0 4 3 28 C 2 8 1 36 D 0 4 08 E 2 8 1 36 F 0 4 08 G 2 8 1 84 H 0 4 3 28 A B D E B A C F C B D G D A C H E A F H F B E G G C F H H D 25E G D 0 4 08 C 2 8 1 36 A 2 8 1 84 B 0 4 3 28 Recall mapping a b 1 1 Translate center of interval to origin a b x x 2 Normalize interval to 1 1 1 a b a b x x 2 2 b a CS5600 2 26 Recall mapping a b 1 1 Substitute x a 2 b a 2 2a a b 2 2 b a 2 b a x CS5600 2a a b 2 b a 1 2 27 Recall mapping a b 1 1 Substitute x b 2 b a 2b a b 2 2 2 b a 2 b a x CS5600 2b a b 2 b a 2 1 28 Map to the 1K x 1K screen 1 0 T 0 0 0 0 1 0 0 1 0 0 511 511 0 1 CS5600 Assume screen origin 0 0 at lower left This translates old 0 0 to center of screen 511 511 29 Map to the 1K x 1K screen 511 0 S xy 0 0 0 0 511 0 0 1 0 0 0 Proper scale factor for mapping 0 1 1 to 511 511 0 1 CS5600 30 Combine Screen Transformation 511 0 V S T xy xy 0 0 0 0 511 0 0 1 0 0 CS5600 511 511 0 1 31 For General Screen n 1 x 2 V 0 0 0 0 0 ny 1 2 0 1 0 0 CS5600 0 n n x y nx 1 2 n 1 y 2 0 1 32 Transformation to Std Clipping Frustum CS5600 33 Transforming to Std Frustum x y z x y a a b z …
View Full Document