Sampling
CS 6965 Fall 2011
Sampling CS 6965 Fall 2011 Creative Program 3 CS 6965 Fall 2011 - - PowerPoint PPT Presentation
Sampling CS 6965 Fall 2011 Creative Program 3 CS 6965 Fall 2011 2 CS 6965 Fall 2011 3 CS 6965 Fall 2011 4 CS 6965 Fall 2011 5 CS 6965 Fall 2011 6 Sampling Theory World: continuous Image: discrete samples Display:
CS 6965 Fall 2011
Fall 2011 CS 6965
2
Fall 2011 CS 6965
3
Fall 2011 CS 6965
4
Fall 2011 CS 6965
5
Fall 2011 CS 6965
6
Fall 2011 CS 6965
7
Fall 2011 CS 6965
8
Fall 2011 CS 6965
9
Fence 1: 6 inch boards Fence 2: 4 inch boards
Fall 2011 CS 6965
10
Fence 1: 6 inch boards Fence 2: 4 inch boards
Fall 2011 CS 6965
as low frequencies
frequencies come from and what we can do about them
11
Low frequencies High frequencies
Fall 2011 CS 6965
12
Fall 2011 CS 6965
Given a function h(t) : F h t
⎡ ⎣ ⎤ ⎦ = H ω
h t
−∞ ∞
F−1 H ω
⎡ ⎣ ⎤ ⎦ = h(t) = 1 2π H ω
−∞ ∞
eiωtdt i = −1 eix = cos x
13
Fall 2011 CS 6965
Continuous Fourier Transform(FT): F h t
( )
⎡ ⎣ ⎤ ⎦ = H ω
( ) =
h t
( )e−iωtdt
−∞ ∞
F−1 H ω
( )
⎡ ⎣ ⎤ ⎦ = f (t) = 1 2π H ω
( )
−∞ ∞
eiωtdt Discrete Fourier Transform (DFT): F
n =
fke−2πik /N
k=0 N −1
fk = 1 N fke2πinn/N
n=0 N −1
Fast Fourier Transform (FFT) is just an optimized version of DFT (using half-angle identities)
14
Fall 2011 CS 6965
15
Fall 2011 CS 6965
16
Time domain Frequency domain
Fall 2011 CS 6965
17
Time domain Frequency domain
Fall 2011 CS 6965
18
source: http://mrl.nyu.edu/~dzorin/intro-graphics/lectures/lecture2/sld013.htm
Fall 2011 CS 6965
19
Fall 2011 CS 6965
δ t
t = 0 t ≠ 0 ⎧ ⎨ ⎩ δ t − t0
t = t0 t ≠ t0 ⎧ ⎨ ⎩ δ t
−∞ ∞
20
Fall 2011 CS 6965
δ t
−∞ ∞
δ t
−∞ ∞
The delta function allows us to sample the function f
21
Fall 2011 CS 6965
More samples: more delta functions comb(t) = δ t − nT
( )
−∞ ∞
∑
comb t
( ) f t ( )dt = ..., f −2T ( ), f −T ( ), f 0 ( )
−∞ ∞
∫
, f T
( ), f 2T ( ),...
22
T t f(t)
Fall 2011 CS 6965
23
Fall 2011 CS 6965
−∞ ∞
24
Fall 2011 CS 6965
given g(t): F g(t)comb(t)
( ) = F g(t) ( )* F comb(t) ( )
= F g(t)
( )*comb(t)
25
w
Sampling Frequency
Fall 2011 CS 6965
given g(t): F g(t)comb(t)
( ) = F g(t) ( )* F comb(t) ( )
= F g(t)
( )*comb(t)
26
w
Sampling Frequency
Fall 2011 CS 6965
given g(t): F g(t)comb(t)
( ) = F g(t) ( )* F comb(t) ( )
= F g(t)
( )*comb(t)
27
w
Sampling Frequency
Aliasing total
Fall 2011 CS 6965
28
Fall 2011 CS 6965
n=1 ∞
29
Fall 2011 CS 6965
30
w
Sampling Frequency
Fall 2011 CS 6965
31
source: http://mrl.nyu.edu/~dzorin/intro-graphics/lectures/lecture2/sld013.htm
Fall 2011 CS 6965
lines crossing)
32
Fall 2011 CS 6965
33
Fall 2011 CS 6965
34
Fall 2011 CS 6965
the sampling rate
35
Fall 2011 CS 6965
F/2
36
Fall 2011 CS 6965
Connect the dots? f(t)= asT t
( )
s=1 n
T(t) = −t −1 ≤ t < 0 t 0 ≤ t ≤ 1
⎧ ⎨ ⎪ ⎩ ⎪
37
T t f(t)
Fall 2011 CS 6965
Connect the dots? F(f(t))= asF T t
s=1 n
38
T t f(t)
Fall 2011 CS 6965
39
Fall 2011 CS 6965
infinite time response and vice-versa
Reconstruction Filters for Volume Rendering, in Proceedings
Visualization'94, Washington, DC (1994), pp. 100-107
40
Fall 2011 CS 6965
41
Ken Turkowski, Apple Computer, “Filters for Common Resampling Tasks”
Fall 2011 CS 6965
42
Lanczos-windowed Sinc function
Fall 2011 CS 6965
. Mitchell, Arun N. Netravali “Reconstruction filters in computer- graphics” Computer Graphics, Volume 22, Number 4, 1988.
subjects
good properties (now called the Mitchell filter)
43
Fall 2011 CS 6965
44
Fall 2011 CS 6965
45
Fall 2011 CS 6965
filters
46
Fall 2011 CS 6965
filter(x) f (x)
samples
filter(x)
samples
47
Fine samples Coarse sample Fine samples
.01 .3 .8 .8 .3 .01
Fall 2011 CS 6965
filter(x) f (x)
samples
filter(x)
samples
48
Fine samples Coarse sample Fine samples
.04 .3 .8 .9 .2 .01
Fall 2011 CS 6965
49
Fall 2011 CS 6965
2D Filtering: filter(x,y) f (x,y)
samples
∑
filter(x,y)
samples
∑
2D Separable filter: filter(x,y) = filterx(x) filtery(y) filterx(x) filtery(y) f (x,y)
samples
∑
filterx(x) filtery(y)
samples
∑
50
Separable General
Fall 2011 CS 6965
51
Random Uniform
Fall 2011 CS 6965
52
Stratified n-rooks
Fall 2011 CS 6965
53
256 spp 1 spp
Source: Physically Based Rendering, Pharr & Humphreys
Fall 2011 CS 6965
54
1 spp, stratified 4 spp, stratified
Fall 2011 CS 6965
55
Fall 2011 CS 6965
56
Fall 2011 CS 6965
57
Fall 2011 CS 6965
58
Fall 2011 CS 6965
59
Fall 2011 CS 6965
60
Fall 2011 CS 6965
61
Fall 2011 CS 6965
multiple pixels
the architecture
filters
distribution
62
ix-1 ix ix+1 ix-1 ix ix+1
Fall 2011 CS 6965
63
Fall 2011 CS 6965
64
1
1
Fall 2011 CS 6965
65
1
1
.25 .75
Fall 2011 CS 6965
66
1
1
.25 .75
Fall 2011 CS 6965
67
1
1
.25 .75
Fall 2011 CS 6965
68
1 spp
Fall 2011 CS 6965
69
9 spp jittered triangle
Fall 2011 CS 6965
70
Fall 2011 CS 6965
(+/- 1 lsb)
71
Fall 2011 CS 6965
72
Fall 2011 CS 6965
pixels: (add three more)
average
1 3 4 5 2
Fall 2011 CS 6965
pixels: (add three more)
average
74
1 3 4 5 2
Fall 2011 CS 6965
pixels: (add three more)
average
75
1 3 4 5 2 6 7 8
Fall 2011 CS 6965
76
Fall 2011 CS 6965
the Nyquist limit)
77
Fall 2011 CS 6965
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Fall 2011 CS 6965
95
CS6620 Spring 07
http://www.cs.utah.edu/~angell/cs6620/assignment6/
CS6620 Spring 07
http://www.cs.utah.edu/~bigler/classes/cs6620/final.html
CS6620 Spring 07
CS6620 Spring 07
CS6620 Spring 07
subclass of Primitive
pointer to an underlying object
translation vector from origin and calls intersect on underlying object
T O’+tV O+tV
CS6620 Spring 07
O+tV P = O + tV ʹ″ P = M 00 M 01 M 02 Tx M10 M11 M12 Ty M 20 M 21 M 22 Tz ⎡ ⎣ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ P
x
P
y
P
z
1 ⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥
CS6620 Spring 07
P = O + tV ʹ″ P = M 00 M 01 M 02 Tx M10 M11 M12 Ty M 20 M 21 M 22 Tz ⎡ ⎣ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ P
x
P
y
P
z
1 ⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ ʹ″ P = M P + T = MO + MV + T = ʹ″ O + t ʹ″ V where : ʹ″ O = MO + T ʹ″ V = MV O’+tV’ O+tV
CS6620 Spring 07
Primitive
underlying object
and then calls intersect on underlying object with the transformed ray
–Unit length ray directions –Normals
CS6620 Spring 07
vector
ray directions, then ray must be “re- normalized”
– Can be optimized for uniform scale factors
O’+tV’ O+tV l = v.normalize() intersect child t parent = tchild *l
CS6620 Spring 07
Consider a plane: N ⋅ P = 0 and a transform: ʹ″ P = M P Find a plane with normal ʹ″ N such that ʹ″ N ⋅ ʹ″ P = 0 N ⋅ P = 0 NPT = 0 N M −1M
( )PT = 0
NM −1
( ) MPT ( ) = 0
NM −1
( ) ʹ″
P = 0 ʹ″ N = NM −1
( ) = M −1 ( )
T N = M T
( )
−1 N
If M is a rotation matrix, M-1 = M T , so M T
( )
−1 = M
CS6620 Spring 07
ʹ″ N = M −1
T N
ʹ″ N = ʹ″ N ʹ″ N
CS6620 Spring 07
compute untransformed normal at intersection time intersect: HitInfo subhit transform ray length = normalize ray direction intersect child with subhit if(subhit.wasHit() && hit.hit(t*length, this, subhit.matl) Put normal in scratchpad
CS6620 Spring 07
to allow a “stack” of objects
transformations
Hit object Transform 1 Transform 2
CS6620 Spring 07
–All of the above solutions work fine, others may not
CS6620 Spring 07
Top BVH Instances Instanced
Primitives
CS6620 Spring 07
the bounding box of the transformed object
– Transform each vertex of the child bounding box (8
– Compute the min/max of each of these vertices – Doesn’t always result in tight bound
– Transform underlying model – Easy for polygonal objects – Not always possible for general objects
CS6620 Spring 07
–Perhaps store only inverse
cases:
–Pure translation –Pure rotation –Rotation + translation –Uniform scale –Uniform scale plus translation, rotation, or both –General case
CS6620 Spring 07
intersect: HitInfo subhit transform ray length = normalize ray direction intersect child with subhit if(subhit.wasHit() && hit.hit(t*length, this, overide_matl) Put normal in scratchpad Similar for other mechanisms
CS6620 Spring 07
graphics.cs.uiuc.edu/~jch/papers/paradigm.pdf
CS6620 Spring 07