lect8 viewing in3d&transformation
DESCRIPTION
created by Sudipta mandalTRANSCRIPT
![Page 1: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/1.jpg)
Sudipta Mondal
Computer Graphics 7:Transformation &
Viewing in 3-D
![Page 2: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/2.jpg)
2of23
Imag
es ta
ken
from
Hea
rn &
Bak
er, “
Com
pute
r Gra
phic
s w
ith O
penG
L” (2
004)
3-D Coordinate Spaces
Remember what we mean by a 3-Dcoordinate space
x axis
y axis
z axis
P
y
zx
Right-HandReference System
![Page 3: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/3.jpg)
3of23
Translations In 3-D
To translate a point in three dimensions bydx, dy and dz simply calculate the newpoints as follows:
x’ = x + dx y’ = y + dy z’ = z + dz
(x’, y’, z’)(x, y, z)
Translated Position
Imag
es ta
ken
from
Hea
rn &
Bak
er, “
Com
pute
r Gra
phic
s w
ith O
penG
L” (2
004)
![Page 4: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/4.jpg)
4of23
Scaling In 3-D
To sale a point in three dimensions by sx, syand sz simply calculate the new points asfollows:
x’ = sx*x y’ = sy*y z’ = sz*z
(x, y, z)
Scaled Position
(x’, y’, z’)
Imag
es ta
ken
from
Hea
rn &
Bak
er, “
Com
pute
r Gra
phic
s w
ith O
penG
L” (2
004)
![Page 5: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/5.jpg)
5of23
Rotations In 3-D
When we performed rotations in twodimensions we only had the choice ofrotating about the z axisIn the case of three dimensions we havemore options
– Rotate about x – pitch– Rotate about y – yaw– Rotate about z - roll
![Page 6: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/6.jpg)
6of23
Imag
es ta
ken
from
Hea
rn &
Bak
er, “
Com
pute
r Gra
phic
s w
ith O
penG
L” (2
004)
Rotations In 3-D (cont…)
x’ = x·cosθ - y·sinθy’ = x·sinθ + y·cosθ
z’ = z
x’ = xy’ = y·cosθ - z·sinθz’ = y·sinθ + z·cosθ
x’ = z·sinθ + x·cosθy’ = y
z’ = z·cosθ - x·sinθ
The equations for the three kinds ofrotations in 3-D are as follows:
![Page 7: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/7.jpg)
7of23
Homogeneous Coordinates In 3-D
Similar to the 2-D situation we can usehomogeneous coordinates for 3-Dtransformations - 4 coordinatecolumn vectorAll transformations canthen be representedas matrices
úúúú
û
ù
êêêê
ë
é
1zyx
x axis
y axis
z axis
P
y
zxP(x, y, z) =
![Page 8: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/8.jpg)
8of23
3D Transformation Matrices
úúúú
û
ù
êêêê
ë
é
1000100010001
dzdydx
úúúú
û
ù
êêêê
ë
é
1000000000000
z
y
x
ss
s
úúúú
û
ù
êêêê
ë
é
-10000cos0sin00100sin0cos
Translation bydx, dy, dz
Scaling bysx, sy, sz
úúúú
û
ù
êêêê
ë
é-
10000cossin00sincos00001
qqqq
Rotate About X-Axis
úúúú
û
ù
êêêê
ë
é -
1000010000cossin00sincos
qqqq
Rotate About Y-Axis Rotate About Z-Axis
![Page 9: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/9.jpg)
9of23
Remember The Big IdeaIm
ages
take
n fro
m H
earn
& B
aker
, “C
ompu
ter G
raph
ics
with
Ope
nGL”
(200
4)
![Page 10: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/10.jpg)
10of23
What Are Projections?
Our 3-D scenes are all specified in 3-Dworld coordinatesTo display these we need to generate a 2-Dimage - project objects onto a picture plane
So how do we figure out these projections?
Picture Plane
Objects inWorld Space
![Page 11: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/11.jpg)
11of23
Converting From 3-D To 2-D
Projection is just one part of the process ofconverting from 3-D world coordinates to a2-D image
Clip againstview volume
Project ontoprojection
plane
Transform to2-D devicecoordinates
3-D worldcoordinate
outputprimitives
2-D devicecoordinates
![Page 12: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/12.jpg)
12of23
Types Of Projections
There are two broad classes of projection:– Parallel: Typically used for architectural and
engineering drawings– Perspective: Realistic looking and used in
computer graphics
Perspective ProjectionParallel Projection
![Page 13: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/13.jpg)
13of23
Types Of Projections (cont…)
For anyone who did engineering or technicaldrawing
![Page 14: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/14.jpg)
14of23
Parallel Projections
Some examples of parallel projections
Orthographic Projection
Isometric Projection
![Page 15: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/15.jpg)
15of23
Isometric Projections
Isometric projections have been used incomputer games from the very early days ofthe industry up to today
Q*Bert Sim City Virtual Magic Kingdom
![Page 16: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/16.jpg)
16of23
Perspective Projections
Perspective projections are much morerealistic than parallel projections
![Page 17: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/17.jpg)
17of23
Perspective Projections
There are a number of different kinds ofperspective viewsThe most common are one-point and twopoint perspectives
Imag
es ta
ken
from
Hea
rn &
Bak
er, “
Com
pute
r Gra
phic
s w
ith O
penG
L” (2
004)
One Point PerspectiveProjection
Two-PointPerspectiveProjection
![Page 18: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/18.jpg)
18of23
Elements Of A Perspective Projection
VirtualCamera
![Page 19: Lect8 viewing in3d&transformation](https://reader038.vdocuments.us/reader038/viewer/2022103016/555a6110d8b42a47748b539b/html5/thumbnails/19.jpg)
19of23
The Up And Look Vectors
The look vectorindicates the direction inwhich the camera ispointingThe up vectordetermines how the
camera is rotatedFor example, is the camera held vertically orhorizontally
Up vectorLook vector
Position
Projection ofup vector