Upload
brice-bradley
View
218
Download
2
Embed Size (px)
Citation preview
The Goal
Understand the process of getting from 3D line
segments to images of these lines on the screen.
Canonical View Volume
Windowing transform brings points to pixels: MW
xpixel
ypixel
1
=
xcanonical
ycanonical
1
Canonical View Volume
Mw
Orthographic Projection
Orthographic Perspective
Orthographic Viewing Volume
Orthographic View to Canonical View
x
y
z
1
World to Canonical Coordinates
Scale Move toOrigin
Orthographic View to Canonical View
2/(r-l)
0 0 0
02
/(t-b)0 0
0 02
/(n-f)0
0 0 0 1
x
y
z
1
1 0 0-(l+r)
/2
0 1 0-(b+t)
/2
0 0 1-(n+f)
/2
0 0 0 1
World to Canonical Coordinates
Drawing Lines in Orthographic View
Mo=Mw Mscale Mmove_to_origin
xpixel
ypixel
zcanonical
1
= Mo
x
y
z
1
Arbitrary View Positions
Camera is looking this
wayCamera is centered here
Top of cameragoes this way
Arbitrary View Positions
w = - (g / ||g||)
u = (t × w) / || t × w ||
v = w × u
Arbitrary View Positions
Coordinate Transformations
Coordinate Transformations
Coordinate Transformations
Coordinate Transformations
p = (xp,yp) ≡ o + xpx + ypy
p = (up,vp) ≡ e + upu + vpv
Coordinate Transformationsp = (xp,yp) ≡ o + xpx + ypy
p = (up,vp) ≡ e + upu + vpv
Coordinate Transformations
xp
yp
1
=
up
vp
1
? ?
p = (xp,yp) ≡ o + xpx + ypy
p = (up,vp) ≡ e + upu + vpv
Coordinate Transformations
xp
yp
1
=
1 0 xe
0 1 ye
0 0 1
up
vp
1
xu xv 0
yu yv 0
0 0 1
p = (xp,yp) ≡ o + xpx + ypy
p = (up,vp) ≡ e + upu + vpv
Camera Coordinate Transform
Camera Coordinate Transform
Mv =
1 0 0 -xe
0 1 0 -ye
0 0 1 -ze
0 0 0 1
xu yu zu 0
xv yv zv 0
xw yw zw 0
0 0 0 1
Drawing with Arbitrary View and Orthographic Projection
xpixel
ypixel
zcanonical
1
= Mo Mv
x
y
z
1
Perspective Projection
ys = y(d/z)
Perspective Via Orthographic
Perspective Via Orthographic
Perspective Via Orthographic
Perspective Transform
Mp =
1 0 0 0
0 1 0 0
0 0(n+f)
/n-f
0 01
/n0
Perspective Transform
Mp
x
y
z
1
=
x
y
z[(n+f)/n] - f
z/n
nx/z
ny/z
n + f – (fn/z)
1
Perspective Transform
Mp =
n 0 0 0
0 n 0 0
0 0 (n+f) -fn
0 0 1 0
Drawing with Arbitrary View and Perspective Projection
xpixel
ypixel
zcanonical
1
= Mo Mp Mv
x
y
z
1
CAUTION!!
Everything up until now used the more common right-hand
coordinate system.
Direct3D uses the left-hand coordinate system.
See:http://msdn.microsoft.com/en-us/library/windows/desktop/bb204853%28v=vs.85%29.aspx