Dr' Jinxiang Chai - PowerPoint PPT Presentation

1 / 92
About This Presentation
Title:

Dr' Jinxiang Chai

Description:

Direction of projection (DOP) same for all points. Orthographic Projection ... DOP not perpendicular to view plane. A. A' O. Oblique Projection ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 93
Provided by: symo5
Category:
Tags: chai | dop | jinxiang

less

Transcript and Presenter's Notes

Title: Dr' Jinxiang Chai


1
CPSC 441 Computer Graphics3-D Viewing
  • Dr. Jinxiang Chai

2
Review
  • 2D Coordinate transform
  • Composite transformation
  • 3D transformation
  • Required readings HB 5-9 to 5-17

3
Review 2D Coordinate Trans.
  • Transform object description from to

p
4
Review 2D Coordinate Trans.
  • Transform object description from to

p
3
5
Review Composite 2DTrans.
  • Whats the world coordinate of A ?

A
World coordinate frame
6
Review 3D Transformation
  • Very similar to 2D transformation

3D translation
3D Scaling
7
Review 3D Rotation
  • Transformation matrix for rotating about an
    arbitrary axis is more complex

8
3D Transformation
  • Rotation about z
  • Rotate about y
  • Rotate about x

y
x
z
7
9
Review Composite 3D Trans.
8
10
Outline
  • 3D Viewing
  • Required readings HB 7-1 to 7-10
  • Compile and run the codes in page 388

9
11
Taking Pictures Using A Real Camera
  • Steps
  • - Identify interesting objects
  • - Rotate and translate the camera to a desire
    camera viewpoint
  • - Adjust camera settings such as focal length
  • - Choose desired resolution and aspect ratio,
    etc.
  • - Take a snapshot

12
Taking Pictures Using A Real Camera
  • Steps
  • - Identify interesting objects
  • - Rotate and translate the camera to a desire
    camera viewpoint
  • - Adjust camera settings such as focal length
  • - Choose desired resolution and aspect ratio,
    etc.
  • - Take a snapshot
  • Graphics does the same thing for rendering an
    image for 3D geometric objects

13
3D Geometry Pipeline
Rotate and translate the camera
View space
World space
Object space
Focal length
Aspect ratio resolution
Normalized project space
Image space
12
14
3D Geometry Pipeline
  • Before being turned into pixels by graphics
    hardware, a piece of geometry goes through a
    number of transformations...

Model space (Object space)
15
3D Geometry Pipeline
  • Before being turned into pixels by graphics
    hardware, a piece of geometry goes through a
    number of transformations...

World space (Object space)
16
3D Geometry Pipeline
  • Before being turned into pixels by graphics
    hardware, a piece of geometry goes through a
    number of transformations...

Eye space (View space)
17
3D Geometry Pipeline
  • Before being turned into pixels by graphics
    hardware, a piece of geometry goes through a
    number of transformations...

Normalized projection space
18
3D Geometry Pipeline
  • Before being turned into pixels by graphics
    hardware, a piece of geometry goes through a
    number of transformations...

Image space, window space, raster space, screen
space, device space
19
3D Geometry Pipeline
View space
World space
Object space
Normalized project space
Image space
20
3D Geometry Pipeline
Translate, scale rotate
World space
Object space
glTranslate(tx,ty,tz)
21
3D Geometry Pipeline
Translate, scale rotate
Object space
World space
glScale(sx,sy,sz)
22
3D Geometry Pipeline
Translate, scale rotate
Object space
World space
Rotate about r by the angle
glRotate
23
3D Geometry Pipeline
View space
World space
Object space
Normalized project space
Image space
Screen space
24
3D Geometry Pipeline
  • Now look at how we would compute the world-gteye
    transformation

View space
World space
25
3D Geometry Pipeline
  • Now look at how we would compute the world-gteye
    transformation

Rotatetranslate
View space
World space
26
Camera Coordinate
  • Canonical coordinate system
  • - usually right handed (looking down z
    axis)
  • - convenient for project and clipping

27
Camera Coordinate
  • Mapping from world to eye coordinates
  • - eye position maps to origin
  • - right vector maps to x axis
  • - up vector maps to y axis
  • - back vector maps to z axis

28
Viewing Transformation
  • We have the camera in world coordinates
  • We want to transformation T which takes object
    from world to camera

29
Viewing Transformation
  • We have the camera in world coordinates
  • We want to transformation T which takes object
    from world to camera
  • Trick find T-1 taking object from camera to
    world

30
Viewing Transformation
  • We have the camera in world coordinates
  • We want to transformation T which takes object
    from world to camera
  • Trick find T-1 taking object from camera to
    world

?
31
Review 3D Coordinate Trans.
  • Transform object description from to

p
32
Review 3D Coordinate Trans.
  • Transform object description from to

p
31
33
Review 3D Coordinate Trans.
  • Transform object description from camera to
    world

34
Viewing Transformation
  • Trick find T-1 taking object from camera to
    world
  • - eye position maps to origin
  • - back vector maps to z axis
  • - up vector maps to y axis
  • - right vector maps to x axis

35
Viewing Transformation
  • Trick find T-1 taking object from camera to
    world

HB equation (7-4)
36
Viewing Trans gluLookAt
  • Mapping from world to eye coordinates

gluLookAt (x0,y0,z0,xref,yref,zref,Vx, Vy,Vz)
HB equation (7-1)
37
3D Geometry Pipeline
3D-3D viewing transformation
World space
View space
38
Projection
  • General definition
  • transform points in n-space to m-space (mltn)
  • In computer graphics
  • map 3D coordinates to 2D screen coordinates

39
Taxonomy of Projections
40
Taxonomy of Projections
41
Parallel Projection
  • Center of projection is at infinity
  • Direction of projection (DOP) same for all
    points

42
Orthographic Projection
  • Direction of projection (DOP) perpendicular to
    view plane

43
Orthographic Projection
  • Direction of projection (DOP) perpendicular to
    view plane

44
Oblique Projection
  • DOP not perpendicular to view plane

A
A
O
45
Oblique Projection
  • DOP not perpendicular to view plane

A
A
O
46
Properties of Parallel Projection
  • Not realistic looking
  • Good for exact measurement
  • Are actually affine transformation
  • - parallel lines remain parallel
  • - ratios are preserved
  • - angles are often not preserved
  • Most often used in CAD, architectural drawings,
    etc. where taking exact measurement is important

47
Perspective Projection
  • Maps points onto view plane along projectors
    emanating from center of projection (COP)

48
Perspective Projection
  • Maps points onto view plane along projectors
    emanating from center of projection (COP)

Whats relationship between 3D points and
projected 2D points?
47
49
Camera-gtScreen
  • Remember Object-gtcamera-gtscreen

50
Camera-gtScreen
  • Remember Object-gtcamera-gtscreen
  • Screen is z-d plane for some constant d

49
51
Camera-gtScreen
  • Remember Object-gtcamera-gtscreen
  • Screen is z-d plane for some constant d
  • Coordinates of origin of screen is (0,0,-d)

50
52
Camera-gtScreen
  • Remember Object-gtcamera-gtscreen
  • Screen is z-d plane for some constant d
  • Coordinates of origin of screen is (0,0,-d)
  • Its x and y axes is parallel to the x and y axes
    of eye coordinate system

51
53
Camera-gtScreen
  • Remember Object-gtcamera-gtscreen
  • Screen is z-d plane for some constant d
  • Coordinates of origin of screen is (0,0,-d)
  • Its x and y axes is parallel to the x and y axes
    of eye coordinate system
  • All these coordinates are in camera space now

52
54
Camera-gtScreen
  • Consider the projection of a point on the camera
    plane

55
Camera-gtScreen
  • Consider the projection of a point on the camera
    plane

By similar triangles, we can compute how much the
x and y coordinates are scaled
56
Camera-gtScreen
  • Consider the projection of a point on the camera
    plane

By similar triangles, we can compute how much the
x and y coordinates are scaled
57
Homogeneous Point Revisited
  • Remember how we said 2D/3D geometric
    transformations work with the last coordinate
    always set to one
  • What happens if the coordinate is not one
  • We divide all coordinates by w

If w1, nothing happens Sometimes, we call this
division step the perspective divide
58
The Perspective Matrix
  • Now we can rewrite perspective projection
    equation as a matrix equation

59
The Perspective Matrix
  • Now we can rewrite perspective projection
    equation as a matrix equation

58
60
The Perspective Matrix
  • Now we can rewrite perspective projection
    equation as a matrix equation

After the division by w, we have
61
Viewing Angle
  • An alternative to specifying the distance between
    COP and PP is to specify viewing angle

Given the height of the image h and ? , what is
d?
62
Viewing Angle
  • An alternative to specifying the distance between
    COP and PP is to specify viewing angle

Given the height of the image h and ? , what is
d?
63
Viewing Angle
  • An alternative to specifying the distance between
    COP and PP is to specify viewing angle

Given the height of the image h and ? , what is
d?
64
Viewing Angle
  • An alternative to specifying the distance between
    COP and PP is to specify viewing angle

Given the height of the image h and ? , what is
d?
65
Viewing Angle
  • An alternative to specifying the distance between
    COP and PP is to specify viewing angle

Given the height of the image h and ? , what is
d?
What happens to d as ? increases (keep d
constant)?
66
Vanishing Points
  • What happens to parallel lines they are not
    parallel to the projection plane?

67
Vanishing Points
  • What happens to parallel lines they are not
    parallel to the projection plane?
  • The equation of the line

68
Vanishing Points
  • What happens to parallel lines they are not
    parallel to the projection plane?
  • The equation of the line
  • After perspective transformation, we have

69
Vanishing Points (cont.)
  • After perspective transformation, we have
  • Divided by w
  • Letting t go to infinity

70
Vanishing Points
  • What happens to parallel lines they are not
    parallel to the projection plane?
  • The equation of the line

71
Vanishing Points
  • What happens to parallel lines they are not
    parallel to the projection plane?
  • The equation of the line
  • How about the line

72
Vanishing Points
  • What happens to parallel lines they are not
    parallel to the projection plane?
  • The equation of the line
  • How about the line

73
Vanishing Points
  • What happens to parallel lines they are not
    parallel to the projection plane?
  • The equation of the line
  • How about the line

Same vanishing point!
74
Vanishing Points
  • What happens to parallel lines they are not
    parallel to the projection plane?
  • Each set of parallel lines intersect at a
    vanishing point on the PP

75
Vanishing Points
  • What happens to parallel lines they are not
    parallel to the projection plane?
  • Each set of parallel lines intersect at a
    vanishing point on the PP
  • How many vanishing points are there?

76
Vanishing Points
  • What happens to parallel lines they are not
    parallel to the projection plane?
  • Each set of parallel lines intersect at a
    vanishing point on the PP
  • How many vanishing points are there?

77
Properties of Perspective Proj.
  • Perspective projection is an example projective
    transformation
  • - lines maps to lines
  • - parallel lines do not necessary remain
    parallel
  • - ratios are not preserved

78
Properties of Perspective Proj.
  • Perspective projection is an example projective
    transformation
  • - lines maps to lines
  • - parallel lines do not necessary remain
    parallel
  • - ratios are not preserved
  • One of advantages of perspective projection is
    that size varies inversely proportional to the
    distance-looks realistic

79
Properties of Perspective Proj.
  • Perspective projection is an example projective
    transformation
  • - lines maps to lines
  • - parallel lines do not necessary remain
    parallel
  • - ratios are not preserved
  • One of advantages of perspective projection is
    that size varies inversely proportional to the
    distance-looks realistic
  • We can not judge distances exactly as we can
    with parallel projection

80
3D Geometry Pipeline
View space
World space
Object space
Normalized project space
Image space
Screen space
81
Perspective Projection Volume
  • The center of projection and the portion of
    projection plane that map to the final image form
    an infinite pyramid. The sides of pyramid called
    clipping planes
  • Additional clipping planes are inserted to
    restrict the range of depths

82
Normalized Perspective-Projection
Normalized project space
View space
glFrustum(xwmin, xwmax,ywmin, ywmax ,dnear,dfar)
81
83
Normalized Perspective-Projection
B(xwmax,ywmax,zfar)
A(xwmin,ywmin,znear)
View space
84
Normalized Perspective-Projection
B(1,1,1)
B(xwmax,ywmax,zfar)
A(-1,-1,-1)
A(xwmin,ywmin,znear)
Normalized project space (left-handed)
View space (right-handed)
A maps to A, B maps to B Keep the directions of
x and y axes!
85
Normalized Perspective-Projection
B(1,1,1)
B(xwmax,ywmax,zfar)
A(-1,-1,-1)
A(xwmin,ywmin,znear)
HB equation (7-40)
86
Normalized Perspective-Projection
B(1,1,1)
B(xwmax,ywmax,zfar)
A(-1,-1,-1)
A(xwmin,ywmin,znear)
Normalized project space
View space
glFrustum(xwmin, xwmax,ywmin, ywmax ,dnear,dfar)
87
3D Geometry Pipeline
View space
World space
Object space
Normalized project space
Image space
88
Viewport Transformation
B(1,1,1)
B(xvmax,yvmax,1)
Normalized project space
A(xvmin,yvmin,0)
A(-1,-1,-1)
Image space
Normalized project space
89
Viewport Transformation
B(1,1,1)
B(xvmax,yvmax,1)
Normalized project space
A(xvmin,yvmin,0)
A(-1,-1,-1)
Image space
Normalized project space
HB equation (7-42)
90
Viewport Transformation
(xmin,ymin)
Image space-.gtImage space
gluViewport(xmin, ymin, width, height)
91
Summary 3D Geometry Pipeline
View space
World space
Object space
Normalized project space
Image space
92
Next Lecture
  • Hierarchical Models
  • Animation with motion capture data
  • - skeletal model (.asf)
  • - motion data (.amc)
  • Required readings
  • - HB chapter 14,
  • - OpenGL Programming Guide, chapter 3
Write a Comment
User Comments (0)
About PowerShow.com