35
Projections

Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Projections

Page 2: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Reading

Angel. Chapter 5

Optional

David F. Rogers and J. Alan Adams, Mathematical Elements for Computer Graphics, Second edition, McGraw-Hill, New York, 1990, Chapter 3.

Page 3: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

The 3D synthetic camera model

The synthetic camera model involves two components, specified independently:

w  objects (a.k.a. geometry) w  viewer (a.k.a. camera)

Page 4: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Imaging with the synthetic camera

The image is rendered onto an image plane or projection plane (usually in 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 projector through P and the image plane.

Page 5: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Specifying a viewer

Camera specification requires four kinds of parameters:

w  Position: the COP. w  Orientation: rotations about axes with origin at the COP. w  Focal length: determines the size of the image on the film plane, or

the field of view. w  Film plane: its width and height, and possibly orientation.

Page 6: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

3D Geometry Pipeline

Page 7: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection
Page 8: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Projections

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

In 3D, we map points from 3-space to the projection plane (PP) along projectors emanating from the center of projection (COP).

There are two basic types of projections:

w  Perspective - distance from COP to PP finite w  Parallel - distance from COP to PP infinite

COP

PP

Page 9: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Parallel and Perspective Projection

Page 10: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Perspective vs. parallel projections

Perspective projections pros and cons:

+  Size varies inversely with distance - looks realistic –  Distance and angles are not (in general) preserved –  Parallel lines do not (in general) remain parallel

Parallel projection pros and cons:

–  Less realistic looking +  Good for exact measurements +  Parallel lines remain parallel –  Angles not (in general) preserved

Page 11: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Parallel projections

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

There are two types of parallel projections:

w  Orthographic projection — DOP perpendicular to PP w  Oblique projection — DOP not perpendicular to PP

Page 12: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Orthographic Projections

Page 13: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Orthographic transformation

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

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

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

⎡ ⎤⎡ ⎤⎡ ⎤ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥= ⎢ ⎥⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥⎣ ⎦ ⎣ ⎦

⎣ ⎦

Page 14: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Oblique Projections

Page 15: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Oblique projections

Two standard oblique projections:

w  Cavalier projection DOP makes 45 angle with PP Does not foreshorten lines perpendicular to PP

w  Cabinet projection DOP makes 63.4 angle with PP Foreshortens lines perpendicular to PP by one-half

Page 16: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Projection taxonomy

Page 17: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Properties of projections

The perspective projection is an example of a projective transformation.

Here are some properties of projective transformations:

w  Lines map to lines w  Parallel lines don’t necessarily remain parallel w  Ratios are not preserved

Page 18: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

A typical eye space

w  Eye •  Acts as the COP •  Placed at the origin •  Looks down the z-axis

w  Screen •  Lies in the PP •  Perpendicular to z-axis •  At distance d from the eye •  Centered on z-axis, with radius s

Q: Which objects are visible?

Page 19: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Eye space è screen space

Q: How do we perform the perspective projection from eye space into screen space?

Using similar triangles gives:

(x,y,z)x

zd

xʹ′

Page 20: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Eye space è screen space, cont.

We can write this transformation in matrix form:

Perspective divide:

1 0 0 00 1 0 00 0 1 00 0 1/ 0 1 /

X x xY y y

MPZ z zW d z d

⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥= = =⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦

/ //

///

1

xX W z dY W y

z dZ WdW W

⎡ ⎤⎢ ⎥⎡ ⎤⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥ =⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥

⎣ ⎦ ⎢ ⎥⎢ ⎥⎣ ⎦

Page 21: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Projective Normalization

After perspective transformation and perspective divide, we apply parallel projection (drop the z) to get a 2D image.

Page 22: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Perspective depth

Q: What did our perspective projection do to z?

Often, it’s useful to have a z around — e.g., for hidden surface calculations.

Page 23: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection
Page 24: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection
Page 25: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Vanishing points

Under perspective projections, any set of parallel lines that are not parallel to the PP will converge to a vanishing point.

Vanishing points of lines parallel to a principal axis x, y, or z are called principal vanishing points.

How many of these can there be?

Page 26: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Vanishing points

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

+⎡ ⎤ ⎡ ⎤⎢ ⎥ ⎢ ⎥= +⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥− +⎣ ⎦ ⎣ ⎦

Page 27: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

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 vanishing point on the PP.

Q: How many vanishing points are there?

'''

1

x x

z z

y y

z z

p tvd

p tvx

p tvy d

p tvw

+⎡ ⎤−⎢ ⎥+⎢ ⎥⎡ ⎤⎢ ⎥+⎢ ⎥ = −⎢ ⎥⎢ ⎥ +⎢ ⎥⎢ ⎥⎣ ⎦ ⎢ ⎥⎢ ⎥⎢ ⎥⎣ ⎦

'lim '

'1

t

x

z

y

z

vd

vx

vy d

vw

→∞

⎡ ⎤−⎢ ⎥⎢ ⎥⎡ ⎤⎢ ⎥⎢ ⎥ = −⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎣ ⎦ ⎢ ⎥⎢ ⎥⎢ ⎥⎣ ⎦

Page 28: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Vanishing Points

Page 29: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Types of perspective drawing

If we define a set of principal axes in world coordinates, i.e., the xw, yw, and zw axes, then it's possible to choose the viewpoint such that these axes will converge to different vanishing points.

The vanishing points of the principal axes are called the principal vanishing points.

Perspective drawings are often classified by the number of principal vanishing points.

w  One-point perspective — simplest to draw w  Two-point perspective — gives better impression of depth w  Three-point perspective — most difficult to draw

All three types are equally simple with computer graphics.

Page 30: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

General perspective projection

In general, the matrix

performs a perspective projection into the plane px + qy + rz + s = 1.

Q: Suppose we have a cube C whose edges are aligned with the principal axes. Which matrices give drawings of C with

w  one-point perspective? w  two-point perspective? w  three-point perspective?

⎥⎥⎥⎥

⎢⎢⎢⎢

srqp1

11

Page 31: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

General Projections

Suppose you have a camera with COP c, and x, y, and z axes are unit vectors i, j and k respectively. How do we compute the projection?

Page 32: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

World Space Camera

Page 33: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Hither and yon planes

In order to preserve depth, we set up two planes:

w  The hither (near) plane w  The yon (far) plane

Page 34: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Projection taxonomy

Page 35: Projections - University of WashingtonOrthographic transformation For parallel projections, we specify a direction of projection (DOP) instead of a COP. We can write orthographic projection

Summary

Here’s what you should take home from this lecture:

w  The classification of different types of projections. w  The concepts of vanishing points and one-, two-, and three-point

perspective. w  An appreciation for the various coordinate systems used in computer

graphics. w  How the perspective transformation works.