
Planar Geometric Projections Planar ⩴ project onto a plane (vs. planetarium, e.g.) Geometric ⩴ projectors are straight lines EECS 487: Interactive (vs. curved lines in cartography, e.g.) Computer Graphics Projection ⩴ map from n to n-1 dimensions Lecture 13: Euclidean geometry describes shapes “as they are” • Planar Geometric Projections • properties of objects that are unchanged • Orthographic projection by rigid motions: lengths, angles, parallel lines • Perspective projection Projective geometry describes objects “as they appear” • Projections in OpenGL • lengths, angles, parallel lines become “distorted” when we look at objects Projection System Taxonomy of Common elements: Planar Geometric Projections • Center of Projection (COP) Planar Geometric Projections (for perspective projection)/ Direction of Projection (DOP) (for parallel projection, ≈COP at ∞) Perspective Parallel • Projection/view/picture/image plane (PP) Projection Projection • Projectors/sightlines One-point Oblique Orthographic Parallel Two-point Cavalier Axonometric Multiview Three-point Cabinet Isometric top, bottom, General front, back, Dimetric left, right Parallel Perspective Trimetric Lozano-Perez01 Perspective Multiview Axonometric Orthographic Orthographic Axonometric: • projection plane is not parallel to any coordinate plane • projection direction perpendicular to projection plane Isometric: • preserves lengths 3 • projection plane parallel to one along principal axes coordinate plane (project onto • principal axes make the same angle with plane by dropping coordinate • preserves ratios, each other (120º) perpendicular to plane) but not angles ( not visible) • projection direction perpendicular • parallel lines remain parallel to projection plane is considered 120º 120º • good for exact measurements an affine transform (CAD, architecture) 120º James07 Parallel Orthographic Projections Orthographic Projection View volume defined by left, right, bottom, top, near, and far planes: ⎡ 1 0 0 ⎤ ⎢ ⎥ P = ⎢ 0 1 0 ⎥ ⎢ 0 0 0 ⎥ ⎣ ⎦ Are we done? Yes, but we’ve lost depth (z) information, can’t do: Map it to cvv: • hidden surface removal • lighting, etc. Need to preserve z dimension! map view volume to canonical view volume Akenine-Möller & Haines 02 Shirley02 Orthographic Projection Setup Orthographic Projection From an arbitrary axis-aligned Simple case: view volume axis-aligned with world bounding box to canonical view volume coordinate system • translate and scale: • the view volume is in negative z, n > f More generally, the view RTR3 volume is not axis-aligned What would the T and S matrices be? ⎡ 2 l + r ⎤ ⎡ 2 ⎤ ⎡ l + r ⎤ with world CS (it will always ⎢ 0 0 − ⎥ ⎢ 0 0 0 ⎥ 1 0 0 − r − l r − l r − l ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ 2 ⎥ be axis-aligned with eye CS): ⎢ 2 b + t ⎥ ⎢ 2 ⎥ 0 0 − 0 0 0 ⎢ b + t ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ 0 1 0 − ⎥ Po = ST = t − b t − b S = t − b T = 2 ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ 2 n + f ⎥ ⎢ 2 ⎥ n + f 0 0 − 0 0 0 ⎢ 0 0 1 − ⎥ ⎢ n − f n − f ⎥ ⎢ n − f ⎥ ⎢ 2 ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣⎢ 0 0 0 1 ⎦⎥ ⎣⎢ 0 0 0 1 ⎦⎥ ⎣ 0 0 0 1 ⎦ Shirley02 Orthographic Projection and Perspective Projection Viewing Transform Objects appear smaller as distance from From an arbitrary viewing center of projection (eye of observer) increases volume to canonical view volume (perspective foreshortening) ⇒ looks more realistic • translate eye to origin (human eyes naturally see things in perspective) • transform to eye coordinate system • apply orthographic projection Preserves: • lines (collinearity) M = • world −>canonical incidence ⎡ 2 l + r ⎤ (“lies on”, intersects) ⎢ 0 0 − ⎥ r − l r − l ⎡ ⎤ ⎡ ⎤ • cross ratio ⎢ ⎥ ux uy uz 0 1 0 0 −ex ⎢ 2 b + t ⎥ ⎢ ⎥ ⎢ ⎥ 0 0 v v v 0 0 1 0 −e ⎢ − ⎥ ⎢ x y z ⎥ ⎢ y ⎥ Does not always preserve parallel lines: t − b t − b ⎢ ⎥ ⎢ ⎥ w w w 0 ⎢ 0 0 1 −e ⎥ ⎢ 2 n + f ⎥ ⎢ x y z ⎥ ⎢ z ⎥ • lines parallel to projection plane remain parallel 0 0 − ⎢ ⎥ ⎢ ⎥ ⎢ n − f n − f ⎥ ⎣ 0 0 0 1 ⎦ ⎣ 0 0 0 1 ⎦ • ⎢ ⎥ lines not parallel to projection plane converge to a single ⎣⎢ 0 0 0 1 ⎦⎥ point on the horizon called the vanishing point (vp) M M eye→canonical world→eye Shirley02 The Cross Ratio Classes of Perspective Projection For the 4 sets of 4 collinear points in the figure, the cross-ratio for one-point: projection plane parallel to one corresponding points has the same value (can permute the point coordinate plane (to two coordinate axes, ordering) one coordinate axis cuts projection plane) p4 p2 − p1 p4 − p3 two-point: projection plane parallel to one coordinate axis (two coordinate axes cut p p3 p4 − p1 p3 − p2 1 p 2 projection plane) ⎡ x ⎤ ⎢ i ⎥ ⎢ yi ⎥ pi = ⎢ z ⎥ ⎢ i ⎥ ⎢ 1 ⎥ ⎣ ⎦ p3 − p1 p4 − p2 p1 − p3 p4 − p2 p3 − p2 p4 − p1 p1 − p2 p4 − p3 deMenthon Seitz08 James07 Classes of Perspective Projection Projective Geometry in 2D Consider lines and points in P three-point: projection plane We extend to 3D to simplify dealing with infinity not parallel to any coordinate • origin o out of P, at a distance = 1 from P axis (three coordinate axes cut projection plane) To each point m in P we can associate a single ray p = (x1, x2, x3) To each line l in P we can associate a single plane (A, B, C) • the equation of line L in projective geometry is Ax1 + Bx2 + Cx3 = 0 x3 Duell (A, B, C ) = L p = (x1, x2, x3) P m l o x1 Hulsey James07 x2 deMenthon Homogeneous Coordinates Perspective Divide How do we “land” back from the projective world to The ray p = (x1, x2, x3) and (λx1, λx2, λx3) are the same and are mapped to the same point m in P the 2D Cartesian world of the plane? • p is the coordinate vector of m, • for point, consider the intersection of ray p = (λx1, λx2, λx3) (x1, x2, x3) its homogeneous coordinates with the plane x3 = 1 λ = 1/x3, m = (x1 / x3, x2 / x3, 1) The planes (A, B, C) and (λA, λB, λC) are the same • for line, intersection of plane Ax + Bx + Cx = 0 with the l P 1 2 3 and are mapped to the same line in plane x = 1 is line l = Ax + Bx + C = 0 • L is the coordinate vector of l, 3 1 2 (A, B, C) its homogeneous coordinates x3 x3 L = (A, B, C) p = (x1, x2, x3) Called “perspective divide” L = (A, B, C) p = (x1, x2, x3) Point p’ is on line L if L•p’ = 0 p’ P P m For the mathematically m l inclined, or studying l computer vision: what’s (A, B, C) the geometric interpretation (A, B, C ) o o of x3 = 0? x1 x1 x2 deMenthon x2 deMenthon Projective Geometry 3D Projective Geometry Two lines always meet at a single point, and two points These concepts generalize naturally to 3D always lie on a single line Projective geometry does Homogeneous coordinates not differentiate between • projective 3D points have four coordinates: p = (x, y, z, w) (0, 0, 1) = (0, 0, 2) = … parallel and non-parallel lines (7, 1, 1) = (14, 2, 2) = … Points and lines are dual of (4, 5, 1) = (8, 10, 2) = … Projective transformations each other • represented by 4×4 matrices To return from homogeneous coordinates to Cartesian w = 1 coordinates, divide by x3 (w) w = 2 deMenthon, Durand08 Seitz08 Vanishing Points Perspective Projection What happens to two parallel lines that are not parallel to the projection plane? Given the coordinates of the orange point The parametric equation for find the coordinates of the green point y a line is: ⎡ ⎤ ⎡ ⎤ px vx y' y ⎢ ⎥ ⎢ ⎥ tanθ = = ⎢ py ⎥ ⎢ vy ⎥ l = p + tv = + t d z y ⎢ p ⎥ ⎢ v ⎥ ⎢ z ⎥ ⎢ z ⎥ y' yd z y’ = z θ ⎣⎢ 1 ⎦⎥ ⎣⎢ 0 ⎦⎥ e g Is perspective projection simply: d view plane After perspective transform: (x, y, z, 1) (xd/z, yd/z, d, 1), ⎡ p + tv ⎤ At the limit, with t∞, we get x x d T ⎡ ' ⎤ ⎡ ⎤ ⎢ ⎥ then map to screen by throwing z p px + tvx p + tv a point! [(vx/vz)d, (vy/vz)d, 1] ⎢ x ⎥ ⎢ ⎥ ⎢ z z ⎥ ' p + tv after ⎢ ⎥ away the z-coordinate: (xd/z, yd/z, 1)? ⎢ p y ⎥ = ⎢ y y ⎥ ⎯p⎯ersp⎯ectiv⎯e→ py + tvy divide ⎢ d ⎥ ⎢ ⎥ ⎢ (p + tv ) / d ⎥ p + tv ⎣ w ⎦ ⎣⎢ z z ⎦⎥ ⎢ z z ⎥ Each set of parallel lines ⎢ 1 ⎥ ! ⎣ ⎦ intersect at a vanishing point Perspective Projection Matrix Projection System Setup The coordinate system Projecting (x, y, z, 1) (xd/z, yd/z, d, 1) and throwing away d does not preserve the depth information The eye (e) (x’, y’, d, 1) • acts as the focal point and COP (x, y, z, 1) Instead want P such that: • placed at the origin ⎡ d ⎤ • looking down (g) along the e g ⎢ x ⎥ ⎡ x ⎤ z negative z-axis (axis of projection) ⎢ ⎥ ⎢ ⎥ perspective y ⎢ d ⎥ divide P⎢ ⎥ → y ⎢ z ⎥ ⎢ z ⎥ The screen ⎢ ⎥ preserve the relative • lies in the projection plane What does it mean for w=1? ⎢ 1 ⎥ z' depth information of ⎣ ⎦ ⎢ ⎥ • ⟘ to the z-axis,to the x-y plane What does it mean for w>1? ⎢ 1 ⎥ each point ⎣ ⎦ • located at distance d from the eye What is the homogeneous Just like orthographic projection, we need to map • d is a.k.a. the focal length coordinate (HC) when projecting from 3D to 2D? the view volume to a CVV instead of a 2D plane Perspective Projection View Frustum From Frustum to CVV View volume (frustum: truncated pyramid): • defined by (left, right, top, bottom, near, far) clipping planes • near (n) and far (f ) distances along –z-axis, both negative numbers, n > f View volume • nothing nearer than n will be drawn avoid numerical problems during rendering, such as divide by 0 perspective orthographic • nothing further than f will be drawn projection, including projection avoid low depth precision for distant objects perspective divide To preserve relative depth information, we must map the frustum to a CVV instead of a 2D plane RTR3 Perspective Projection Matrix ⎡ x ⎤ ⎡ x d z ⎤ Perspective Projection Matrix ⎢ ⎥ ⎢ ⎥ y yd z Want projection matrix P such that: P⎢ ⎥ → ⎢ ⎥ Second attempt: for a more generic matrix, ⎢ z ⎥ ⎢ z' ⎥ grab the depth info from the point itself: ⎢ 1 ⎥ ⎢ ⎥ What should P be? ⎣ ⎦ ⎣ 1 ⎦ • we’re projecting from
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages10 Page
-
File Size-