ComputerComputer GraphicsGraphics -- WeekWeek 33 Bengt-Olaf Schneider IBM T.J. Watson Research Center Questions about Last Week ? Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Overview of Week 3 Viewing transformations Projections Camera models Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 VieViewingwing Transformation Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 VieViewingwing Compared to Taking Pictures View Vector & Viewplane: Direct camera towards subject Viewpoint: Position "camera" in scene Up Vector: Level the camera Field of View: Adjust zoom Clipping: Select content Projection: Exposure Field of View Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 VieViewingwing Transformation Position and orient camera Set viewpoint, viewing direction and upvector Use geometric transformation to position camera with respect to the scene or ... scene with respect to the camera. Both approaches are mathematically equivalent. Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 VieViewingwing Pipeline and Coordinate Systems Model Modeling Transformation Coordinates (MC) Modeling Position objects in world coordinates Transformation Viewing Transformation World Coordinates (WC) Position objects in eye/camera coordinates Viewing EC a.k.a. View Reference Coordinates Transformation Eye (Viewing) Perspective Transformation Coordinates (EC) Perspective Convert view volume to a canonical view volume Transformation Also used for clipping Perspective PC a.k.a. clip coordinates Coordinates (PC) Perspective Perspective Division Division Normalized Device Perform mapping from 3D to 2D Coordinates (NDC) Viewport Mapping Viewport Mapping Map normalized device coordinates into Device window/screen coordinates Coordinates (DC) Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Why a special eye coordinate systemsystem ? In prinicipal it is possible to directly project on an arbitray viewplane. However, this is computationally very involved. Instead, the scene is transformed into special coordinate system, that makes projection easy. View down the negative z-axis Projection plane parallel to z=0 This "extra" transformation is free ! It can be combined with the modeling transformation Therefore, every point must be transformed only once. This transformation is known in OpenGL as the Model-View Matrix. Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Model, World and Eye Coordinates y 8 P = (2.00, 1.00) 7 MC P = (5.00, 4.00) y 6 MC WC P = (1.77, 12.90) x 8 5 EC 7 4 EC 8 3 6 7 5 2 P 6 4 1 5 3 x 4 1 2 3 4 5 6 7 8 2 3 y 1 2 8 7 6 1 x 5 4 WC 1 2 3 4 5 6 7 8 3 2 1 Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Computing the Viewing Transformation Changing from WC to EC is simple change of coordinate systems which can be expressed using a 4x4 matrix: PEC = M WE · PWC M WE = bWxEC WyEC WzEC Wo EC g WiEC is unit vector on the WC i-axis expressed in EC WoEC is the WC origin expressed in EC MME is the Model-View Matrix. Same approach for changing from MC to WC Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Computing the Viewing Transformation: Example T T y b1 0gWC = b0.21 -0.98g EC 8 T T PM = (2.00, 1.00) b0 1gWC = b0.98 0.21g EC 7 y PW = (5.00, 4.00) T T 6 MC 0 0 = -3.25 17.00 P = (1.77, 12.90) x b gWC b g EC 8 5 E 7 4 EC 8 3 6 7 F 0.21 0.98 -3.25I 5 2 P 6 M = G -0.98 0.21 17.00J WE G J 4 1 5 0 0 1 3 x 4 H K 1 2 3 4 5 6 7 8 2 3 1 0 3 y F I 1 2 8 7 M = G0 1 3J 6 1 MW x 5 4 WC 1 2 3 4 5 6 7 8 3 G J 2 H0 0 1K 1 F 0.21 0.98 0.32 I M = M · M = G-0.98 0.21 14.69J ME WE MW G J H 0 0 1 K F 0.21 0.98 0.32 I F2.0I F 1.72 I P = M · P = G-0.98 0.21 14.69J · G1.0J = G12.94J E ME M G J G J G J H 0 0 1 K H1.0K H 1 K Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Projection Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Projection: Overview Now, the scene is transformed to the EC system Next, the scene must be projected onto the view plane This is done in several steps Selecting the projection type Selecting center/direction of projection Computing the view volume Transforming the view volume into a canonical representation Projection onto the viewplane Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Projection: Introduction Projections map points from n dimensions to m dimensions, with m < n. Here: from 3D to 2D Points are projected along straight lines, called projectors, onto the projection plane Perspective projection: projectors go through a single point Parallel projection: projectors are parallel Projector Projector Projection Plane Projection Plane Center of Direction of Projection Projection Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Parallel Projection: Properties Objects appear at the same size irrespective of distance Lines map into lines Maintains distances but not angles Angles only maintained for lines parallel to the viewplane However, parallel lines remain parallel Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Parallel Projection: OrthographicOrthographic Projectors are perpendicular to the Top-view viewplane (Plan-view) Frequently used orthographic projections have a viewplane perpendicular to a principal axis front elevation Side-view top elevation (plan view) Front-view side elevation Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Parallel Projection: OrthographicOrthographic Axonometric orthographic projections have a viewplane that is not perpendicular to a principal axis Show more than one side Uniform foreshortening, i.e. unlike perspective projection does not depend on depth of a point Isometric projection is an axonometric projection where viewplane has same angle with all axes Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Parallel Projection: Oblique Projectors are not perpendicular to the viewplane For viewplane perpendicular to an axis Combination of plan-view projection and axonometric projection Shows faces parallel to viewplane with proper length and angles Uniform foreshortening of faces non-parallel to viewplane a Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Parallel Projection: Oblique Angle between viewplane and projectors determines foreshortening 45 degrees: Cavalier projection All axis appear at true length Easy to measure lengths, but looks unrealistic 63.4 degrees: Cabinet projection Lines perpendicular to the viewplane are shortened to half length Closer to perspective display 63.4o 1 ½ 45o 1 1 Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Perspective Projection: Properties Distant objects appear smaller than close ones Perspective foreshortening Lines map into lines Distances and angles are not maintained In particular parallel line do not remain parallel Angles are maintained only for lines parallel to the view plane Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Perspective Projections: Vanishing Points Parallel lines not parallel Vanishing to the view plane Point intersect in a single point: the vanishing point for those lines Vanishing points can be used to construct perspective drawings Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Perspective Projection: Vanishing Points Lines parallel to one of the axes converge in a principal vanishing point Number of principal vanishing points equals the number of axes intersected by the view plane. In 3D there are up to 3 prinicipal vanishing points. Most frequently used are 1 and 2 vanishing points Three vanishing points add little realism over two vanishing points Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Perspective Projection: One-point Perspective Y X Z Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Perspective Projection: 1 Vanishing Point Vanishing Point Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Perspective Projection: Two-Point Perspective Y X Z Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Perspective Projection: 2 Vanishing Points Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Perspective Projection: 3 Vanishing Points Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Projection Types: Summary Planar Geometric Projections Parallel Projections Perspective Projections One-Point Perspective Two-Point Perspective Orthographic Oblique Three-Point Perspective Axis-Parallel Cavalier Cabinet Top View Front View Side View Axonometric Dimetric Trimetric Isometric Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Projections: Mathematical Treatment How can we describe all these types of projections ? Overview: Define a suitable coordinate system Compute the mapping of points from 3-space on the viewplane Determine matrix form Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Projection: Eye Coordinate System Viewplane: z=0 Y Viewing direction down E negative z-axis Up vector: y-axis Viewing Up-Vector Direction Project onto z=0 plane XE Viewplane ZE Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Orthographic Projection Projection by "dropping" z-coordinate F1 0 0 0I G0 1 0 0J P = G J · P S G0 0 0 0J E HG0 0 0 1KJ PS = M OZ · PE Projection along other axes can be achieved similarly. This matrix will be the final part of all other projections. Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Oblique Projections: 2D Explanation Two-step process Oblique transformation Shear along the x-axis Orthographic projection along the z-axis a SH(a) a X X Z Z Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Oblique Projection: 3D Analysis Y Y b SH(a,b) b f b a X X a a 1 1 Z Z F1 0 0 0I F1 0 a 0I F1 0 a 0I G0 1 0 0J G0 1 b 0J G0 1 b 0J P = G J · G J · P = G J · P s G0 0 0 0J G0 0 1 0J E G0 0 0 0J E HG0 0 0 1KJ HG0 0 0 1KJ HG0 0 0 1KJ Ps = SH(a,b) · M OZ · PE = M ObZ · PE Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Oblique Projection: 3D Analysis (cont'd) Y Y b SH(a,b) b f b a X X a a 1 1 Z Z f = cot b (Foreshortening factor) F1 0 -a 0I F1 0 f cosa 0I G0 1 -b 0J G0 1 f sina 0J M = G J = G J ObZ G0 0 0 0J G0 0 0 0J HG0 0 0 1KJ HG0 0 0 1KJ Computer Graphics – Week 3 © Bengt-Olaf Schneider, 1999 Two-Step Process The two-step process is also used with other projections, in particular with perspective projection.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages43 Page
-
File Size-