Computer Graphics Lecture Notes On UNIT 6 PDF
Computer Graphics Lecture Notes On UNIT 6 PDF
Viewing in 3-D
Contents
In todays lecture we are going to have a
look 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
z
x
z axis
x axis
Right-Hand
Reference System
Translations In 3-D
To translate a point in three dimensions by
dx, dy and dz simply calculate the new
points as follows:
x = x + dx
y = y + dy
z = z + dz
(x, y, z)
(x, y, z)
Translated Position
Scaling In 3-D
To sale a point in three dimensions by sx, sy
and sz simply calculate the new points as
follows:
x = sx*x
y = sy*y
z = sz*z
(x, y, z)
(x, y, z)
Scaled Position
x = xcos - ysin
y = xsin + ycos
z = z
x = x
y = ycos - zsin
z = ysin + zcos
x = zsin + xcos
y = y
z = zcos - xsin
x
y
z
1
z
x
z axis
x axis
3D Transformation Matrices
1
0
Translation by
dx, dy, dz 0
0
0
1
0 cos
0 sin
0
0
0
sin
cos
0
0
0
0
0 0 dx
1 0 dy
0 1 dz
0 0 1
sx
0
cos
0
sin
0 sin 0
1 0 0
0 cos 0
0 0 1
0 0 0
sy 0 0 Scaling by
0 sz 0 sx, sy, sz
0 0 1
cos
sin
sin
cos
0
0
0 0
0 0
1 0
0 1
10
of
23
Viewing a 3D world
3D Viewing Pipeline
Modeling coordinates
Modeling coordinates
Construct World Coordinate
Scene Using ModelCoordinate Transformations
World coordinates
3D pipeline
World coordinates
Projection Transformation
Viewing coordinates
2D pipeline
Transform Viewing
Coordinates to Normalized
Coordinates
Normalized coordinates
Map Normalized Coordinates
to Device Coordinates
Device coordinates
Projection coordinates
Transform Viewing
Coordinates to Normalized
Coordinates
Normalized coordinates
Map Normalized Coordinates
to Device Coordinates
Device coordinates
Objects in
World Space
Clip against
view volume
Project onto
projection
plane
Transform to
2-D device
coordinates
2-D device
coordinates
Projections
Need to project from 3D to 2D
2 kinds of projection
Parallel projection
Perspective projection
Parallel Projection
Perspective Projection
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
Parallel Projection
Perspective Projection
Parallel Projections
Some examples of parallel projections
Orthographic Projection
Isometric Projection
Perspective Projections
There are a number of different kinds of
perspective views
The most common are one-point and two
point perspectives
Two-Point
Perspective
Projection
Virtual
Camera
Up vector
Position
Look vector
camera is rotated
For example, is the camera held vertically or
horizontally
Summary
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
Perspective Projections
Remember the whole point of perspective
projections
Contents
Now lecture we are going to have a look at
some perspective view demos and
investigate how clipping works in 3-D
Nate Robins OpenGL tutorials
The clipping volume
The zone labelling scheme
3-D clipping
Point clipping
Line clipping
Polygon clipping
3-D Clipping
Just like the case in two dimensions,
clipping removes objects that will not be
visible from the scene
The point of this is to remove computational
effort
3-D clipping is achieved in two basic steps
Discard objects that cant be viewed
i.e. objects that are behind the camera, outside
the field of view, or too far away
Discard Objects
Discarding objects that cannot possibly be
seen involves comparing an objects
bounding box/sphere against the
dimensions of the view volume
Can be done before or after projection
Clipping Objects
Objects that are partially within the viewing
volume need to be clipped just like the 2D
case
Normalisation
The transformed volume is then normalised
around position (0, 0, 0) and the z axis is
reversed
bit 5
Near
bit 4
Top
bit 3
Bottom
bit 2
Right
bit 1
Left
Region Codes
3D Polygon Clipping
However the most common case in 3D
clipping is that we are clipping graphics
objects made up of polygons
Summary
In todays lecture we examined how clipping
is achieved in 3-D