Chapter 7: Three-Dimensional Viewing - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

Chapter 7: Three-Dimensional Viewing

Description:

Move camera away from default position and point in given direction: Rotation ... bottom to y=bott. left to x=left. right to x=right ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 27
Provided by: Lyne1
Category:

less

Transcript and Presenter's Notes

Title: Chapter 7: Three-Dimensional Viewing


1
Chapter 7 Three-Dimensional Viewing
  • Chapter 5 Camera with parallel projection
  • Now Camera with perspective projection
  • 7.2 The Camera Revisited
  • Eye, view volume, view angle, near plane,far
    plane, aspect ratio,viewplane.
  • Perspective view P determined by finding where
    line from eye to P intersects viewplane.

2
Chapter 7 Three-Dimensional Viewing
  • 7.2.1 Setting the View Volume
  • Projection matrix
  • gluPerspective(viewAngle, aspectRatio, N, F)
  • 7.2.2 Positioning and Pointing the Camera
  • Move camera away from default position and point
    in given direction Rotation and translation in
    modelview matrix.

3
Chapter 7 Three-Dimensional Viewing
  • General camera with Arbitrary Orientation and
    Position
  • Transformation? Modelview matrix?
  • Attach explicit coordinate system to camera
  • Pitch, heading, yaw, roll
  • Selfstudy pp.361-366

4
Chapter 7 Three-Dimensional Viewing
  • 7.3 Building a Camera in a Program
  • Selfstudy.
  • 7.4 Perspective Projections of 3D Objects
  • Vertex v ? modeling transformations ? camera
    position and orientation Now in eye coordinates
  • Vertex P in eye coordinates must be projected
    onto point (x,y) on near plane.

5
Chapter 7 Three-Dimensional Viewing
  • 7.4.1 Perspective Projection of a Point
  • Fundamental operation Projecting 3D point into
    2D coordinates on a plane.
  • Construct local coordinate system on near plane
  • (x,y) (N(Px/(-Pz)), N(Py,/(-Pz))

6
Chapter 7 Three-Dimensional Viewing
  • Note
  • -Pz achieves perspective foreshortening
  • Pz0 if P lies on plane z0 Clip before
    projecting
  • If Pz lies behind eye, also clipped before
    projecting.
  • N scales picture (size only)
  • Straight lines project to straight lines (proof
    given)
  • Selfstudy Example 7.4.2 IMPORTANT!

7
Chapter 7 Three-Dimensional Viewing
  • 7.4.2 Perspective Projection of a Line
  • Lines parallel in 3D project to lines, but not
    necessarily parallel.
  • Lines that passed behind the eye cause passage
    through infinity should be clipped.
  • Perspective projections produce geometrically
    realistic pictures, except for very long lines
    parallel to viewplane.

8
Chapter 7 Three-Dimensional Viewing
  • Projecting Parallel Lines
  • 3D line P(t) A c(t)
  • Yields (parametric form) for projection
  • If Act parallel to viewplane, then cz0,
    andp(t) N(Axcxt,Aycyt)/(-Az)Slope is cy/cx
  • If two lines in 3D are parallel to each other and
    to the viewplane, they project two parallel
    lines.

9
Chapter 7 Three-Dimensional Viewing
  • Suppose c not parallel to viewplane (cz!0)
  • For large t, p(?)(Ncx/(-cz), Ncy/(-cz))
    vanishing point
  • Depends only on direction c ? all parallel lines
    share same vanishing point, i.e. project to lines
    that are not parallel.

10
Chapter 7 Three-Dimensional Viewing
  • Lines that pass behind the eye
  • B projects to Bwrong side of viewplane
  • Let C move from A to B asC moves, its
    projection slidesfurther to right until it
    spurtsoff to infinity
  • When C moves behind eye, projection appears to
    left on viewplane.
  • Selfstudy Example 7.4.3,
  • Anomaly of Viewing Long Parallel Lines

11
Chapter 7 Three-Dimensional Viewing
  • Perspective and the Graphics Pipeline
  • Adding pseudodepth if two points project to the
    same point, we only need to know which is nearer
  • Efficiency (x,y,z) (N(Px/(-Pz)),
    N(Py,/(-Pz), (aPzb)/(-Pz))
  • Choose 1lta,blt1
  • Let pseudodepth be 1 when Pz -N, 1 when Pz
    -F.
  • Then a -((FN)/(F-N)) and b
    (-2FN)/(F-N).
  • Due to precision problems, pseudodepth values may
    be equal for two different pints as Pz
    approaches F.

12
Chapter 7 Three-Dimensional Viewing
  • Using Homogeneous Coordinates
  • Point (Px,Py,Pz,1) vector (vx,vy,vz,0)
  • Extend Point has family of homogeneous
    coordinates (wPx,wPy,wPz,w) for any w except w0.
  • To convert point from ordinary to homogeneous
    coordinates, append 1.
  • To convert point from homogenous to ordinary
    coordinates, divide all components by last, and
    discard last component.

13
Chapter 7 Three-Dimensional Viewing
  • Transforming points in homogeneous coordinates
  • If matrix M has last row (0 0 0 1), affine
    transformation MPQ, last component of Q is w.
  • If M doesnt have last row (0 0 0 1), MPQ gives
    point can divide by last component to find
    coordinates perspective division.
  • If M doesnt have last row (0 0 0 1), not affine
    but perspective transformation.
  • Note perspective projection perspective
    transformation orthographic projection

14
Chapter 7 Three-Dimensional Viewing
  • Geometric Nature of Perspective Transformation
  • Lines through eye map intolines parallel to
    z-axis.
  • Lines perpendicular toz-axis map into lines
    perpen-dicular to z-axis.
  • Transformation warps objects into new shapes.
  • Perspective transformation warps objects so that,
    when viewed with an orthographic projection, they
    appear the same as the original objects do when
    viewed with a perspective projection.

15
Chapter 7 Three-Dimensional Viewing
  • Transformed View Volume Canonical View Volume
  • top to ytop
  • bottom to ybott
  • left to xleft
  • right to xright
  • parallelepiped with dimensions related to
    cameras properties
  • Scale and shift into canonical view volume (cube
    from 1 to 1 in each dimension)
  • Transformation matrix known as projection matrix.
  • OpenGL glFrustrum()

16
Chapter 7 Three-Dimensional Viewing
  • Projection matrix

17
Chapter 7 Three-Dimensional Viewing
  • 7.4.4 Clipping Faces against View Volume
  • As Cyrus-Beck, but in 4D.
  • Clip AC against six infiniteplanes.
  • For each wall, test whetherA and C same side.
    If not, clip.
  • Calculate six boundary coordinates (BC) for A and
    C. All 6 positive point inside CVV, else
    outside.
  • Both same side trivial accept, reject. Else
    clip.

18
Chapter 7 Three-Dimensional Viewing
  • Selfstudy Rest of clipping algorithm,
    pp.387-389.
  • Selfstudy Why clip against CVV?
  • Selfstudy Why clip in Homogeneous Coordinates?
  • Selfstudy The Viewport Transformation.

19
Chapter 7 Three-Dimensional Viewing
  • 7.5 Producing Stereo Views
  • Not for exam purposes.
  • 7.6 Taxonomy of Projections

20
Chapter 7 Three-Dimensional Viewing
  • 7.6.1 One-, Two-, Three Point Perspective
  • Suppose n-axis of camera is perpendicular to one
    principal axis or another therefore vanishing
    point at infinity.
  • Count number of finite vanishing points, i.e.
    number of principal exis not perp. to n.
  • One point Perspective
  • n perp. to two principal axes two of (nx,ny,nz)
    must be 0.

21
Chapter 7 Three-Dimensional Viewing

22
Chapter 7 Three-Dimensional Viewing
  • 7.6.2 Parallel Projections
  • Perspective projection Points projected along
    projectors that converge on eye
  • Parallel projection All projectors have same
    direction d.
  • Two types obliqueorthographic

23
Chapter 7 Three-Dimensional Viewing
  • Orthographic Projections
  • dxdy0
  • Orthographic projection in OpenGL READ.
  • Types of Orthographic Projections
  • Multiview
  • Top, front, side views
  • n made parallel to each of k, i, j in turn.

24
Chapter 7 Three-Dimensional Viewing
  • Axonometric
  • n not parallel to any principal axis
  • Foreshortening factor sin(?)
  • Isometric all 3 principal axes foreshortened
    equally
  • Dimetric 2 foreshortened equally
  • Trimetric all 3 foreshortened unequally

25
Chapter 7 Three-Dimensional Viewing
  • Oblique projections Selfstudy.

26
Chapter 7 Three-Dimensional Viewing
  • Programming Task 5 Implement Case Study 7.1
    (Flying a camera through a scence), p. 405, in
    Hill.
Write a Comment
User Comments (0)
About PowerShow.com