cs559: computer graphics lecture 9: projection li zhang spring 2008

49
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008

Upload: stephen-barrett

Post on 31-Dec-2015

222 views

Category:

Documents


1 download

TRANSCRIPT

CS559 Computer Graphics

Lecture 9 ProjectionLi Zhang

Spring 2008

Todaybull Projection

bull Reading ndash Shirley ch 7

Geometric Interpretation 3D Rotations

bull Can construct rotation matrix from 3 orthonormal vectorsbull Rows of matrix are 3 unit vectors of new coord framebull Effectively projections of point into new coord frame

u u u

uvw v v v u u u

w w w

x y z

R x y z u x X y Y z Z

x y z

u u u p

v v v p

w w w p

x y z x

Rp x y z y

x y z z

u p

v p

w p

The 3D synthetic camera model

The synthetic camera model involves two componentsspecified independentlybull objects (aka geometry)bull viewer (aka camera)

Imaging with the synthetic camera

The image is rendered onto an image plane or projection plane (usuallyin front of the camera)Projectors emanate from the center of projection (COP) at the center of the lens (or pinhole)The image of an object point P is at the intersection of the projectorthrough P and the image plane

Specifying a viewer

Camera specification requires four kinds of parameters1048714 Position the COP1048714 Orientation rotations about axes with origin at the COP1048714 Focal length determines the size of the image on the film plane or the field of view1048714 Film plane its width and height

3D Geometry Pipeline

Model Space(Object Space) World Space

Rotation Translation

Resizing

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

px eex

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

)( epx eex

)( epy eey

)( epz eez

1000

|100

010

|001

1000

0

0

0

T

T

T

e

z

y

x

Me

e

e

v

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Todaybull Projection

bull Reading ndash Shirley ch 7

Geometric Interpretation 3D Rotations

bull Can construct rotation matrix from 3 orthonormal vectorsbull Rows of matrix are 3 unit vectors of new coord framebull Effectively projections of point into new coord frame

u u u

uvw v v v u u u

w w w

x y z

R x y z u x X y Y z Z

x y z

u u u p

v v v p

w w w p

x y z x

Rp x y z y

x y z z

u p

v p

w p

The 3D synthetic camera model

The synthetic camera model involves two componentsspecified independentlybull objects (aka geometry)bull viewer (aka camera)

Imaging with the synthetic camera

The image is rendered onto an image plane or projection plane (usuallyin front of the camera)Projectors emanate from the center of projection (COP) at the center of the lens (or pinhole)The image of an object point P is at the intersection of the projectorthrough P and the image plane

Specifying a viewer

Camera specification requires four kinds of parameters1048714 Position the COP1048714 Orientation rotations about axes with origin at the COP1048714 Focal length determines the size of the image on the film plane or the field of view1048714 Film plane its width and height

3D Geometry Pipeline

Model Space(Object Space) World Space

Rotation Translation

Resizing

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

px eex

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

)( epx eex

)( epy eey

)( epz eez

1000

|100

010

|001

1000

0

0

0

T

T

T

e

z

y

x

Me

e

e

v

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Geometric Interpretation 3D Rotations

bull Can construct rotation matrix from 3 orthonormal vectorsbull Rows of matrix are 3 unit vectors of new coord framebull Effectively projections of point into new coord frame

u u u

uvw v v v u u u

w w w

x y z

R x y z u x X y Y z Z

x y z

u u u p

v v v p

w w w p

x y z x

Rp x y z y

x y z z

u p

v p

w p

The 3D synthetic camera model

The synthetic camera model involves two componentsspecified independentlybull objects (aka geometry)bull viewer (aka camera)

Imaging with the synthetic camera

The image is rendered onto an image plane or projection plane (usuallyin front of the camera)Projectors emanate from the center of projection (COP) at the center of the lens (or pinhole)The image of an object point P is at the intersection of the projectorthrough P and the image plane

Specifying a viewer

Camera specification requires four kinds of parameters1048714 Position the COP1048714 Orientation rotations about axes with origin at the COP1048714 Focal length determines the size of the image on the film plane or the field of view1048714 Film plane its width and height

3D Geometry Pipeline

Model Space(Object Space) World Space

Rotation Translation

Resizing

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

px eex

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

)( epx eex

)( epy eey

)( epz eez

1000

|100

010

|001

1000

0

0

0

T

T

T

e

z

y

x

Me

e

e

v

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

The 3D synthetic camera model

The synthetic camera model involves two componentsspecified independentlybull objects (aka geometry)bull viewer (aka camera)

Imaging with the synthetic camera

The image is rendered onto an image plane or projection plane (usuallyin front of the camera)Projectors emanate from the center of projection (COP) at the center of the lens (or pinhole)The image of an object point P is at the intersection of the projectorthrough P and the image plane

Specifying a viewer

Camera specification requires four kinds of parameters1048714 Position the COP1048714 Orientation rotations about axes with origin at the COP1048714 Focal length determines the size of the image on the film plane or the field of view1048714 Film plane its width and height

3D Geometry Pipeline

Model Space(Object Space) World Space

Rotation Translation

Resizing

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

px eex

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

)( epx eex

)( epy eey

)( epz eez

1000

|100

010

|001

1000

0

0

0

T

T

T

e

z

y

x

Me

e

e

v

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Imaging with the synthetic camera

The image is rendered onto an image plane or projection plane (usuallyin front of the camera)Projectors emanate from the center of projection (COP) at the center of the lens (or pinhole)The image of an object point P is at the intersection of the projectorthrough P and the image plane

Specifying a viewer

Camera specification requires four kinds of parameters1048714 Position the COP1048714 Orientation rotations about axes with origin at the COP1048714 Focal length determines the size of the image on the film plane or the field of view1048714 Film plane its width and height

3D Geometry Pipeline

Model Space(Object Space) World Space

Rotation Translation

Resizing

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

px eex

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

)( epx eex

)( epy eey

)( epz eez

1000

|100

010

|001

1000

0

0

0

T

T

T

e

z

y

x

Me

e

e

v

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Specifying a viewer

Camera specification requires four kinds of parameters1048714 Position the COP1048714 Orientation rotations about axes with origin at the COP1048714 Focal length determines the size of the image on the film plane or the field of view1048714 Film plane its width and height

3D Geometry Pipeline

Model Space(Object Space) World Space

Rotation Translation

Resizing

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

px eex

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

)( epx eex

)( epy eey

)( epz eez

1000

|100

010

|001

1000

0

0

0

T

T

T

e

z

y

x

Me

e

e

v

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

3D Geometry Pipeline

Model Space(Object Space) World Space

Rotation Translation

Resizing

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

px eex

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

)( epx eex

)( epy eey

)( epz eez

1000

|100

010

|001

1000

0

0

0

T

T

T

e

z

y

x

Me

e

e

v

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

px eex

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

)( epx eex

)( epy eey

)( epz eez

1000

|100

010

|001

1000

0

0

0

T

T

T

e

z

y

x

Me

e

e

v

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

px eex

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

)( epx eex

)( epy eey

)( epz eez

1000

|100

010

|001

1000

0

0

0

T

T

T

e

z

y

x

Me

e

e

v

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

px eex

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

)( epx eex

)( epy eey

)( epz eez

1000

|100

010

|001

1000

0

0

0

T

T

T

e

z

y

x

Me

e

e

v

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

World -gt eye transformationbull Letrsquos look at how we would compute the

world-gteye transformation

ex

wx

wx

ezey

wy

e

exez

ey

p

p

p

)( epx eex

)( epy eey

)( epz eez

1000

|100

010

|001

1000

0

0

0

T

T

T

e

z

y

x

Me

e

e

v

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

How to specify eye coordinate

e

p

u ep

epz

eex

ezey

e

ee zu

zux

ee

eee xz

xzy

1 Give eye location e2 Give target position p3 Give upward direction u

OpenGL has a helper command gluLookAt (eyex eyey eyez px py pz upx upy upz )

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Projectionsbull Projections transform points in n-space to m-space

where mltnbull In 3-D we map points from 3-space to the projection

plane (PP) (aka image plane) along projectors (aka viewing rays) emanating from the center of projection (COP)

bull There are two basic types of projectionsndash Perspective ndash distance from COP to PP finitendash Parallel ndash distance from COP to PP infinite

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Parallel projectionsbull For parallel projections we specify a direction of

projection (DOP) instead of a COPbull We can write orthographic projection onto the z=0

plane with a simple matrix such that xrsquo=x yrsquo=y

bull Normally we do not drop the z value right away Why not

1 0 0 0

0 1 0 0

1 0 0 0 11

xx

yy

z

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

bull Properties of parallel projectionndash Are actually a kind of affine transformation

bull Parallel lines remain parallelbull Ratios are preservedbull Angles not (in general) preserved

ndash Not realistic lookingndash Good for exact measurements

Most often used in bull CAD bull architectural drawings bull etc

where taking exact measurement is important

Properties of parallel projection

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Perspective effect

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Perspective Illusion

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Perspective Illusion

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Derivation of perspective projection

Consider the projection of a point onto the projection plane

By similar triangles we can compute how much the x and y coordinates are scaled

z

y

d

y

yz

dy

xz

dx

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Homogeneous coordinates and perspective projection

Now we can re-write the perspective projection as a matrix equation

1

)(

)(

1

yzd

xzd

y

x

dz

y

x

1

z

y

x

10100

0100

0010

0001

1000

0010

0001

z

y

x

d

1

)(

)(

d

yzd

xzd

dz

z

y

x

0100

0010

0001

d

Orthographic projection

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Vanishing pointsWhat happens to two parallel lines that are not parallel to the projection planeThink of train tracks receding into the horizon

The equation for a line is

After perspective transformation we get1 0

x x

y y

z z

p v

p vt t

p v

l p v

0100

0010

0001

d

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Vanishing points (contd)Dividing by w

Letting t go to infinity

We get a point

What happens to the line l = q + tvEach set of parallel lines intersect at a vanishing point on the PP Q How many vanishing points are there

1

)(

)(

dvv

dvv

zy

zx

dtvp

tvp

tvp

z

y

x

zz

yy

xx

)(

1

dtvp

tvp

dtvp

tvp

zz

yy

zz

xx

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Vanishing points

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Vanishing points

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Vanishing points

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

General Projective Transformation

ponm

lkgi

hgfe

dcba

transformprojective

1000

transformaffinelkgi

hgfe

dcba

The perspective projection is an example of a projective transformation

10100

0100

0010

0001

z

y

x

d

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Properties of perspective projections

Here are some properties of projective transformations

ndash Lines map to linesndash Parallel lines do not necessarily remain parallelndash Ratios are not preserved

One of the advantages of perspective projection is that size varies inversely with distance ndash looks realisticA disadvantage is that we cant judge distances as exactly as we can with parallel projections

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Clipping and the viewing frustumThe center of projection and the portion of the projection plane that map to the final image form an infinite pyramid The sides of the pyramid are clipping planesFrequently additional clipping planes are inserted to restrict the range of depths These clipping planes are called the near and far or the hither and yon clipping planes

All of the clipping planes bound the viewing frustum

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Clipping and the viewing frustumbull Notice that it doesnrsquot really matter where the image plane is

located once you define the view volumendash You can move it forward and backward along the z axis and

still get the same image only scaled

Usually d = near

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Clipping Planes

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

nl

r

The leftrighttopbottom planes are defined according to where they cut the near clip plane

Need 6 parametersOr define the leftright and topbottom clip planes by the field of view

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Field of View

xv

-zv

Near Clip Plane

Far Clip PlaneView

Volume

Left ClipPlane

Right ClipPlane

f

FOV

Assumes a symmetric view volume

Need 4 parametersOr define the near far fov aspect ratio

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Focal Distance to FOVbull You must have the image size to do this

conversionndash Why Same d different image size different FOV

d

d

FOV2

height2

d

heightFOV

d

heightFOV

2tan2

22tan

1

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Perspective Parametersbull We have seen three different ways to describe a

perspective camerandash Clipping planes Field of View Focal distance

bull The most general is clipping planes ndash they directly describe the region of space you are viewing

bull For most graphics applications field of view is the most convenient

bull You can convert one thing to another

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Perspective Projection Matrices

bull We want a matrix that will take points in our perspective view volume and transform them into the orthographic view volumendash This matrix will go in our pipeline before an

orthographic projection matrix

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Mapping Lines

bull We want to map all the lines through the center of projection to parallel linesndash This converts the perspective case to

the orthographic case we can use all our existing methods

bull The relative intersection points of lines with the near clip plane should not change

bull The matrix that does this looks like the matrix for our simple perspective case

nf

-zy

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

How to get this mapping

0100

00

0010

0001

n

BAM

1

)(

1

BAn

y

x

n

y

x

M

1

))((

)(

)(

1

BAffn

yfn

xfn

f

y

x

Mn ffBn

fA

1

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

nf

-zy

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Properties of this mapping

0100

)(00

0010

0001

n

fnfnM

111

z

fnnf

z

nyz

nx

z

y

x

Mz

y

xIf z = n M(xyz1) = [xyz1] near plane is unchanged

If xz = c1 yz = c2 then xrsquo=nc1 yrsquo=nc2 bending converging rays to parallel rays

If z1 lt z2 z1rsquo lt z2rsquo z ordering is preserved

nf

-zy

1

)(

)(

10100

0100

0010

0001

n

yzn

xzn

z

y

x

n

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

General Perspective

0100

00

000

000

0100

00

0010

0001

nffn

n

n

n

fnfnPM

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

To Canonical view volume

bull Perspective projection transforms a pyramid volume to an orthographic view volume

(lbn)(rtn) (lbn)

(rtn) (rtf)(rtf)

(1-11)

(-11-1)

Canonical view volume [-11]^3

Rotate translate

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Orthographic View to Canonical Matrix

1000

2100

2010

2001

1000

0200

0020

0002

1

fn

bt

lr

fn

bt

lr

z

y

x

canonical

canonical

canonical

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Orthographic View to Canonical Matrix

viewcanonicalviewcanonical

view

view

view

canonical

canonical

canonical

z

y

x

fnfnfn

btbtbt

lrlrlr

fn

bt

lr

fn

bt

lr

z

y

x

xMx

11000

200

020

002

1000

2100

2010

2001

1000

0200

0020

0002

1

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Complete Perspective Projection bull After applying the perspective matrix we map

the orthographic view volume to the canonical view volume

0100

00

000

000

1000

200

02

0

002

nffn

n

n

fn

fn

fn

bt

bt

bt

lr

lr

lr

POcanonicalview MMM

worldcanonicalworldcanonical

viewworldcanonicalviewcanonicalworld

xMx

MMM

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

3D Geometry Pipeline

Model Space(Object Space) World Space Eye Space

(View Space)Rotation

TranslationResizing

Rotation Translation

ProjectiveScale

Translation

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

3D Geometry Pipeline (contrsquod)

Normalized ProjectionSpace

ProjectScreen Space (2D)

ScaleTranslation

Image Space (pixels)Raster Space

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Canonical Window Transform

(-1-1)

(11)

(xminymin)

(xmaxymax)

11000

0100

2020

2002

1

minmaxminmax

minmaxminmax

canonical

canonical

canonical

pixel

pixel

pixel

z

y

x

yyyy

xxxx

z

y

x

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear

Mapping of Z is nonlinear

bull Many mappings proposed all have nonlinearitiesbull Advantage handles range of depths (10cm ndash 100m)bull Disadvantage depth resolution not uniformbull More close to near plane less further awaybull Common mistake set near = 0 far = infty Donrsquot do this

Canrsquot set near = 0 lose depth resolution

Az B BA

z z

  • CS559 Computer Graphics
  • Today
  • Geometric Interpretation 3D Rotations
  • The 3D synthetic camera model
  • Imaging with the synthetic camera
  • Specifying a viewer
  • 3D Geometry Pipeline
  • Slide 8
  • 3D Geometry Pipeline (contrsquod)
  • World -gt eye transformation
  • Slide 11
  • How to specify eye coordinate
  • Projections
  • Parallel projections
  • Slide 15
  • Properties of parallel projection
  • Perspective effect
  • Perspective Illusion
  • Slide 19
  • Derivation of perspective projection
  • Homogeneous coordinates and perspective projection
  • Vanishing points
  • Vanishing points (contd)
  • Slide 24
  • Slide 25
  • Slide 26
  • General Projective Transformation
  • Properties of perspective projections
  • Slide 29
  • Clipping and the viewing frustum
  • Slide 31
  • Clipping Planes
  • Field of View
  • Focal Distance to FOV
  • Perspective Parameters
  • Perspective Projection Matrices
  • Mapping Lines
  • How to get this mapping
  • Properties of this mapping
  • General Perspective
  • To Canonical view volume
  • Orthographic View to Canonical Matrix
  • Slide 43
  • Complete Perspective Projection
  • Slide 45
  • Slide 46
  • Canonical Window Transform
  • Slide 48
  • Mapping of Z is nonlinear