480 likes | 608 Views
Learn about the complexities of projecting 3D objects onto 2D display devices in computer graphics. Explore different types of projections, including perspective and parallel projections.
E N D
Computer Graphics Projections
3D Viewing • Inherently more complex than 2D case. • Most display devices are only 2D • Need to use a projection to transform 3D object or scene to 2D display device.
Jetty at Margate England, 1898. http://brightbytes.com/cosite/collection2.html (Jack and Beverly Wilgus)
Graphics Cameras • real pinhole camera: image inverted eye point image plane • computer graphics camera: convenient equivalent eye point center of projection image plane
Transformations Screen coordinates Local coordinates Projection matrix World to camera matrix Local to world matrix 07/11/2019
Projection: Mapping 3-D to 2-D • Scene models are in 3-D space and (but) images are 2-D • so need some way of projecting 3-D to 2-D • Recall, “fundamental challenge” • Planar Projection • Basic approach: • Define a plane in 3-D space • image plane (or film plane) • Project scene onto plane • Map to window viewport • Need to address two basic issues: • how to define plane • how to define mapping onto plane
Projections • Transforms points in a coordinate system of dimension n into points in one of less than n (ie 3D to 2D) • Projectors emanate from a centre of projection, pass through every point in the object and intersect a projection surface to form the 2D projection.
Projection: Essential Definitions(quick look) • Projectors • View plane (or film plane) • Direction of projection • Center of projection • Eye, viewer projection reference point
Planar Geometric Projections • Standard projections project onto a plane (the view plane) – as we’ve seen • Nonplanar projections needed for applications such as map construction • But how big is Greenland?
View Projection • We want to create a picture of the scene viewed from the camera • Two sorts of projection • Parallel projection • Perspective projection
Moving COP to Infinity • as COP moves away, lines approach parallel • when COP at infinity, orthographic view
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
Perspective projection is useful for ‘non technical’ communications Perspective renderings for marketing, etc. are readily obtained with computer-aided drawing (CAD) systems
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
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)
1-Point Projection Projection plane cuts 1 axis only.
One-point Perspective • One principal face is parallel to the projection plane
1-Point Perspective A painting (The Piazza of St. Mark, Venice) done by Canaletto in 1735-45 in one-point perspective
Two-point Perspective • One principal direction (i.e. axis) is parallel to the projection plane
y z x Projection plane 2-Point Perspective
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
Three-point Perspective • Nothing parallel to the projection plane • Usually used when looking up at or down on buildings
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.
Perspective Projection – Simplest Case Centre of projection at the origin, Projection plane at z=d. Projection Plane. y P(x,y,z) x Pp(xp,yp,d) z d
y axis P=(x, y, z) (xp, yp, zp) (xprp, yprp, zprp) View Plane z axis x axis Projection Calculations
Review: Basic Perspective Projection similar triangles P(x,y,z) y P(x’,y’,z’) z z’=d homogeneous coords
Types Of Projections • For anyone who did engineering or technical drawing
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.
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
Orthographic Projection Orthographic Projection onto a plane at z = 0. xp = x , yp = y , z = 0.
Isometric 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.
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
Orthographic Derivation • scale, translate, reflect for new coord sys
Orthographic Derivation • scale, translate, reflect for new coord sys
Orthographic Derivation • scale, translate, reflect for new coord sys
Orthographic Derivation • scale, translate, reflect for new coord sys
Orthographic OpenGL glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(left,right,bot,top,near,far);
Isometric Projections • Isometric projections have been used in computer games from the very early days of the industry up to today Q*Bert Sim City Virtual Magic Kingdom
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 !
Oblique Projection • Direction of projection is not perpendicular to the viewing plane • Most general parallel projection • Is this possible with a normal camera?
Oblique projection Normal Parallel to x axis y x Projection Plane z
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
Orthographic Examples • How would you map an arbitrary bounding volume (nearxyz, farxyz) into the volume defined by (-1, -1, -1) and (1, 1, 1)?
Quiz • I sat in the car, and realized the side mirror is 0.4m on my right and 0.3m in my front • I started my car and drove 5m forward, turned 30 degrees to right, moved 5m forward again, and turned 45 degrees to the right, and stopped • What is the position of the side mirror now, relative to where I was sitting in the beginning?