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 stand at p and look through hole. anything in cone visible shrink hole to a point, cone collapses to line (ray) eye point center of projection image plane
Transformations Screen coordinates Local coordinates Projection matrix World to camera matrix Local to world matrix 28/04/2017
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. Projections are core to the course. 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
Remember The Big Idea
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
2-Point Perspective y z x Projection plane
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
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. y z x Projection plane
3 points
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
Projection Calculations x axis y axis z axis P=(x, y, z) (xprp, yprp, zprp) (xp, yp, zp) View Plane
Review: Basic Perspective Projection similar triangles y P(x,y,z) P(x’,y’,z’) z z’=d homogeneous coords
Perspective Projection Important to understand the assumptions we made to derive this.
Perspective Projection
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.
Isometric Projection All 3 axes equally foreshortened z y Projection Plane 120º All 3 axes equally foreshortened measurements can be made Hence the name iso-metric 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)? (1) Scale and translate. First translate the center of AABB to 0, 0, 0; then scale by 2 / (near - far)
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?