comp30019 graphics and interaction perspective geometry · i perspective is also covered in chapter...
TRANSCRIPT
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
COMP30019 Graphics and InteractionPerspective Geometry
Adrian Pearce
Department of Computer Science and Software EngineeringUniversity of Melbourne
The University of Melbourne
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Lecture outline
Introduction to perspective geometry
Perspective Geometry
Centre of projection
Projection using vectors
Human perspective
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Perspective geometry
How are three-dimensional objects projected ontotwo-dimensional images?
Aim: understand point-of-view, projective geometry.
Reading:I Foley Sections 6.1 to 6.4 (excluding example 6.1, we’ll
cover matrices later).Additional reading:
I Perspective is also covered in Chapter 3 of the Red Book.
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Geometry of image formationMapping from 3D space to 2D image surface, more specifically,a mapping from 3D directions (rays to/ from the observer).
I You can think perspective as a transformation as a way ofmoving from a higher dimensional image to a lowerdimensional form.
I The X ,Y ,Z points in the three dimensional world,sometimes called voxels, are transformed in to x , y pixelsin a two-dimensional image.
Simplest device that does this is the pin-hole camera that givesperspective projection.
Practical cameras with lenses ideally give the same projection,aside from greater light gathering, and issues like focus.
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Pinhole Camera
object in
3D scene
image of object
(upside down)
for image (maybe
light-tight box
pinhole in box
light ray from objectprojection screen
translucent
waxed paper)
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Perspective geometry
(X,Y,Z)
O
Zx
f X
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Perspective geometry
I Basically an abstraction of pin-hole camera.I Look at XOZ plane—same thing happens in YOZ plane.I Actual point in 3D space is (X ,Y ,Z )
I 0 is origin (focal point) or centre of projection.I Z is distance from actual point to origin.I f is focal distance (focal length).I x is the image (upside down) with respect to real world.
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Perspective FormulasPoint P = (X ,Y ,Z ) in 3D space has projection (x , y) in theimage where
xf
=XZ
yf
=YZ
or
x =XfZ
y =YfZ
f being the “focal distance” (sometimes f is called d).Look at similar triangles in the previous diagram.
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Perspective Formulas
I Look at perspective projection diagram to convinceyourself of this — triangles xOf and XOZ have the sameproportions.
I Rearranging gives equations shown below.I These formulas apply only for this special coordinate
system, sometimes called camera-centred coordinates, forwhich perspective projection has a particularly simple form.
I For other coordinate systems, some 3D transformation willbe necessary (see later).
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Alternative geometry
(X,Y,Z)
O
Z
Xf
x
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Alternative geometry
I Image projection surface imagined to be in front ofprojection centre.
I Geometrically equivalentI Often more convenient.
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Centre of projection
Projectors
Center ofprojection
Projectionplane
A'
A
B
(a)
Projectors
Projectionplane
A'
A
B
(b)
B' B'
Center ofprojectionat infinity
Foley,Figure 6.03
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
“One-point” perspective
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
One point perspective projection (Foley, Figure 6.04)
y
z
x
y
z
x
z-axis vanishing point
z-axis vanishing point
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
One-point perspective projection (Foley, Figure 6.05)
Projectionplanenormal
Center ofprojection
Projectionplane
z
x
y
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
“Two-point” perspective
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
“Three-point” perspective
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Vanishing pointsI In 3D, parallel lines meet only at infinity, so the vanishing
point can be thought of as the projection of a point atinfinity.
I If the set of lines is parallel to one of the three principalaxes, the vanishing point is called an axis vanishing point.
I So called “one-point”, “two-point”, and “three-point”perspectives are just special cases of perspectiveprojection, depending on how image plane lines up withsignificant planes in scene.
I Talking about these cases specifically is mainly an artifactof artists or architects dealing with horizontals and verticalsin built environments.
I In fact, there are an infinity of vanishing points, one foreach of the infinity of directions in which a line can beoriented.
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
House example (Foley Section 6.4)
y
x(8, 16, 30)
(16, 10, 30)(16, 0, 30)
(0, 10, 54)
(16, 0, 54)z
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
One-point, centred perspective projection example
z
v
uVUP
VRP
PRP = (8, 6, 30)
DOPn
CW
Window onview plane
VPN
y
x
Foley Figures 6.21 and 6.22
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Which of the below is the centre of project in Foley Figure 6.22?
I VRP (view reference point)I PRP (projection reference point)I VPN (view plane normal)I DOP (direction of projection)I VUP (view-up vector)
Is the view plane inbetween the centre of projection and thehouse or behind the centre of projection?
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Two-point perspective projection exampleIn a two-point projection of a house, left, the viewplane (definedby the view plane normal, VPN), right, cuts the z and x axes(Foley Figures 6.17 and 6.25).
y
x
z
v
u
VPN
View plane
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Parallel projection
I Parallel projection introduces no perspective distortion(centre of projection plane (focal point) is at infinity
I Along with its variants it is useful in engineering drawings,where measurements must be taken.
I oblique projection if view plane is not perpendicular toprojection.
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Geometric project classesSubclasses of planar geometric projections (Foley Figure 6.10).
Planar geometricprojections
Frontelevation
Sideelevation
Top(plan)
Parallel Perspective
Orthographic Oblique One-point
Cabinet
Cavalier
Other
Two-point
Three-pointAxonometric
Isometric
Other
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Ortographic (parallel) projectionParallel projection (also known as orthographic projection) isgiven by
x = Xy = Y
(That is, just drop Z coordinate.)Also can have “normal perspective” which is scaled parallel(orthographic) projection
x = sX = (f/Z ′)Xy = sY = (f/Z ′)Y
That is, it’s like perspective projection in which objects are“squashed” to some constant fictitious depth Z ′ instead ofbeing at their true depths.
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Oblique parallel projection using vectors
origin
P
x yv v,( )
x
yd
p
Fig 4.3 RoweAdrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Oblique parallel projection using vectors
I All points are projected parallel to the projection vector donto the xy plane.
I Note the projection vector is not perpendicular to the xyplane, else it would be an orthogonal projection.
I Point p is projected onto point xv , yv .
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Derivation of oblique parallel projection
The vector equation of the (projection) line is
r = p + td
The intersection of this line with the xy plane is at z = 0,therefore
t = −pz
dz
and by substitution we obtain
(xv , yv ) = {px −pzdx
dz,py −
pzdy
dz}
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Derivation of oblique parallel projection
I r and d are vector parameters.I r = (x , y , z) is a vector pointing to a point on the plane
along the dotted line.I r = p + td is the vector equation of a line passing through
a point.I t is a scalar parameter.I Provided that dz is non-zero, otherwise if it is zero the
projection direction is parallel to the xy plane so it does notintersect.
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Perspective projection using vectors
p – c
p
origin
P
x
yc
x yv v,( )
C
Q
Fig 4.5 RoweAdrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Perspective projection using vectors
I Point C is the centre of projection.I Points P and Q are projected onto the xy plane at the
points shown.I For point P, the projection direction is given by the vector
P − C (this is calculated for each point).
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Derivation of perspective projectionThe projection passing through C and P is
r = c + t(p − c)
at z = 0t = − cz
(pz − cz)
and by substitution we obtain
(xv , yv ) = {cx − czpx − cx
pz − cz, cy − cz
py − cy
pz − cz}
further simplification gives
(xv , yv ) = {cxpz − czpx
pz − cz,cypz − czpy
pz − cz}
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Perspective of the human eye
Human eye effectively uses a kind of “spherical” projection:Retina is curved, though projection centre (in lens) isn’t atcentre of the eyeball (therefore not planar geometricprojection).
I Doesn’t exactly match perspective projection.I Only a problem for very wide fields of view.
Perspective is basically the right projection for putting a 3Dscene onto a flat surface for human viewing.
I Other projections are possible for special effects, e.g.“fish-eye” lens.
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry
Introduction to perspective geometry Perspective Geometry Centre of projection Projection using vectors Human perspective
Summary
I Perspective geometry is based loosely on the pin-holecamera model that maps 3D points onto a 2D image plane
I The image plane may thought of either behind a focal pointor in between a vanishing point and the object.
I Computer graphics largely concerns planar geometricprojections, generally perspective projection andsometimes parallel projection for specific applications.
I One-point, two-point and three-point projection variantsarise according to how many times the viewplane cuts theaxis planes.
Adrian Pearce University of Melbourne
COMP30019 Graphics and InteractionPerspective Geometry