SlideShare a Scribd company logo
1 of 19
Download to read offline
Sudipta Mondal
Computer Graphics 7:
Transformation &
Viewing in 3-D
2
of
23
ImagestakenfromHearn&Baker,“ComputerGraphicswithOpenGL”(2004)
3-D Coordinate Spaces
Remember what we mean by a 3-D
coordinate space
x axis
y axis
z axis
P
y
z
x
Right-Hand
Reference System
3
of
23
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
ImagestakenfromHearn&Baker,“ComputerGraphicswithOpenGL”(2004)
4
of
23
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)
Scaled Position
(x’, y’, z’)
ImagestakenfromHearn&Baker,“ComputerGraphicswithOpenGL”(2004)
5
of
23
Rotations In 3-D
When we performed rotations in two
dimensions we only had the choice of
rotating about the z axis
In the case of three dimensions we have
more options
– Rotate about x – pitch
– Rotate about y – yaw
– Rotate about z - roll
6
of
23
ImagestakenfromHearn&Baker,“ComputerGraphicswithOpenGL”(2004)
Rotations In 3-D (cont…)
x’= x·cosθ - y·sinθ
y’= x·sinθ + y·cosθ
z’= z
x’= x
y’= 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 of
rotations in 3-D are as follows:
7
of
23
Homogeneous Coordinates In 3-D
Similar to the 2-D situation we can use
homogeneous coordinates for 3-D
transformations - 4 coordinate
column vector
All transformations can
then be represented
as matrices
ú
ú
ú
ú
û
ù
ê
ê
ê
ê
ë
é
1
z
y
x
x axis
y axis
z axis
P
y
z
xP(x, y, z) =
8
of
23
3D Transformation Matrices
ú
ú
ú
ú
û
ù
ê
ê
ê
ê
ë
é
1000
100
010
001
dz
dy
dx
ú
ú
ú
ú
û
ù
ê
ê
ê
ê
ë
é
1000
000
000
000
z
y
x
s
s
s
ú
ú
ú
ú
û
ù
ê
ê
ê
ê
ë
é
-
1000
0cos0sin
0010
0sin0cos
qq
qq
Translation by
dx, dy, dz
Scaling by
sx, sy, sz
ú
ú
ú
ú
û
ù
ê
ê
ê
ê
ë
é
-
1000
0cossin0
0sincos0
0001
qq
qq
Rotate About X-Axis
ú
ú
ú
ú
û
ù
ê
ê
ê
ê
ë
é -
1000
0100
00cossin
00sincos
qq
qq
Rotate About Y-Axis Rotate About Z-Axis
9
of
23
Remember The Big Idea
ImagestakenfromHearn&Baker,“ComputerGraphicswithOpenGL”(2004)
10
of
23
What Are Projections?
Our 3-D scenes are all specified in 3-D
world coordinates
To display these we need to generate a 2-D
image - project objects onto a picture plane
So how do we figure out these projections?
Picture Plane
Objects in
World Space
11
of
23
Converting From 3-D To 2-D
Projection is just one part of the process of
converting 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
12
of
23
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
13
of
23
Types Of Projections (cont…)
For anyone who did engineering or technical
drawing
14
of
23
Parallel Projections
Some examples of parallel projections
Orthographic Projection
Isometric Projection
15
of
23
Isometric Projections
Isometric projections have been used in
computer games from the very early days of
the industry up to today
Q*Bert Sim City Virtual Magic Kingdom
16
of
23
Perspective Projections
Perspective projections are much more
realistic than parallel projections
17
of
23
Perspective Projections
There are a number of different kinds of
perspective views
The most common are one-point and two
point perspectives
ImagestakenfromHearn&Baker,“ComputerGraphicswithOpenGL”(2004)
One Point Perspective
Projection
Two-Point
Perspective
Projection
18
of
23
Elements Of A Perspective Projection
Virtual
Camera
19
of
23
The Up And Look Vectors
The look vector
indicates the direction in
which the camera is
pointing
The up vector
determines how the
camera is rotated
For example, is the camera held vertically or
horizontally
Up vector
Look vector
Position
Projection of
up vector

More Related Content

What's hot

Composite transformations
Composite transformationsComposite transformations
Composite transformations
Mohd Arif
 
3 d transformations
3 d transformations3 d transformations
3 d transformations
Ankit Garg
 

What's hot (20)

3D transformation and viewing
3D transformation and viewing3D transformation and viewing
3D transformation and viewing
 
Unit3 3d
Unit3 3dUnit3 3d
Unit3 3d
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
 
2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)
 
3 d transformation
3 d transformation3 d transformation
3 d transformation
 
3D Transformation
3D Transformation 3D Transformation
3D Transformation
 
Homogeneous Representation: rotating, shearing
Homogeneous Representation: rotating, shearingHomogeneous Representation: rotating, shearing
Homogeneous Representation: rotating, shearing
 
3 d transformations
3 d transformations3 d transformations
3 d transformations
 
3 D Graphics
3 D Graphics3 D Graphics
3 D Graphics
 
3d transformation computer graphics
3d transformation computer graphics 3d transformation computer graphics
3d transformation computer graphics
 
Three dimensional transformations
Three dimensional transformationsThree dimensional transformations
Three dimensional transformations
 
Three dimensional concepts - Computer Graphics
Three dimensional concepts - Computer GraphicsThree dimensional concepts - Computer Graphics
Three dimensional concepts - Computer Graphics
 
Geometric transformations and projections
Geometric transformations and projectionsGeometric transformations and projections
Geometric transformations and projections
 
Projection Matrices
Projection MatricesProjection Matrices
Projection Matrices
 
Modeling Transformations
Modeling TransformationsModeling Transformations
Modeling Transformations
 
Overview of 2D and 3D Transformation
Overview of 2D and 3D TransformationOverview of 2D and 3D Transformation
Overview of 2D and 3D Transformation
 
Composite transformations
Composite transformationsComposite transformations
Composite transformations
 
3 d transformations
3 d transformations3 d transformations
3 d transformations
 
viewing3d pipeline
viewing3d pipelineviewing3d pipeline
viewing3d pipeline
 
Computer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2DComputer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2D
 

Viewers also liked (8)

Hw#5
Hw#5Hw#5
Hw#5
 
Hearn and Baker 2 D transformations
Hearn and Baker 2 D transformations   Hearn and Baker 2 D transformations
Hearn and Baker 2 D transformations
 
2 d transformations and homogeneous coordinates
2 d transformations and homogeneous coordinates2 d transformations and homogeneous coordinates
2 d transformations and homogeneous coordinates
 
3D Geometric Transformations
3D Geometric Transformations3D Geometric Transformations
3D Geometric Transformations
 
2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformations
 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphics
 
Composite preparation
Composite preparationComposite preparation
Composite preparation
 

Similar to Lect8 viewing in3d&transformation

6. Perspective Projection .pdf
6. Perspective  Projection                    .pdf6. Perspective  Projection                    .pdf
6. Perspective Projection .pdf
YatruHarshaHiski
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
Ankit Garg
 

Similar to Lect8 viewing in3d&transformation (20)

Theories and Engineering Technics of 2D-to-3D Back-Projection Problem
Theories and Engineering Technics of 2D-to-3D Back-Projection ProblemTheories and Engineering Technics of 2D-to-3D Back-Projection Problem
Theories and Engineering Technics of 2D-to-3D Back-Projection Problem
 
2 transformation computer graphics
2 transformation computer graphics2 transformation computer graphics
2 transformation computer graphics
 
Windows and viewport
Windows and viewportWindows and viewport
Windows and viewport
 
3 projection computer graphics
3 projection computer graphics3 projection computer graphics
3 projection computer graphics
 
Saad alsheekh multi view
Saad alsheekh  multi viewSaad alsheekh  multi view
Saad alsheekh multi view
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Lec15 sfm
Lec15 sfmLec15 sfm
Lec15 sfm
 
Computer Graphics & linear Algebra
Computer Graphics & linear Algebra Computer Graphics & linear Algebra
Computer Graphics & linear Algebra
 
Drawing Tools
Drawing ToolsDrawing Tools
Drawing Tools
 
Deep Learning for Computer Vision: Attention Models (UPC 2016)
Deep Learning for Computer Vision: Attention Models (UPC 2016)Deep Learning for Computer Vision: Attention Models (UPC 2016)
Deep Learning for Computer Vision: Attention Models (UPC 2016)
 
Three dimensional graphics
Three dimensional graphicsThree dimensional graphics
Three dimensional graphics
 
6. Perspective Projection .pdf
6. Perspective  Projection                    .pdf6. Perspective  Projection                    .pdf
6. Perspective Projection .pdf
 
Slides: Perspective click-and-drag area selections in pictures
Slides: Perspective click-and-drag area selections in picturesSlides: Perspective click-and-drag area selections in pictures
Slides: Perspective click-and-drag area selections in pictures
 
Deep single view 3 d object reconstruction with visual hull
Deep single view 3 d object reconstruction with visual hullDeep single view 3 d object reconstruction with visual hull
Deep single view 3 d object reconstruction with visual hull
 
Cs8092 computer graphics and multimedia unit 3
Cs8092 computer graphics and multimedia unit 3Cs8092 computer graphics and multimedia unit 3
Cs8092 computer graphics and multimedia unit 3
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
 
Lesson 9: Parametric Surfaces
Lesson 9: Parametric SurfacesLesson 9: Parametric Surfaces
Lesson 9: Parametric Surfaces
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
 
Parametric surface visualization in Directx 11 and C++
Parametric surface visualization in Directx 11 and C++Parametric surface visualization in Directx 11 and C++
Parametric surface visualization in Directx 11 and C++
 
3D Display
3D Display3D Display
3D Display
 

More from BCET (17)

Lect11 clipping in3d
Lect11 clipping in3dLect11 clipping in3d
Lect11 clipping in3d
 
Lect9 transformation3d
Lect9 transformation3dLect9 transformation3d
Lect9 transformation3d
 
Lect7 viewing in2d
Lect7 viewing in2dLect7 viewing in2d
Lect7 viewing in2d
 
Lect6 transformation2d
Lect6 transformation2dLect6 transformation2d
Lect6 transformation2d
 
Lect5 filling color_models
Lect5 filling color_modelsLect5 filling color_models
Lect5 filling color_models
 
Lect4 ellipse
Lect4 ellipseLect4 ellipse
Lect4 ellipse
 
Lect2 scan convertinglines
Lect2 scan convertinglinesLect2 scan convertinglines
Lect2 scan convertinglines
 
Lect3 bresenham circlesandpolygons
Lect3 bresenham circlesandpolygonsLect3 bresenham circlesandpolygons
Lect3 bresenham circlesandpolygons
 
Lect2 scan convertinglines
Lect2 scan convertinglinesLect2 scan convertinglines
Lect2 scan convertinglines
 
Light pens
Light pensLight pens
Light pens
 
Lcd
LcdLcd
Lcd
 
Graphics inputdevices
Graphics inputdevicesGraphics inputdevices
Graphics inputdevices
 
Crt
CrtCrt
Crt
 
Colour models
Colour modelsColour models
Colour models
 
Cathode ray tube
Cathode ray tubeCathode ray tube
Cathode ray tube
 
Plasma display pannel
Plasma display pannelPlasma display pannel
Plasma display pannel
 
php&mysql with Ethical Hacking
php&mysql with Ethical Hackingphp&mysql with Ethical Hacking
php&mysql with Ethical Hacking
 

Lect8 viewing in3d&transformation