Graphics6-ViewingIn3D
-
Upload
nithin-yadav -
Category
Documents
-
view
213 -
download
0
Transcript of Graphics6-ViewingIn3D
-
7/29/2019 Graphics6-ViewingIn3D
1/23
1
of
23New Lecture And Lab Information
Lectures: Thursday 12:00 13:00 (room tba)
Friday 15:00 16:00 (A28)
Labs: Wednesday 10:00 11:00 (A305)
Wednesday 17:00 18:00 (Aungier St. 1-005)
Sorry for all of the messing around!
-
7/29/2019 Graphics6-ViewingIn3D
2/23
Course Website:http://www.comp.dit.ie/bmacnamee
Computer Graphics 7:
Viewing in 3-D
http://www.comp.dit.ie/bmacnameehttp://www.comp.dit.ie/bmacnamee -
7/29/2019 Graphics6-ViewingIn3D
3/23
3
of
23Contents
In todays lecture we are going to have alook at:
Transformations in 3-D
How do transformations in 3-D work? 3-D homogeneous coordinates and matrix based
transformations
Projections
History
Geometrical Constructions
Types of Projection
Projection in Computer Graphics
-
7/29/2019 Graphics6-ViewingIn3D
4/23
4
of
23
Ima
gestakenfromHearn&B
aker,ComputerGraphics
withOpenGL(2004)
3-D Coordinate Spaces
Remember what we mean by a 3-Dcoordinate space
x axis
y axis
z axis
P
y
z
x
Right-Hand
Reference System
-
7/29/2019 Graphics6-ViewingIn3D
5/23
5
of
23Translations In 3-D
To translate a point in three dimensions bydx, dy and dzsimply calculate the newpoints as follows:
x = x + dx y = y + dy z = z + dz
(x, y, z)
(x, y, z)
Translated PositionImagestakenfromHearn&B
aker,ComputerGraphics
withOpenGL(2004)
-
7/29/2019 Graphics6-ViewingIn3D
6/23
6
of
23Scaling In 3-D
To sale a point in three dimensions bysx,syandszsimply calculate the new points asfollows:
x = sx*x y = sy*y z = sz*z
(x, y, z)
Scaled Position
(x, y, z)
Ima
gestakenfromHearn&B
aker,ComputerGraphics
withOpenGL(2004)
-
7/29/2019 Graphics6-ViewingIn3D
7/23
7
of
23Rotations In 3-D
When we performed rotations in twodimensions we only had the choice of
rotating about thezaxis
In the case of three dimensions we havemore options
Rotate aboutx pitch
Rotate abouty yaw
Rotate aboutz- roll
-
7/29/2019 Graphics6-ViewingIn3D
8/23
8
of
23
Ima
gestakenfromHearn&B
aker,ComputerGraphics
withOpenGL(2004)
Rotations In 3-D (cont)
x = xcos -ysin
y = xsin +ycos
z = z
x = x
y = ycos -zsin
z = ysin +zcos
x = zsin +xcos
y = y
z = zcos -xsin
The equations for the three kinds ofrotations in 3-D are as follows:
-
7/29/2019 Graphics6-ViewingIn3D
9/23
9
of
23Homogeneous Coordinates In 3-D
Similar to the 2-D situation we can usehomogeneous coordinates for 3-D
transformations - 4 coordinate
column vectorAll transformations can
then be represented
as matrices
1
z
y
x
x axis
y axis
z axis
P
y
z
xP(x, y, z) =
-
7/29/2019 Graphics6-ViewingIn3D
10/23
10
of
233D Transformation Matrices
1000
100
010
001
dz
dy
dx
1000
000
000
000
z
y
x
s
s
s
1000
0cos0sin
0010
0sin0cos
Translation by
dx, dy, dzScaling by
sx, sy, sz
1000
0cossin0
0sincos0
0001
Rotate About X-Axis
1000
0100
00cossin
00sincos
Rotate About Y-Axis Rotate About Z-Axis
-
7/29/2019 Graphics6-ViewingIn3D
11/23
11
of
23Remember The Big Idea
ImagestakenfromHearn&B
aker,ComputerGraphicswithOpenGL(2004)
-
7/29/2019 Graphics6-ViewingIn3D
12/23
12
of
23What Are Projections?
Our 3-D scenes are all specified in 3-Dworld coordinates
To display these we need to generate a 2-D
image -projectobjects onto apicture plane
So how do we figure out these projections?
Picture Plane
Objects inWorld Space
-
7/29/2019 Graphics6-ViewingIn3D
13/23
13
of
23Converting From 3-D To 2-D
Projection is just one part of the process ofconverting from 3-D world coordinates to a
2-D image
Clip against
view volume
Project onto
projection
plane
Transform to
2-D device
coordinates
3-D world
coordinate
output
primitives
2-D device
coordinates
-
7/29/2019 Graphics6-ViewingIn3D
14/23
14
of
23Types Of Projections
There are two broad classes of projection: Parallel: Typically used for architectural and
engineering drawings
Perspective: Realistic looking and used incomputer graphics
Perspective ProjectionParallel Projection
-
7/29/2019 Graphics6-ViewingIn3D
15/23
15
of
23Types Of Projections (cont)
For anyone who did engineering or technicaldrawing
-
7/29/2019 Graphics6-ViewingIn3D
16/23
16
of
23Parallel Projections
Some examples of parallel projections
Orthographic Projection
Isometric Projection
-
7/29/2019 Graphics6-ViewingIn3D
17/23
17
of
23Isometric Projections
Isometric projections have been used incomputer games from the very early days of
the industry up to today
Q*Bert Sim City Virtual Magic Kingdom
-
7/29/2019 Graphics6-ViewingIn3D
18/23
18
of
23Perspective Projections
Perspective projections are much morerealistic than parallel projections
-
7/29/2019 Graphics6-ViewingIn3D
19/23
19
of
23Perspective Projections
There are a number of different kinds ofperspective views
The most common are one-point and two
point perspectives
ImagestakenfromHearn&B
aker,ComputerGraphicswithOpenGL(2004)
One Point Perspective
Projection
Two-Point
Perspective
Projection
-
7/29/2019 Graphics6-ViewingIn3D
20/23
20
of
23Elements Of A Perspective Projection
Virtual
Camera
-
7/29/2019 Graphics6-ViewingIn3D
21/23
21
of
23The Up And Look Vectors
The look vectorindicates the direction in
which the camera is
pointingThe up vector
determines how the
camera is rotatedFor example, is the camera held vertically or
horizontally
Up vectorLook vector
Position
Projection of
up vector
-
7/29/2019 Graphics6-ViewingIn3D
22/23
22
of
23Summary
In todays lecture we looked at: Transformations in 3-D
Very similar to those in 2-D
Projections 3-D scenes must be projected onto a 2-D image
plane
Lots of ways to do this
Parallel projections Perspective projections
The virtual camera
-
7/29/2019 Graphics6-ViewingIn3D
23/23
23
of
23Whos Choosing Graphics?
A couple of quick questions for you: Who is choosing graphics as an option?
Are there any problems with option time-
tabling? What do you think of the course so far?
Is it too fast/slow?
Is it too easy/hard?
Is there anything in particular you want to cover?