290 likes | 516 Views
159.235 Graphics & Graphical Programming. Lecture 24 - Projections - Part 1. Projections - Outline. 3D Viewing Coordinate System & Transform Process Generalised Projections Taxonomy of Projections Perspective Projections. 3D Viewing. Inherently more complex than 2D case.
E N D
159.235 Graphics & Graphical Programming Lecture 24 - Projections - Part 1 Graphics
Projections - Outline • 3D Viewing • Coordinate System & Transform Process • Generalised Projections • Taxonomy of Projections • Perspective Projections Graphics
3D Viewing • Inherently more complex than 2D case. • Extra dimension to deal with • Most display devices are only 2D • Need to use a projection to transform 3D object or scene to 2D display device. • Need to clip against a 3D view volume. • Six planes. • View volume probably truncated pyramid Graphics
Coordinate Systems & Transform Process Object coordinate systems. Transform World coordinates. Clip View Volume Project Screen coordinates. Rasterize Raster Graphics
Generalised Projections. • Transforms points in a coordinate system of dimension n into points in one of less than n (ie 3D to 2D) • The projection is defined by straight lines called projectors. • Projectors emanate from a centre of projection, pass through every point in the object and intersect a projection surface to form the 2D projection. Graphics
Projections. • In graphics we are generally only interested in planar projections – where the projection surface is a plane. • Most cameras employ a planar film plane. • But… the retina is not a plane - future devices such as direct retina devices may need more complex projections • We will only deal with geometric projections – the projectors are straight lines. • Many projections used in cartography are either non-geometric or non-planar. • Exception – Image-based rendering - advanced topic Graphics
Projections. • Henceforth refer to planar geometric projections as just: projections. • Two classes of projections : • Perspective. • Parallel. Parallel A Parallel A A A Centre of Projection. B B B Centre of Projection at infinity B Perspective Graphics
Planar geometric projections. Parallel Perspective Orthographic Oblique 1 point Axonometric Cabinet Cavalier 2 point Isometric 3 point Elevations A Taxonomy of Projections Graphics
Perspective Projections. • Defined by projection plane and centre of projection. • Visual effect is termed perspective foreshortening. • The size of the projection of an object varies inversely with distance from the centre of projection. • Similar to a camera - Looks realistic ! • Not useful for metric information • Parallel lines do not in general project as parallel. • Angles only preserved on faces parallel to the projection plane. • Distances not preserved Graphics
Perspective The first ever painting (Trinity with the Virgin, St. John and Donors) done in perspective by Masaccio, in 1427. Graphics
Perspective Projections • A set of lines not parallel to the projection plane converge at a vanishing point. • Can be thought of in 3D as the projection of a point at infinity. • Homogeneous coordinate is 0 (x,y,0) Graphics
Perspective Projections • Lines parallel to a principal axis converge at an axis vanishing point. • Categorized according to the number of such points • Corresponds to the number of axes cut by the projection plane. y y x x z z Projection plane Graphics
1-Point Projection Projection plane cuts 1 axis only. Graphics
1-Point Perspective A painting (The Piazza of St. Mark, Venice) done by Canaletto in 1735-45 in one-point perspective Graphics
y z x Projection plane 2-Point Perspective Graphics
2-Point Perspective Painting in two point perspective by Edward Hopper The Mansard Roof 1923 (240 Kb); Watercolor on paper, 13 3/4 x 19 inches; The Brooklyn Museum, New York Graphics
y z x Projection plane 3-Point Perspective Generally held to add little beyond 2-point perspective. A painting (City Night, 1926) by Georgia O'Keefe, that is approximately in three-point perspective. Graphics
Intro to Projections -Summary • 3D Viewing • Coordinate System & Transform Process • Generalised Projections • Taxonomy of Projections • Perspective Projections Clipping can be done in image space if more efficient – application dependent. • Parallel Projections next… • Acknowledgement - Thanks to Eric McKenzie, Edinburgh, from whose Graphics Course some of these slides were adapted. Graphics
Parallel Projections • Specified by a direction to the centre of projection, rather than a point. • Centre of projection at infinity. • Orthographic • The normal to the projection plane is the same as the direction to the centre of projection. • Oblique • Directions are different. Graphics
Orthographic Projections Most common orthographic Projection : Front-elevation, Side-elevation, Plan-elevation. Angle of projection parallel to principal axis; projection plane is perpendicular to axis. Commonly used in technical drawings Graphics
Axonometric Orthographic Projections • Projection plane not normal to principal axis • Show several faces of the object at once • Foreshortening is uniform rather than being related to distance • Parallelism of lines is preserved • Angles are not • Distances can be measured along each principal axis ( with scale factors ) Graphics
Isometric Projection • Most common axonometric projection • Projection plane normal makes equal angles with each axis. • i.e normal is (dx,dy,dz), |dx| = |dy|=|dz| • Only 8 directions that satisfy this condition. Graphics
y y 120º 120º 120º x z x • All 3 axes equally foreshortened • measurements can be made • Hence the name iso-metric Projection Plane z Isometric Projection Normal Graphics
Oblique projections. • Projection plane normal differs from the direction of projection. • Usually the projection plane is normal to a principal axis. • Projection of a face parallel to this plane allows measurement of angles and distance. • Other faces can measure distance, but not angles. • Frequently used in textbooks : easy to draw ! Graphics
Oblique projection Normal Parallel to x axis y x Projection Plane z Graphics
y L.sin P´ L z P=(0,0,1) x L.cos Geometry of Oblique Projections • Projection plane is x,y plane • L=1/tan() • - angle between normal and projection direction - Determines the type of projection • is choice of horizontal angle. • Given a desired L and , • Direction of projection is • (L.cos, L.sin,-1) Graphics
Geometry of Oblique Projections • Point P=(0,0,1) maps to: P’=(l.cosa, l.sina, 0) on xy plane, and P(x,y,z) onto P’(xp,yp,0) and Graphics
Mathematics of Viewing • Need to generate the transformation matrices for perspective and parallel projections. • Should be 4x4 matrices to allow general concatenation. • And there’s still 3D clipping and more viewing stuff to look at. Graphics
Projections - Summary • Orthographic matrix - replace (z) axis with point. • Perspective matrix – multiply w by z. • Clip in homogeneous coordinates. • Preserve z for hidden surface calculations. • Can find number of vanishing points. • Acknowledgments - thanks to Eric McKenzie, Edinburgh, from whose Graphics Course some of these slides were adapted. Graphics