angel, 5.1-5.5 (5.3.2 and 5.3.4 optional) david f. rogers and j ......david f. rogers and j. alan...

7
cse457-08-projections 1 Projections cse457-08-projections 2 Reading Required: Angel, 5.1-5.5 (5.3.2 and 5.3.4 optional) Further reading: Foley, et al, Chapter 5.6 and Chapter 6 David F. Rogers and J. Alan Adams, Mathematical Elements for Computer Graphics, 2 nd Ed., McGraw-Hill, New York, 1990, Chapter 2. cse457-08-projections 3 The pinhole camera The first camera - “camera obscura” - known to Aristotle. In 3D, we can visualize the blur induced by the pinhole (a.k.a., aperture): Q: How would we reduce blur? cse457-08-projections 4 Shrinking the pinhole Q: What happens as we continue to shrink the aperture?

Upload: others

Post on 24-Jan-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Angel, 5.1-5.5 (5.3.2 and 5.3.4 optional) David F. Rogers and J ......David F. Rogers and J. Alan Adams, Mathematical Elements for Computer Graphics, 2nd Ed., McGraw-Hill, New York,

cse457-08-projections 1

Projections

cse457-08-projections 2

Reading

Required:

� Angel, 5.1-5.5 (5.3.2 and 5.3.4 optional)

Further reading:

� Foley, et al, Chapter 5.6 and Chapter 6� David F. Rogers and J. Alan Adams,

Mathematical Elements for ComputerGraphics, 2nd Ed., McGraw-Hill, New York,1990, Chapter 2.

cse457-08-projections 3

The pinhole camera

The first camera - “camera obscura” - known toAristotle.

In 3D, we can visualize the blur induced by the pinhole(a.k.a., aperture):

Q: How would we reduce blur?

cse457-08-projections 4

Shrinking the pinhole

Q: What happens as we continue to shrink theaperture?

Page 2: Angel, 5.1-5.5 (5.3.2 and 5.3.4 optional) David F. Rogers and J ......David F. Rogers and J. Alan Adams, Mathematical Elements for Computer Graphics, 2nd Ed., McGraw-Hill, New York,

cse457-08-projections 5

Shrinking the pinhole, cont’d

cse457-08-projections 6

In practice, pinhole cameras require longexposures, can suffer from diffraction effects, andgive an inverted image.

In graphics, none of these physical limitations is aproblem.

The image is rendered onto an image plane(usually in front of the camera).

Viewing rays emanate from the center ofprojection (COP) at the center of the pinhole.

The image of an object point P is at theintersection of the viewing ray through P and theimage plane.

Imaging with the syntheticcamera

cse457-08-projections 7

3D Geometry Pipeline

Before being turned into pixels by graphics hardware, apiece of geometry goes through a number oftransformations...

cse457-08-projections 8

3D Geometry Pipeline (cont’d)

Page 3: Angel, 5.1-5.5 (5.3.2 and 5.3.4 optional) David F. Rogers and J ......David F. Rogers and J. Alan Adams, Mathematical Elements for Computer Graphics, 2nd Ed., McGraw-Hill, New York,

cse457-08-projections 9

Projections

Projections transform points in n-space to m-space, where m<n.

In 3-D, we map points from 3-space to theprojection plane (PP) (a.k.a., image plane) alongprojectors (a.k.a., viewing rays) emanating fromthe center of projection (COP):

There are two basic types of projections:

� Parallel – distance from COP to PP infinite� Perspective – distance from COP to PP finite

cse457-08-projections 10

Parallel projections

For parallel projections, we specify a direction ofprojection (DOP) instead of a COP.

Depending on the position of the orientation of theprojection plane (image plane) we can categorize theprojections as

� Orthographic projection – DOP perpendicularto PP

� Oblique projection – DOP not perpendicularto PP

We can write orthographic projection onto the z=0plane with a simple matrix.

Normally, we do not drop the z value right away.Why not?

=

′′

1100000100001

1zyx

yx

cse457-08-projections 11

Some parallel projections

Escaping Flatland is one of a series of sculptures by Edward Tuftehttp://www.edwardtufte.com/tufte/sculpture

MGH 389 Room Schematic

cse457-08-projections 12

Properties of parallel projection

Properties of parallel projection:

� Not realistic looking� Good for exact measurements� Are actually a kind of affine transformation

• Parallel lines remain parallel• Ratios are preserved• Angles not (in general) preserved

� Most often used in CAD, architecturaldrawings, etc., where taking exactmeasurement is important

Page 4: Angel, 5.1-5.5 (5.3.2 and 5.3.4 optional) David F. Rogers and J ......David F. Rogers and J. Alan Adams, Mathematical Elements for Computer Graphics, 2nd Ed., McGraw-Hill, New York,

cse457-08-projections 13

Derivation of perspectiveprojectionConsider the projection of a point onto theprojection plane:

By similar triangles, we can compute how muchthe x and y coordinates are scaled:

[Note: Angel takes d to be a negative number,and thus avoids using a minus sign.]

cse457-08-projections 14

Perspective projection

We can write the perspective projection as a matrixequation:

But remember we said that affine transformations workwith the last coordinate always set to one.

� How can we bring this back to w'=1? Divide!� This division step is the “perspective divide.”

Again, projection implies dropping the z coordinate to give a2D image, but we usually keep it around a little while longer.

''

1 1

x dzxyy dz

− = −

−=

′′′

=

−dzyx

wyx

zyx

d 1010000100001

cse457-08-projections 15

Projective normalization

After applying the perspective transformation anddividing by w, we are free to do a simple parallelprojection to get the 2D image.

What does this imply about the shape of thingsafter the perspective transformation + divide?

cse457-08-projections 16

A perspective effect

Hitchcock! likedirector inducing- vertigoa becan you ), (changing

camera thedollying areyou t amount tha the toproportionin ) (changing zoomingby So,

plane. image in the movenot point will theoflocation apparent theandconstant stay willthen

constant,stay tofor arrangecan you If

Recall

z

d

yzd

zdyy

zy

dy

−=′

=−

Page 5: Angel, 5.1-5.5 (5.3.2 and 5.3.4 optional) David F. Rogers and J ......David F. Rogers and J. Alan Adams, Mathematical Elements for Computer Graphics, 2nd Ed., McGraw-Hill, New York,

cse457-08-projections 17

Vanishing points

What happens to two parallel lines that are notparallel to the projection plane?

Think of train tracks receding into the horizon...

The equation for a line is:

After perspective transformation we get:

1 0

x x

y y

z z

p vp v

t tp v

= + = +

l p v

''' ( )/

x x

y y

z z

x p tvy p tvw p tv d

+ = + − +

cse457-08-projections 18

Vanishing points (cont'd)

Dividing by w:

Letting t go to infinity:

We get a point!

What happens to the line l = q + tv?

Each set of parallel lines intersect at a vanishingpoint on the Projection Plane.

Q: How many vanishing points are there?

'''

1

x x

z z

y y

z z

p tv dp tv

xp tv

y dp tv

w

+ − + + = − +

cse457-08-projections 19

Another look at vanishing points

ykykyzdyzdky

yy

zdyy

zdkyy

p

v

pv

+=

+=

+=

=+=

1

)(

)(

and )(

cse457-08-projections 20

Clipping and the viewing frustum

The center of projection and the portion of theprojection plane that map to the final image forman infinite pyramid. The sides of the pyramid areclipping planes.

Frequently, additional clipping planes are insertedto restrict the range of depths. These clippingplanes are called the near and far or the hitherand yon clipping planes.

All of the clipping planes bound the the viewingfrustum.

Page 6: Angel, 5.1-5.5 (5.3.2 and 5.3.4 optional) David F. Rogers and J ......David F. Rogers and J. Alan Adams, Mathematical Elements for Computer Graphics, 2nd Ed., McGraw-Hill, New York,

cse457-08-projections 21

Properties of perspectiveprojectionsThe perspective projection is an example of aprojective transformation.

Here are some properties of projectivetransformations:

� Lines map to lines� Parallel lines do not necessarily remain

parallel� Ratios are not preserved

One of the advantages of perspective projection isthat size varies inversely with distance – looksrealistic.

A disadvantage is that we can't judge distancesas exactly as we can with parallel projections.

cse457-08-projections 22

Some view transformations

http://www.cs.technion.ac.il/~gershon/EscherForReal/

http://www.ntv.co.jp/kasoh/past_movie/contents.html

cse457-08-projections 23

An oblique projection

Larry Kagan:Wall Sculpture in Steel and Shadow

http://www.arts.rpi.edu/~kagan/

cse457-08-projections 24

Human vision and perspective

The human visual system uses a lens to collectlight more efficiently, but records perspectivelyprojected images much like a pinhole camera.

Q: Why did nature give us eyes that perform perspective projections?

� How would you construct a vision system that didparallel projections?

Q: Do our eyes “see in 3D”?

Page 7: Angel, 5.1-5.5 (5.3.2 and 5.3.4 optional) David F. Rogers and J ......David F. Rogers and J. Alan Adams, Mathematical Elements for Computer Graphics, 2nd Ed., McGraw-Hill, New York,

cse457-08-projections 25

From up here, you all look likelittle tiny ants ...

http://www.eyestilts.com/

cse457-08-projections 26

Summary

What to take away from this lecture:

� All the boldfaced words.� An appreciation for the various coordinate

systems used in computer graphics.� How a pinhole camera works.� How orthographic projection works.� How the perspective transformation works.� How we use homogeneous coordinates to

represent perspective projections.� The properties of vanishing points.� The mathematical properties of projective

transformations.