Linear can also allow arbitrary w cornell cs4620 fall

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Fall 2013 • Lecture 8 © 2013 Steve Marschner • 19 Homogeneous coordinates revisited • Perspective requires division – that is not part of affine transformations – in affine, parallel lines stay parallel • therefore not vanishing point • therefore no rays converging on viewpoint • “True” purpose of homogeneous coords: projection Cornell CS4620 Fall 2013 • Lecture 8 © 2013 Steve Marschner • 20 Homogeneous coordinates revisited • Introduced w = 1 coordinate as a placeholder – used as a convenience for unifying translation with linear • Can also allow arbitrary w Cornell CS4620 Fall 2013 • Lecture 8 © 2013 Steve Marschner • 21 Implications of w • All scalar multiples of a 4-vector are equivalent • When w is not zero, can divide by w – therefore these points represent “normal” affine points • When w is zero, it’s a point at infinity, a.k.a. a direction – this is the point where parallel lines intersect – can also think of it as the vanishing point • Digression on projective space Cornell CS4620 Fall 2013 • Lecture 8 © 2013 Steve Marschner • 22 Perspective projection to implement perspective, just move z to w: Cornell CS4620 Fall 2013 • Lecture 8 © 2013 Steve Marschner • 23 View volume: perspective Cornell CS4620 Fall 2013 • Lecture 8 © 2013 Steve Marschner • 24 View volume: perspective (clipped) Cornell CS4620 Fall 2013 • Lecture 8 © 2013 Steve Marschner • 25 Carrying depth through perspective • Perspective has a varying denominator—can’t preserve depth! • Compromise: preserve depth on near and far planes – that is, choose a and b so that z’(n) = n and z’(f) = f. Cornell CS4620 Fall 2013 • Lecture 8 © 2013 Steve Marschner • 26 Official perspective matrix • Use near plane distance as the projection distance – i.e., d = –n • Scale by –1 to have fewer minus signs – scaling the matrix does not change the projective transformation n0 0 ⇧0 n 0 ⇧ P=⇤ 0 0 n+f 00 1 Cornell CS4620 Fall 2013 • Lecture 8 ⇥ 0 0⌃ ⌃ f n⌅ 0 © 2013 Steve Marschner • 27 Perspective projection matrix • Product of perspective matrix with orth. projection matrix Mper = Morth P 2 rl ⇧0 ⇧ =⇧ ⇤0 0 0 2 0 tb 0 nf 0 0 0 2n rl 0 0 l+r lr b+t bt f +n nf 0 1 ⇧ ⇧0 =⇧ ⇧ ⇤0 0 2n tb Cornell CS4620 Fall 2013 • Lecture 8 2 r +l ⇥ rl n t+b ⌃ ⇧ t b ⌃ ⇧0 n+f ⌃ ⇤ 0 ⌅ nf 0 1 0 ⇥ ⌃ 0⌃ ⌃ 2f n ⌃ f n⌅ 0 0 n 0 0 n+f 0 1 ⇥ 0 0⌃ ⌃ f n⌅ 0 0 © 2013 Steve Marschner • 28 Perspective transformation chain • Transform into world coords (modeling transform, Mm) • Transform into eye coords (camera xf., Mcam = Fc–1) • Perspective matrix, P • Orthographic projection, Morth • Viewport transform, Mvp ps = Mvp Morth PMcam Mm po ⇥ nx 2 xs ys ⌃ ⇧ 0 ⌃=⇧ zc ⌅ ⇤ 0 1 0 0 ny 2 0 0 0 0 1 0 2 nx 1 ⇥ rl 2 ny 1 ⌃ ⇧ 0 2 ⌃⇧ 0 ⌅⇤ 0 1 0 Cornell CS4620 Fall 2013 • Lecture 8 0 2 tb 0 0 0 0 2 nf 0 r +l ⇥ n rl t+b ⌃ ⇧ t b ⌃ ⇧0 n+f ⌅ ⇤ 0 nf 1 0 0 0 n 0 0 n+f 0 1 ⇥ ⇥ 0 xo ⇧⌃ 0⌃ ⌃ Mcam Mm ⇧ yo ⌃ ⇤ zo ⌅ f n⌅ 1 0 © 2013 Steve Marschner • 29 Pipeline of transformations 7.1. Viewing Transformations 147 • Standard sequence of transforms object space modeling transformation camera transformation world space screen space camera space projection viewport transformation transformation canonical view volume Figure 7.2. The sequence of spaces and transformations that gets objects from their Cornell CS4620 Fall ordina tLecture screen space. 2013 • es into 8 © 2013 Steve Marschner • 30 original co...
View Full Document

Ask a homework question - tutors are online