perspective projection - colorado state university · the key to perspective projection is that all...
TRANSCRIPT
![Page 1: Perspective Projection - Colorado State University · The key to perspective projection is that all light rays meet at the PRP (focal point). Notice that we are looking down the Z](https://reader033.vdocuments.site/reader033/viewer/2022042802/5f39cc7ad309167dab4fb89a/html5/thumbnails/1.jpg)
Perspective Projection Lecture 10, September 25th 2014
Perspective …
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 2
![Page 2: Perspective Projection - Colorado State University · The key to perspective projection is that all light rays meet at the PRP (focal point). Notice that we are looking down the Z](https://reader033.vdocuments.site/reader033/viewer/2022042802/5f39cc7ad309167dab4fb89a/html5/thumbnails/2.jpg)
Orthographic / Perspective Think About Rays
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 3
Overview – 3 Formulations
! Where we place the origin matters ! How we handle z values matters ! Form #1:
! Origin at focal point, z values constant ! Form #2:
! Origin at image center, z values are zero ! Form #3:
! Origin at focal point, z proportional to depth
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 4
![Page 3: Perspective Projection - Colorado State University · The key to perspective projection is that all light rays meet at the PRP (focal point). Notice that we are looking down the Z](https://reader033.vdocuments.site/reader033/viewer/2022042802/5f39cc7ad309167dab4fb89a/html5/thumbnails/3.jpg)
The key to perspective projection is that all light rays meet at the PRP (focal point). Notice that we are looking down the Z axis, with the origin at the focal point and the image plane at z = d. v
z
P(x,y,z)
Pv
d
Pz
Py
Perspective Projection Form #1
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 5
Pu Px d Pz
= Pv Py d Pz =
Pu = Pxd Pz
Pv = Pyd Pz
Pu = Px d Pz
Pv = Py d Pz
by similar triangles:
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 6
horizontal vertical
![Page 4: Perspective Projection - Colorado State University · The key to perspective projection is that all light rays meet at the PRP (focal point). Notice that we are looking down the Z](https://reader033.vdocuments.site/reader033/viewer/2022042802/5f39cc7ad309167dab4fb89a/html5/thumbnails/4.jpg)
Perspective Projection Matrix
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 7
Problem: division of one variable by another is a non-linear operation. Solution: homogeneous coordinates!
1 0 0 0 0 1 0 0 0 0 1 0 0 0 1/d 0
Perspective Matrix (II)
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 8
uvd1
!
"
####
$
%
&&&&
=
x dz
y dzd1
!
"
#######
$
%
&&&&&&&
=
xyzzd
!
"
#####
$
%
&&&&&
=
1 0 0 00 1 0 00 0 1 00 0 1
d 0
!
"
#####
$
%
&&&&&
xyzw
!
"
####
$
%
&&&&
Projection Matrix times a Point Point in
Non-normalized Homogeneous
coordinates
Normalized
Point in (u,v)
coordinates
![Page 5: Perspective Projection - Colorado State University · The key to perspective projection is that all light rays meet at the PRP (focal point). Notice that we are looking down the Z](https://reader033.vdocuments.site/reader033/viewer/2022042802/5f39cc7ad309167dab4fb89a/html5/thumbnails/5.jpg)
What happens to Z?
! What happens to the Z dimension?
! The Z dimension projects to d ! Why? Because (u, v, d) is a 3D point on the
image (z = d) plane! 10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 9
uvd1
!
"
####
$
%
&&&&
=
x dz
y dzd1
!
"
#######
$
%
&&&&&&&
=
xyzzd
!
"
#####
$
%
&&&&&
=
1 0 0 00 1 0 00 0 1 00 0 1
d 0
!
"
#####
$
%
&&&&&
xyzw
!
"
####
$
%
&&&&
Perspective Projection Form #2
P
Py v
O d Pz
vd=
Pyd +Pz
v = Pyd
d +Pz
!
"#
$
%&
10/9/14 10 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014
![Page 6: Perspective Projection - Colorado State University · The key to perspective projection is that all light rays meet at the PRP (focal point). Notice that we are looking down the Z](https://reader033.vdocuments.site/reader033/viewer/2022042802/5f39cc7ad309167dab4fb89a/html5/thumbnails/6.jpg)
Leading to the following
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 11
! Now look at what happens to depth. ! Contrast this with previous version.
x dd + z!
"#
$
%&
y dd + z!
"#
$
%&
01
'
(
)))))))
*
+
,,,,,,,
=
xy0
z+ dd
'
(
))))))
*
+
,,,,,,
=
xy0zd+1
'
(
))))))
*
+
,,,,,,
=
1 0 0 00 1 0 00 0 0 0
0 0 1d
1
'
(
))))))
*
+
,,,,,,
xyz1
'
(
))))
*
+
,,,,
Let distance d go to infinity.
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 12
Formulation #1
Formulation #2
Recall formulation #2 when considering how projection changes with increased focal length.
€
XY01
![Page 7: Perspective Projection - Colorado State University · The key to perspective projection is that all light rays meet at the PRP (focal point). Notice that we are looking down the Z](https://reader033.vdocuments.site/reader033/viewer/2022042802/5f39cc7ad309167dab4fb89a/html5/thumbnails/7.jpg)
Moving to Formulation #3
! Review, #1 origin at PRP. ! Review, #2 origin at image center. ! Review, #1 and #2
! No useful information on the z-axis ! We now have a new goal ! Project into a cannonical view volumne ! A rectangular value with bounds:
! U: -1 to 1, V: -1 to 1, D: 0 to 1
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 13
Remember When We Started
! What happens if you multiply a point in homogeneous coordinates by a scalar?
! Nothing!
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 14 €
xyzw
"
#
$ $ $ $
%
&
' ' ' '
=
sxsyszsw
"
#
$ $ $ $
%
&
' ' ' '
= s⋅
xyzw
"
#
$ $ $ $
%
&
' ' ' '
![Page 8: Perspective Projection - Colorado State University · The key to perspective projection is that all light rays meet at the PRP (focal point). Notice that we are looking down the Z](https://reader033.vdocuments.site/reader033/viewer/2022042802/5f39cc7ad309167dab4fb89a/html5/thumbnails/8.jpg)
Scalar Multiplication Continued
! What happens if you multiply a homogeneous matrix by a scalar?
! Nothing!
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 15
ax + by+ cz+ dwex + fy+ gz+ hwix + jy+ kz+ lwmx + ny+oz+ pw
!
"
#####
$
%
&&&&&
=
a b c de f g hi j k lm n o p
!
"
#####
$
%
&&&&&
xyzw
!
"
####
$
%
&&&&
ax + by+ cz+ dwex + fy+ gz+ hwix + jy+ kz+ lwmx + ny+oz+ pw
!
"
#####
$
%
&&&&&
=
s ax + by+ cz+ dw( )s ex + fy+ gz+ hw( )s ix + jy+ kz+ lw( )s mx + ny+oz+ pw( )
!
"
######
$
%
&&&&&&
= s ⋅
a b c de f g hi j k lm n o p
!
"
#####
$
%
&&&&&
xyzw
!
"
####
$
%
&&&&
Form #1 & Textbook Derivation
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 16
1 0 0 00 1 0 00 0 1 00 0 1
d 0
!
"
#####
$
%
&&&&&
equivalent to
d 0 0 00 d 0 00 0 d 00 0 1 0
!
"
####
$
%
&&&&
Lecture Form #1 p. 152 (very top, 1D)
![Page 9: Perspective Projection - Colorado State University · The key to perspective projection is that all light rays meet at the PRP (focal point). Notice that we are looking down the Z](https://reader033.vdocuments.site/reader033/viewer/2022042802/5f39cc7ad309167dab4fb89a/html5/thumbnails/9.jpg)
Now introduce clipping planes
! Text introduces n, the near clipping plane. ! Also introduces f, the far clipping plane. ! Sets what first called d to n. ! The handling of z now carries information?
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 17
n 0 0 00 n 0 00 0 n+ f − fn0 0 1 0
"
#
$$$$
%
&
''''
nxny
zn+ zf − fnz
"
#
$$$$$
%
&
'''''
=
n 0 0 00 n 0 00 0 n+ f − fn0 0 1 0
"
#
$$$$
%
&
''''
xyz1
"
#
$$$$
%
&
''''
Visualize View Volume 1
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 18
![Page 10: Perspective Projection - Colorado State University · The key to perspective projection is that all light rays meet at the PRP (focal point). Notice that we are looking down the Z](https://reader033.vdocuments.site/reader033/viewer/2022042802/5f39cc7ad309167dab4fb89a/html5/thumbnails/10.jpg)
Visualize View Volume 2
10/9/14 © Ross Beveridge & Bruce Draper, CS 410 CSU 2014 19