200 likes | 330 Views
CS 3388 Projections & Perspective Transformations. [Hill § 7.1,7.2,7.4]. “Oh noes !”. TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A A A A. Projections. A projection is the image of something, rather than the thing itself
E N D
CS 3388Projections & Perspective Transformations [Hill §7.1,7.2,7.4] “Oh noes!” TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAA
Projections • A projection is the image of something, rather than the thing itself • Mathematically, transformation fis a projection if f(p)=f(f(p)) for all p2Rn • Or, P2Rn£n is a projection if P2´P • Q: what is the only invertible ‘projection’? 3D thing pinhole camera 2D image of thing nautilus eye http://pixdaus.com/single.php?id=187022 http://en.wikipedia.org/wiki/File:Pinhole-camera.svg
Orthographic Projection • Project 3D points onto plane (2D image): • Projection lines orthogonal to the projection plane projection lines y projected points z x projection plane
Perspective Projection • Project 3D points onto plane (2D image): • Projection lines pass through center; not orthogonal to projection plane projection lines y projected points z x center of projection projection plane
Properties of Projections i.e.f(p)=p • Many points project to same location • projection not invertible, i.e. can have f(p)=f(q) • point p in projection plane projects to p, i.e. f(p)=p • Orthographic: • parallel 3D lines project to parallel 2D lines • Perspective: • 3D lines project to 2D lines (parallel not preserved) • further objects appear smaller
Perspective Foreshortening • Projection p0=f(p) appears closer to center line as p gets further from plane Q: how far must we travel along this line to ‘hit’ vanishing point? same x in 3D different x0 in 2D x causes lines parallel in 3D to converge to a vanishing point z
Vanishing Points lines parallel in 3D may converge in perspective x Each 3D orientation has its own vanishing point, ... z ... but what family of lines stays parallel even in perspective? two vanishing points http://www.mymodernmet.com/profiles/blogs/flatiron-building-in-ny-will
Your Brain Needs Perspective! different projected size same projected size “Ames room” http://www.flickr.com/photos/leolondon/490312841/ http://www.flickr.com/photos/gandhiji40/399633119/ http://www1.appstate.edu/~kms/classes/psy3203/Depth/AmesDiagram.htm http://www.psychologie.tu-dresden.de/i1/kaw/diverses%20Material/www.illusionworks.com/html/ames_room.html
Your Brain Needs Perspective! http://www.impactlab.net/2006/03/09/amazing-3d-sidewalk-art-photos/
Canonical View Frustum • We “look” down negativez axis • Only “see” 3D objects inside view frustum (DirectX flips z axis!) view frustum (bounded volume) y center of projection (eye / camera) z x near rectangle near plane far plane (left,top) (right,bottom) (z = small constant) (z = large constant) project 3D objects onto 2D near plane!
Canonical View Frustum • Orthographic projection is very similar view frustum near rectangle (rectangular prism) (left,top) (right,bottom) y z x far plane z near plane z
*we revisit this later to preserve ‘depths’ 3D ! 2D Projection* • If point is known, what is its projection? • Intersect projection line with near plane! orthographic perspective slide x,y,z slide z only! x x z z warning: book, OpenGL use z=-n, n>0 notice scaling n merely scales the image!
[Hill p.353,354] Alternate View on Perspective • Two conceptual steps: orthographic projection 3D view frustum perspective transformation linear squash non-linear depth stays parallel linear stretch now not parallel =perspective projection x now parallel z
[Hill p365] Taxonomy of Projections planar projection parallel perspective oblique orthographic
Classes of Transformation • “Projective transformations” includes affine + perspective transformations, not projections!! “projective” perspective (new!) “affine” “linear” “rigid-body” scaling rotation translation shearing reflection
Arbitrary View Frustums • What about eye not looking down z axis? • Don’t move frustum, move world! rigid-body transformation boooooAyn Rand projection calculations easy again! x x z z
Arbitrary View Frustums • Assume eye translated by v, rotated by µ back in canonical form! x x z z (we omit y dimension for simplicity)
[Hill §7.2.2] (uses look “point”) Arbitrary View Frustums • In 2D can also specify eye orientation as a look vector • In 3D, look not enough... need up vector look µ x z #include <cmath> // for atan2(y,x) up look controls yaw and pitch up controls roll look y z x