Lec-32 Viewing Transformation and Projection
Lec-32 Viewing Transformation and Projection
Lecture : 32
Viewing Pipeline
(Projection : VCS-Window)
===========================================================================
Camera screen
View-volume (view-port)
Clipping area
Object outside the
(Window)
view volume
yw
yv
xw xv
A portion of this object is (0,0,0)
zw outside the view volume zv
4 Forth Stage Viewing Pipeline
(Projection : 3D-to-2D Projection)
4 Forth Stage Viewing Pipeline
b (Perspective Projection : 3D-to-2D Projection)
yv
Camera screen
yw (view-port)
xv xw 𝑋, 𝑌, 𝑍
𝑝
Center of the lens
𝑜𝑣 , 𝑜𝑤 zw
0,0, 𝜆 A
zv
𝑝′ 𝑍−𝜆
𝑥, 𝑦
𝜆
Figure : Simplified setup for perspective projection where it is assumed that camera
axes are aligned with the world coordinate system.
4 Forth Stage Viewing Pipeline
b (Perspective Projection : 3D-to-2D Projection)
❖ Find the perspective transformation matrix 𝑇𝑝𝑝 that can project any point in
3D-scene (under view volume) to a window port.
❖ We will find the 𝑇𝑝𝑝 in homogenous coordinate system.
𝑘𝑋
𝑋
𝑘𝑌
Scene point : 𝑝 = 𝑌 ⇒ 𝑝ℎ =
𝑘𝑍
𝑍
𝑘
❖ In the previous figure, the two triangles are similar as all the angles of left
triangle are equal to the corresponding angles in right triangle.
So, we can write
𝑥 𝑋 𝑦 𝑌
− = & − =
𝜆 𝑍−𝜆 𝜆 𝑍−𝜆
𝜆𝑋 𝜆𝑌
⇒𝑥= & 𝑦= (1)
𝜆−𝑍 𝜆−𝑍
4 Forth Stage Viewing Pipeline
b (Perspective Projection : 3D-to-2D Projection)
❖ Let us defined the perspective projection matrix of this form :
1 0 0 0
0 1 0 0
𝑇𝑝𝑝 = 0 0 1 0
1
0 0 − 1
𝜆
❖ The projected point on camera coordinate system in homogenous form is :
1 0 0 0
𝑥′ 𝑘𝑋
0 1 0 0
𝑦′ 𝑘𝑌
𝑝′ ℎ = ′ = 𝑇𝑝𝑝 𝑝ℎ = 0 0 1 0
𝑧 1 𝑘𝑍
𝑘′ 0 0 − 1 𝑘
𝜆
4 Forth Stage Viewing Pipeline
b (Perspective Projection : 3D-to-2D Projection)
❖ The projected point on camera coordinate system in homogenous form is :
1 0 0 0
𝑥′ 𝑘𝑋
′ 0 1 0 0
𝑦 𝑘𝑌
𝑝′ ℎ = ′ = 𝑇𝑝𝑝 𝑝ℎ = 0 0 1 0
𝑧 1 𝑘𝑍
𝑘′ 0 0 − 1 𝑘
𝜆
4 Forth Stage Viewing Pipeline
b (Perspective Projection : 3D-to-2D Projection)
❖ The projected point on camera coordinate system in homogenous form is :
1 0 0 0
𝑥′ 𝑘𝑋
′ 0 1 0 0
𝑦 𝑘𝑌
𝑝′ ℎ = ′ = 𝑇𝑝𝑝 𝑝ℎ = 0 0 1 0
𝑧 1 𝑘𝑍
𝑘′ 0 0 − 1 𝑘
𝜆
and
𝑧′ 𝑘𝑍
𝑧= ′=
𝑘 𝑍
𝑘 1−
𝜆
𝑍 𝜆𝑍
= =
𝑍 𝜆−𝑍
1−
𝜆
4 Forth Stage Viewing Pipeline
b (Perspective Projection : 3D-to-2D Projection)
❖ *Note : If camera is not aligned with the WCS system, then one needs to
align first and then same perspective projection matrix can be used to project
any scene point to the imaging plane.
❖ This step (aligning camera to the WCS) requires translating the camera to
the origin of WCS, and a series of rotations to align the axes of camera to the
axes of WCS.
𝑝 = 5,3,3 𝜆 = 2 𝑢𝑛𝑖𝑡
yw yv 𝑝 = 5,3,3
𝑜𝑣 = 2,2,2
𝑜𝑣
xv zv
𝑜𝑤
(0,0,0) zw
xw
4 Forth Stage Viewing Pipeline
❑ Characteristics of Perspective Projection
1. Perspective foreshortening : Two objects of same size placed at
different distances from the view plane, the projected images are
of different sizes. Farther the object, smaller the image and vice-
versa.
2. Vanishing points : Lines that are not parallel to the view plane
appears to meet at some point on the view plane after projection
such points are called vanishing points.
3. View confusion : If the view plane is behind the center of
projection, objects in front of the center of projection appears
upside down on the view plane after projection i.e., inverted
image is formed on the view plane.
Like in page no 5 image
after 13 mins
https://www.youtube.com/watch?v=_EhY31MSbNM&t=329s
4 Forth Stage Viewing Pipeline
c (Parallel Projection)
4 Forth Stage Viewing Pipeline
c (Canonical View Volume : VCS (3D) to CVV
(3D) Projection)
Queries!
Acknowledgment
❖Computer Graphics C Version by Donald D. Hearn and M.
Pauline Baker