13 Pipeline
13 Pipeline
CS 4810: Graphics
Modeling
Transformation
Camera
Transformation This is a pipelined
sequence of operations
Lighting
to draw a 3D primitive
into a 2D image
Projection
Transformation
Clipping
Scan
Conversion
Image
3D Rendering Pipeline (direct illumination)
3D Geometric Primitives
Lighting
Projection
Transformation
Clipping
Scan
Conversion
Image
3D Rendering Pipeline (for direct illumination)
3D Geometric Primitives
Lighting
Projection
Transformation
Clipping
Scan
Conversion
Image
3D Rendering Pipeline (for direct illumination)
3D Geometric Primitives
Projection
Transformation
Clipping
Scan
Conversion
Image
3D Rendering Pipeline (for direct illumination)
3D Geometric Primitives
Clipping
Scan
Conversion
Image
3D Rendering Pipeline (for direct illumination)
3D Geometric Primitives
Scan
Conversion
Image
3D Rendering Pipeline (for direct illumination)
3D Geometric Primitives
Image
Transformations
3D Geometric Primitives
Image
Transformations
p(x,y,z)
3D Object Coordinates Transformations map points from
one coordinate system to another
Modeling
Transformation
3D World Coordinates
Camera 3D Camera
y
Transformation Coordinates
2D Screen Coordinates
Window-to-Viewport
Transformation
3D World
2D Image Coordinates Coordinates
p’(x’,y’)
Viewing Transformations
p(x,y,z)
3D Object Coordinates
Modeling
Transformation
3D World Coordinates
Camera
Transformation
2D Screen Coordinates
Window-to-Viewport
Transformation
2D Image Coordinates
p’(x’,y’)
Viewing Transformation
• Mapping from world to camera coordinates
oEye position maps to origin
oRight vector maps to X axis
oUp vector maps to Y axis back
oBack vector maps to Z axis up
right
y
View
plane
Camera
-z
x
World
Camera Coordinates
• Canonical coordinate system
oConvention is right-handed (looking down -z axis)
oConvenient for projection, clipping, etc.
Camera up vector
y maps to Y axis
?
Finding the Viewing Transformation
• Trick: map from camera coordinates to world
oOrigin maps to eye position
oZ axis maps to Back vector
oY axis maps to Up vector
oX axis maps to Right vector
Modeling
Transformation
3D World Coordinates
Camera
Transformation
2D Screen Coordinates
Window-to-Viewport
Transformation
2D Image Coordinates
p’(x’,y’)
Projection
• General definition:
oA linear transformation of points in n-space to
m-space (m<n)
• In computer graphics:
oMap 3D camera coordinates to 2D screen coordinates
Taxonomy of Projections
DOP
View
Plane Angel Figure 5.4
Parallel Projection
• Parallel lines remain parallel
• Relative proportions of objects preserved
• Angles are not preserved
• Less realistic looking
oFar away objects don’t get smaller
Taxonomy of Projections
Side Front
Top Isometric
Angel Figure 5.5
Orthographic Projections
• DOP perpendicular to view plane
Top Isometric
Angel Figure 5.5
Taxonomy of Projections
1 1
Cavalier Cabinet
o
(DOP α = 45 ) o
(DOP α = 63.4 )
• φ describes the angle of the projection of the
view plane’s normal
• L represents the scale factor applied to the view
plane’s normal H&B Figure 12.21
Parallel Projection Matrix
• General parallel projection transformation:
1
1
1 1/2
1 1
Cavalier Cabinet
o
(DOP α = 45 ) o
(DOP α = 63.4 )
2 3
x
xp 1 0 L cos 4 y 5
=
yp 0 1 L sin
z
H&B Figure 12.21
Parallel Projection View Volume
sr
to
ec
oj
Pr
Center of
Projection
View
Plane
z
z
x x
x
3-Point 2-Point z 1-Point
Perspective Perspective Perspective
View
Plane
View
Plane
-y
Perspective Projection
• Use the fact that for any point (x0,y0,z0) and any
scalar α, the points (x0,y0,z0) and (αx0, αy0, αz0) map
to the same location:
(2x0,2y0,2z0)
y
(x0,y0,z0)
D
-z (0,0,0) z
View
Plane
-y
Perspective Projection
• Use the fact that for any point (x0,y0,z0) and any
scalar α, the points (x0,y0,z0) and (αx0, αy0, αz0) map
to the same location.
• Since we want the position of the point on the line
that intersect the image plane at a distance of D
along the z-axis:
✓ ◆
D D
(x0 , y0 , z0 ) ! x0 , y0 , D y
z0 z0
(x0,y0,z0)
D
-z (0,0,0) z
View Plane
Perspective Projection Matrix
• 4x4 matrix representation?
Perspective Projection Matrix
• 4x4 matrix representation?
We want to divide by the
z coordinate. How do we
do that with a 4x4 matrix?
Perspective Projection Matrix
• 4x4 matrix representation?
We want to divide by the
z coordinate. How do we
do that with a 4x4 matrix?
Recall that in homogenous
coordinates:
(x, y, z, w) = (x/w, y/w, z/w, 1)
Perspective Projection Matrix
• 4x4 matrix representation?
We want to divide by the
z coordinate. How do we
do that with a 4x4 matrix?
Recall that in homogenous
✓ ◆ coordinates:
xc D yc D (x, y, z, w) = (x/w, y/w, z/w, 1)
, , D, 1
zc zc
⇣ zc ⌘
xc , yc , zc ,
D
Perspective Projection Matrix
• 4x4 matrix representation?
We want to divide by the
z coordinate. How do we
do that with a 4x4 matrix?
Recall that in homogenous
✓ ◆ coordinates:
xc D yc D (x, y, z, w) = (x/w, y/w, z/w, 1)
, , D, 1
zc zc
⇣ zc ⌘
xc , yc , zc ,
D
Taxonomy of Projections
• Parallel projection
+Good for exact measurements
+Parallel lines remain parallel
+Angles are preserved on faces
parallel to the view plane
– Less realistic looking