close

Вход

Забыли?

вход по аккаунту

?

Computer Graphics

код для вставкиСкачать
Computer Graphics
Inf4/MSc
Computer Graphics
Lecture 4
View Projection
Taku Komura
1
Computer Graphics
Measuring the BRDF
Inf4/MSc
• Measured using a device called
gonioreflectometer
– Casting light from various directions to the object,
and capturing the light reflected back
Problems with MeasuredInf4/MSc
BRDF
Computer Graphics
• Includes a lot of error
• Huge amount of time to capture
• The data size is enormous
– 18 hours acquisition time, 30GB raw data according
to [Ngan et al. EGSR ’05]
-> Fitting the acquired data into analytical models
Computer Graphics
•
Empirical models
–
•
Analytical models
Gouraud, Phong models or more complex models
Microfacet models
–
Assuming the surface is composed of a large number of micro mirrors
–
Each reflect light back to the specular direction
Inf4/MSc
Computer Graphics
Microfacet Theory
Inf4/MSc
• [Torrance & Sparrow 1967]
– Surface modeled by tiny mirrors
– Value of BRDF at
• # of mirrors oriented halfway between
and
where
is the incoming direction,
is the out
going direction
Also considering the statistics of the shadowing/masking
• Modulated by Fresnel, shadowing/masking
[Shirley 97]
Computer Graphics
Examples : Satin
Inf4/MSc
Computer Graphics
Examples : velvet
Inf4/MSc
Computer Graphics
Inf4/MSc
Implementation of viewing.
• Transform into camera coordinates.
• Perform projection into view volume or
screen coordinates.
• Clip geometry outside the view volume.
• Remove hidden surfaces (next week)
8
Computer Graphics
Inf4/MSc
Transformations
Screen
coordinates
vпЂЅM
M
M
v
proj
wп‚® c
lп‚® w l
Projection
matrix
World to
camera
matrix
Local to
world
matrix
Local
coordin
ates
23/09/2014
View Transformation (from lecture
2)
Inf4/MSc
Computer Graphics
пЃ¬We want to know the positions in the camera coordinate system
vw = Mc→w vc
Point in the
camera coordinate
Camera-to-world
Point in the
world coordinate transformation
vc = M
-1
c→w
vw
= Mw→c vw
Lecture 4
02/10/09
10
Computer Graphics
Inf4/MSc
View Projection
пЃ¬We want to create a picture of the scene viewed from the camera
пЃ¬Two sorts of projection
пЃ¬Parallel projection
пЃ¬Perspective projection
11
Computer Graphics
Inf4/MSc
Mathematics of Viewing
• We need to generate the transformation
matrices for perspective and parallel
projections.
• They should be 4x4 matrices to allow
general concatenation.
• And there’s still 3D clipping and more
viewing stuff to look at.
12
Computer Graphics
Inf4/MSc
Parallel projections
(Orthographic projection)
• Specified by a direction of projection, rather
than a point.
• Objects of same size appear at the same size
after the projection
13
Computer Graphics
Inf4/MSc
Parallel projection.
Orthographic Projection onto a plane at z = 0.
xp = x , yp = y , z = 0.
M orth
пѓ©1
пѓЄ
0
пѓЄ
пЂЅ
пѓЄ0
пѓЄ
пѓ«0
0
0
1
0
0
0
0
0
0пѓ№
пѓє
0
пѓє
0пѓє
пѓє
1пѓ»
14
Computer Graphics
Inf4/MSc
Perspective Projection
• Specified by a center of projection and the focal
distance (distance from the eye to the projection
plane)
пЃ¬Objects far away appear smaller, closer objects
appear bigger
15
Computer Graphics
Inf4/MSc
Projection Matrix
• Here we will follow the projection transform
method used in OpenGL
• The camera facing the –z direction
Computer Graphics
Inf4/MSc
Perspective projection – simplest
case.
Centre of projection at the origin,
Projection plane at z=-d.
d: focal distance
Projection
Plane.
y
P(x,y,z)
x
Pp(xp,yp,-d)
z
d
17
Computer Graphics
Inf4/MSc
Perspective projection – simplest
case.
From similar
xp
пЂЅ
d
x
пЂ­z
triangles
yp
;
пЂЅ
d
:
x
y
пЂ­z
xp
d пѓ—x
пЂ­z
пЂЅ
y
пЂ­ z/d
; yp пЂЅ
dпѓ—y
пЂ­z
пЂЅ
y
z
пЂ­ z/d
P(x,y,z)
d
d
Pp(xp,yp,-d)
z
yp
d
x
x
z
xp пЂЅ
P(x,y,z)
P(x,y,z)
y
18
Computer Graphics
Inf4/MSc
Perspective projection.
пЃ›x
p
yp
пЂ­d
1
пЃќ
T
пЂЅ пѓ© пЂ­ d .x
z
пѓЄпѓ«
T
пЂ­ d .y
z
пЂ­d
пЃ›
1пѓ№ пЂЅ x
пѓєпѓ»
y
z
пЂ­z
The transform ation can be represente d as a 4x4 matrix :
M
per
пѓ©1
пѓЄ
0
пѓЄ
пЂЅ
пѓЄ0
пѓЄ
пѓ«0
0
0
1
0
0
1
0
- 1/d
0пѓ№
пѓє
0
пѓє
0пѓє
пѓє
0пѓ»
19
пЃќd
T
Computer Graphics
Inf4/MSc
Perspective projection.
Represent
the general projected
Pp пЂЅ M
пѓ©1
пѓЄ
0
пѓЄ
пѓ—P пЂЅ
пѓЄ0
пѓЄ
пѓ«0
пЂЅ пЃ›X
per
Y
Z
T
пЃќ
W
0
0
1
0
0
1
0
- 1/d
пЂЅ пЃ›x
y
point P p пЂЅ пЃ› X
Y
Z
W
пЃќT
0пѓ№ пѓ© x пѓ№
пѓє пѓЄ пѓє
0
y
пѓєпѓ—пѓЄ пѓє
0пѓє пѓЄ z пѓє
пѓє пѓЄ пѓє
0пѓ» пѓ«1 пѓ»
z
T
пЃќ
пЂ­ z/d
20
Computer Graphics
Inf4/MSc
Perspective projection.
Pp пЂЅ пЃ› x
y
z
пЂ­ z/dпЃќ
T
Trouble with this formulation :
Dropping
пѓ¦ X
,
пѓ§
пѓЁW
Y
W
Centre of projection fixed at
the origin.
W to come back to 3D :
,
Z пѓ¶ пѓ¦ x
,
пѓ·пЂЅпѓ§
W пѓё пѓЁпЂ­ z/d
y
пЂ­ z/d
,
пѓ¶
пЂ­dпѓ·
пѓё
21
Computer Graphics
Inf4/MSc
Alternative formulation.
d
x
z
P(x,y,z)
xp
yp
P(x,y,z)
z
y
d
Projection plane at z = 0
Centre of projection at
z=d
From similar
xp
пЂЅ
d
x
пЂ­zпЂ«d
Multiply
xp пЂЅ
triangles
;
yp
:
пЂЅ
d
y
пЂ­zпЂ«d
by d
d пѓ—x
пЂ­zпЂ«d
пЂЅ
x
(пЂ­ z / d ) пЂ« 1
;
yp пЂЅ
dпѓ—y
пЂ­zпЂ«d
пЂЅ
y
(пЂ­ z / d ) пЂ« 1
22
Computer Graphics
Inf4/MSc
Alternative formulation.
d
x
z
xp
P(x,y,z)
yp
P(x,y,z)
z
y
d
Projection plane at z = 0,
Centre of projection at
z =d
Now we can allow dп‚®п‚Ґ
M п‚ўper
пѓ©1
пѓЄ
0
пѓЄ
пЂЅ
пѓЄ0
пѓЄ
пѓ«0
0
0
1
0
0
0
0
- 1/d
0пѓ№
пѓє
0
пѓє
0пѓє
пѓє
1пѓ»
23
Computer Graphics
Inf4/MSc
Problem
• After projection, the depth information is
lost
• We need to preserve the depth information
for hidden surface remove during
rasterization
24
Computer Graphics
Inf4/MSc
3D View Volume
• The volume in which the visible objects exist
• For orthographic projection, view volume is a
box.
• For perspective projection, view volume is a
frustum.
• The surfaces outside the view volume must be
clipped
left
Far clipping plane.
Near clipping plane
right
Need to calculate intersection
With 6 planes.
25
Computer Graphics
Inf4/MSc
Canonical View Volume
• We can transform the frustum view volume into a
normalized canonical view volume using the idea
of perspective transformation
• Much easier to clip surfaces and apply hidden
surface removal
26
Computer Graphics
Inf4/MSc
Transforming the View Frustum
• Let us define parameters (l,r,b,t,n,f) that
determines the shape of the frustum
• The view frustum starts at z=-n and ends at
z=-f, with 0<n<f
• The rectangle at z=-n has the minimum
corner at (l,b,-n) and the maximum corner at
(r,t,-n)
27
Computer Graphics
Inf4/MSc
Transforming View Frustum into
a Canonical view-volume
• The perspective canonical view-volume can be transformed
to the parallel canonical view-volume with the following
matrix:
If z пѓЋ [ пЂ­ n , пЂ­ f ]( 0 пЂј n пЂј f ) then
Pp
пѓ© 2n
пѓЄr пЂ­ l
пѓЄ
пѓЄ 0
пЂЅ пѓЄ
пѓЄ
0
пѓЄ
пѓЄ
пѓ« 0
r пЂ«l
0
r пЂ­l
t пЂ«b
2n
t пЂ­b
0
0
пЂ­
t пЂ­b
f пЂ« n
f пЂ­ n
пЂ­1
пѓ№
пѓє
пѓє
пѓє
0
пѓє
пЂ­ 2 fn пѓє
f пЂ­ n пѓє
пѓє
0
пѓ» 28
0
Computer Graphics
Inf4/MSc
Final step.
• Divide by W to get the 3-D coordinates
– Where the perspective projection actually gets done
• Now we have a �canonical view volume’.
– Don’t flatten z due to hidden surface calculations.
• 3D Clipping
– The Canonical view volume is defined by:
-1п‚Јx п‚Ј1, -1 п‚Јy п‚Ј1 , -1 п‚Јz п‚Ј1
– Simply need to check the (x,y,z) coordinates and see if
29
they are within the canonical view volume
Computer Graphics
Inf4/MSc
Reading for View Transformation
• Foley et al. Chapter 6 – all of it,
– Particularly section 6.5
• Introductory text, Chapter 6 – all of it,
– Particularly section 6.6
• Akenine-Moller, Real-time Rendering
Chapter 3.5
30
Документ
Категория
Презентации
Просмотров
9
Размер файла
1 451 Кб
Теги
1/--страниц
Пожаловаться на содержимое документа