Intro to projection - PowerPoint PPT Presentation

1 / 70
About This Presentation
Title:

Intro to projection

Description:

Some optical illusions possible. Parallel lines appear to diverge ... Thus for a simple perspective with the COP at (0,0,0), the image plane at z = d. 35 ... – PowerPoint PPT presentation

Number of Views:75
Avg rating:3.0/5.0
Slides: 71
Provided by: edan74
Category:

less

Transcript and Presenter's Notes

Title: Intro to projection


1
Intro to projection
2
Objectives
  • Introduce viewing
  • Derive projection matrices
  • Viewing pipeline

3
Intro to projection
  • Viewing requires three basic elements
  • Object(s) to be viewed
  • Projection surface (image plane)
  • Projectors lines that go from the object(s) to
    the projection surface
  • Projectors are lines that either
  • converge at a center of projection (COP)
  • or are parallel

4
Intro to projection
  • Standard projections project onto a plane
  • Such projections preserve lines
  • but not necessarily angles
  • Nonplanar projections are needed for applications
    such as map construction

5
Classical Projections
6
Parallel vs Perspective
  • Computer graphics treats all projections the same
    and implements them with a single pipeline
  • Classical viewing developed different techniques
    for drawing different types
  • of projections
  • Fundamental distinction is between parallel and
    perspective viewing (even though mathematically
    parallel viewing is the limit of perspective
    viewing)

7
Parallel Projection
8
Perspective Projection
9
Orthographic Projection
  • Projectors are orthogonal to projection surface

10
Advantages and Disadvantages
  • Preserves both distance and angle
  • Shapes are preserved
  • Can be used for measurements
  • Building plans
  • Manfactured parts
  • Cannot see what object really looks like because
    many surfaces hidden from view
  • Often we add the isometric

11
Multi-view Orthographic Projection
  • Projection plane parallel to principal face
  • Usually form front, top, side views

isometric (not orthographic)
top
in CAD and architecture, we often display three
multiviews plus isometric
front
side
12
Oblique Projection
  • Arbitrary relationship between projectors and
    projection plane

13
Advantages and Disadvantages
  • Can pick the angle to emphasize a particular face
  • Architecture plan oblique, elevation oblique
  • Angles in faces parallel to
  • projection plane are
  • preserved while we can
  • still see around side
  • In physical world, cannot create easily with
    simple camera

14
Axonometric Projections
  • Controls projection plane relative to object

Classify by how many angles of a corner of a
projected cube are the equal to each
other three isometric two dimetric none
trimetric
q 1
q 3
q 2
15
Types of Axonometric Projections
16
Advantages and Disadvantages
  • Parallel Lines preserved but angles are not
  • Can see three principal faces of a box-like
    object
  • Some optical illusions possible
  • Parallel lines appear to diverge
  • Does not look real because far objects are scaled
    the same as near objects
  • Used in CAD applications

17
Perspective Projection
  • Projectors converge at center of projection

18
One-Point Perspective
  • One principal face parallel to projection plane
  • One vanishing point for cube

19
Two-Point Perspective
  • On principal direction parallel to projection
    plane
  • Two vanishing points for cube

20
Three-Point Perspective
  • No principal face parallel to projection plane
  • Three vanishing points for cube

21
Advantages and Disadvantages
  • Objects further from viewer are projected smaller
    than the same sized objects closer to the viewer
  • Looks realistic, gives sense of depth
  • Equal distances along a line are not projected
    into equal distances (nonuniform foreshortening)
  • Angles preserved only in planes parallel to the
    projection plane
  • More difficult to construct by hand than parallel
    projections (but not more difficult by computer)

22
For Computer Viewing
  • Derive projection matrices for
  • various projections
  • Introduce camera frame
  • Introduce clipping
  • Introduce projection normalization

23
Computer Viewing
  • There are three aspects of the viewing process
  • Selecting a lens
  • Setting the projection matrix
  • - Positioning the camera
  • Setting the view-orientation matrix
  • Clipping
  • Setting the view volume

24
Orthogonal Projection
25
Orthogonal Projection
  • Set z 0
  • Equivalent homogeneous coordinate transformation

Morth

26
Oblique Projections
27
Oblique Projections
  • Direction of projection dop (dopx,dopy,dopz)

z
dop
x
Lets say we project onto z 0 plane
28
Oblique Projections
  • Direction of projection dop (dopx,dopy,dopz)


ù
é
0
-dopx/dopz
0
1
z
ú
ê
dop
0
dopy/dopz
-
1
0
ú
ê

ú
ê
0
0
0
0
ú
ê
1
0
0
0
û
ë
q
note tanq dopz/dopx
x
29
Perspective Projection
30
Simple Perspective
  • Assume COP (center of projection) is at the
    origin and
  • Projection plane z d, d lt 0, then

31
Perspective Equations
  • Consider top and side views

xp
yp
zp d
32
Homogeneous Coordinate Form
M
  • consider q Mp where

? p
q
33
Perspective Division
  • But recall when w ? 1, we divide by w to return
    from homogeneous coordinates
  • This perspective division yields
  • the desired perspective equations

xp
yp
zp d
34
Simple Perspective
  • Thus for a simple perspective with the COP at
    (0,0,0), the image plane at z d



35
Viewing Volume
Orthographic View Volume
near and far measured from camera
36
Viewing Volume
Perspective View Volume
37
Clipping
  • Removing the unseen geometry
  • Direct (brute-force) solution - solve
    silmultaneous equations for
  • intersections of lines/edges
  • at window edges

A point or vertex is visible if xleft lt x lt
xright and ybot lt y lt ytop
38
Clipping lines
Pipeline, clip each edge of the window separately
39
Clipping polygons
Clip the vertices that are outside of the window
and create new vertices at window border
Result is still a single polygon but may have
more vertices and an odd shape
40
Clipping polygons
41
Clipping polygons
Bounding box - surrounds each polygon
42
Clipping polygons
Trivially reject or accept if the bounding box
falls completely inside or outside.
43
Cohen-Sutherland Algorithm
  • Region Checks Trivially reject or accept
  • for clipping
  • Good for large or small windows (all is in or out
    of window, respectively)
  • Each vertex is assigned an 4-bit outcode
  • bit 1 - sign of (yt - y), point is above window
  • bit 2 - sign of (y-yb), point is below window
  • bit 3 - sign of (xr-x), point is right of window
  • bit 4 - sign of (x - xl), point is left of window

44
Cohen-Sutherland Algorithm
1010 0010 0110
1001 0001 0101
1000 0000 0100
A line can be trivially accepted if both
endpoints have an outcode of 0000. A line can be
trivially rejected if any of the same two bits in
the outcodes are both equal to 1 (both endpoints
are left,right, above, below the window)
45
Clipping 3D
Adds far and near clipping planes for 3D viewing
volume
46
Normalization
  • Rather than derive a different projection matrix
    for each type of projection, we can convert all
    projections to basic projections with a default
    view volume
  • This strategy allows us to use standard
    transformations in the pipeline and makes for
    efficient clipping
  • Volume known as Canonical view volume

47
Orthogonal Normalization
normalization ? find transformation to
convert specified clipping volume to default
(right,top,far)
(1,1,1)
(left,bottom,near)
(-1,-1,-1)
Canonical Volume
48
Orthogonal Normalization
  • Two steps
  • Move center to origin
  • T(-(leftright)/2, -(bottomtop)/2,-(nearfar)/2))
  • Scale to have sides of length 2
  • S(2/(right-left),2/(top-bottom),2/(near-far))

49
Orthogonal Normalization
Combined with orthogonal projection yields
P MorthST
50
Oblique with Normalization
  • To use the same projection, we shear but
  • don't project

ù
é
0
-dopx/dopz
0
1
z
ú
ê
dop
0
dopy/dopz
-
1
0
ú
ê

ú
ê
0
1
0
0
ú
ê
1
0
0
0
û
ë
q
Note no orthogonal projection (yet)
x
51
Oblique with Normalization
  • xy shear (z values unchanged)
  • Projection matrix
  • Normalize as

ù
é
0
-dopx/dopz
0
1
ú
ê
0
dopy/dopz
-
1
0
H
ú
ê
ú
ê
0
1
0
0
ú
ê
1
0
0
0
û
ë
P Morth H
P Morth STH
52
Equivalency
53
Effect on Clipping
  • The projection matrix P STH transforms the
    original clipping volume to the default clipping
    volume

object
z 1
far plane
DOP
DOP
x -1
x 1
near plane
z -1
Clipping Volume
distorted object (projects correctly)
(seen from top view)
54
Perspective Projection
  • How to normalize the frustrum of the
  • perspective view
  • Want to make a canonical volume to clip against,
    just like in the parallel case

55
Canonical Perspective
  • Consider a simple perspective with the COP at the
    origin, the far plane at z 1, and a 90 degree
    field of view determined by the planes x ?z,
  • y ?z

xmin
xmax
Zfar
z
Z 1
xz
x-z
x
x
56
Effect on Clipping
  • Extension to Cohen-Sutherland Clipping

Bit 1 above volume ygt z Bit 2 below
volume ylt-z Bit 3 right of volume
x gtz Bit 4 left of volume x lt-z Bit 5
behind volume z gt 1 Bit 6 in front of
volume zlt zmin
Z 1
xz
x-z
zmin
x
57
Pipeline View
transform projection to canonical view
clipping
projection
against canonical
3D ? 2D
  • Can also add shear for asymmetric views for
    perspective

58
Why do we do it this way?
  • Normalization allows for a single pipeline to be
    used with all (perspective and parallel) desired
    views
  • We keep in four dimensional homogeneous
    coordinates as long as possible to retain
    three-dimensional information needed for
    hidden-surface removal and shading
  • We standardize clipping

59
Computer Viewing
  • There are three aspects of the viewing process
  • Selecting a lens
  • Setting the projection matrix
  • - Positioning the camera
  • Setting the view-orientation matrix
  • Clipping
  • Setting the view volume

60
Camera coordinates
To set camera, we need one more step...
61
Defining and moving the camera
default camera
wanted camera
62
Moving the Camera
  • We can move the camera to any desired position by
    a sequence of rotations and translations
  • Example side view
  • Rotate after moving
  • camera away from origin
  • Camera View matrix
  • Vcam Rcam Tcam

63
Whole camera transform
  • We can put these together as
  • Ttotal Mprojection Vcam
  • But where does camera transform come from?
  • - Prescribed
  • - Generated automatically for games

64
Camera movement
  • Should mimic a real camera
  • -Maintain up-vector
  • -Slow turns
  • -Avoid accelerations

?
65
Camera movement
  • Visibility Planning for Camera Control

66
Camera movement
  • Visibility Planning for Camera Control

Oskan et al 2009
67
Camera control Oskan et al
  • Precomputation 1) Free-space

Space Sphere Overlapping portals Roadmap
68
Camera control Oskan et al
  • Precomputation 2) Visibility

69
Camera control Oskan et al
  • Run-time computation

Initial Conditions Construct Overlap
Path Refine Subsample
70
Camera control Oskan et al
Write a Comment
User Comments (0)
About PowerShow.com