Natural Neighbor Based Grid
DEM Construction Using a GPU
Thomas
Mølhave
Duke University
Joint work with
Pankaj
K.
Agarwal
and
Alex
Beutel
Flood mapping
–
Mandø
, Denmark
90 meter grid resolution
2
meter grid resolution
1
LIDAR
–
Light Detection and Ranging
Source: http://minnesota.publicradio.org/display/web/2008/07/09/digitalmap/
2
Digital Elevation Model (DEM)
•
Geographic Information Systems need models
•
Enables many applications
–
Hydrology, contouring, noise computations, line

of sight, city planning
3
Digital Elevation Models
•
Triangular Irregular Network (TIN)
4
4
GRID Terrain Models
•
Interpolation
•
Linear interpolation based on
Delaunay triangulation
[
Agarwal
et al. ‘05]
–
Simple but not smooth
–
Relatively fast
•
Regularized spline with
tension (RST)
[
Mitasova
et al.
93]
–
Uses high

order polynomials
–
Better with sparse data
–
Slow
5
Natural Neighbor Interpolation (NNI)
•
Based on
Voronoi
Diagram
•
Has been used
–
Slow implementations
6
NNI
Linear Interpolation
Voronoi
Diagram
7
V
o
r
S
(
p
)
{
x
R
2
x
p
x
q
q
S
}
A
Voronoi
cell
Vor
(
p
i
) is the region in
space for which
p
i
is the closest point
(the
nearest neighbor
) from the set of
input points
S
Natural Neighbor Interpolation
8
))
(
Area(Vor
))
(
Vor
)
(
Area(Vor
}
{
}
{
x
x
p
x
S
x
S
S
•
Vor
(
q
) takes area from
neighboring cells
(
natural
neighbors
)
•
Interpolate h(
q
) based on
weighted average
of heights of
natural neighbors h(
p
i
)
•
Weights are based on:
h
(
x
)
w
p
(
x
)
h
(
p
)
p
S
x
of
Cell
Voronoi
of
Area
)
(
Vor
from
stolen
Area
)
(
S
p
x
w
p
p
1
p
2
p
3
p
4
p
5
p
6
q
Our Contributions
•
Build
high

quality, large

scale grid
DEMs with
a natural neighbor based interpolation
scheme using the
GPU
–
Handle gaps in data by introducing the idea of
region of influence
–
Tuned for interpolating on uniform grid. Handle
10
6
NNI queries in one “pass”. Previous maximum
of ~32
[Fan et
al. ‘05]
–
Use
CUDA
to improve performance
9
Outline
•
GPU background
•
Voronoi
diagrams
•
NNI in one point
•
Batched NNI
•
NNI for grids
•
More Parallelism
•
Evaluation
10
Graphics Processing Unit (GPU)
•
Specialized hardware for parallel processing
•
Render 3D objects on 2D plane of pixels
Π
from a
viewpoint
o
•
Not just for graphics:
–
Robot collision detection, database systems, fluid
dynamics
11
GPU Buffers
•
Buffers are
2D array of
pixels
.
•
Color Buffer
–
Stores information about
color as seen from viewpoint
–
Can
blend objects
•
bitwise

OR
•
Depth buffer
–
Stores
distance to closest
object
from viewpoint
–
Can be set to read

only
12
Color Buffer
GPU Model of Computation
13
GPU
Graphics Card
Memory
CPU
Main Memory
Computing the
Voronoi
Diagram
[Hoff, et al. 1999]
14
Voronoi
Diagram and Lower Envelopes
•
For each point
p
i
define function
•
Lower envelope of
{
f
1
,f
2
…
f
n
}
is
•
Lower envelope
is distance from
x
to its nearest
neighbor
15
f
i
(
x
)
x
p
i
f
(
x
)
m
i
n
1
i
n
f
i
(
x
)
Rendering the
Voronoi
Diagram
Render
on GPU with
looking at cones from below
(
viewpoint
at

∞)
16
Pixelized
Voronoi
Diagram
17
•
Drawing on GPU discretizes
Voronoi
diagram. Call this
PVor
S
(
p
)
.
•
Render cone for each input
point
•
Depth buffer stores distance
from the pixel to the closest
input point (structure of the
Voronoi
diagrmam
)
•
Color buffer can store any
information specific to the
closest input point
Color buffer
Depth Buffer
Generating
Pixelized
Voronoi
Diagrams
18
Render
using truncated
polyhedralcones
Truncated
Pixelized
Voronoi
Diagram
TPVor
(S)
•
Radius of cone
r
defines region of
influence
•
If two points are
>2r
apart their cones can
not overlap and they
can not effect each
other.
19
Natural Neighbor Interpolation
20
[Fan, et al. ’05]
Natural Neighbor Interpolation
21
))
(
Area(Vor
))
(
Vor
)
(
Area(Vor
}
{
}
{
x
x
p
x
S
x
S
S
•
Vor
(
q
) takes area from
neighboring cells
(
natural
neighbors
)
•
Interpolate h(
q
) based on
weighted average
of heights of
natural neighbors h(
p
i
)
•
Weights are based on:
h
(
x
)
w
p
(
x
)
h
(
p
)
p
S
x
of
Cell
Voronoi
of
Area
)
(
Vor
from
stolen
Area
)
(
S
p
x
w
p
Natural Neighbor Interpolation
22
)
(
TPVor
)
(
TPVor
)
(
TPVor
)
(
'
)
(
)
(
'
)
(
}
{
}
{
x
x
p
x
w
p
h
x
w
x
h
x
S
x
S
S
p
S
p
p

TPVor
(
q
1
) = 73
h(q
1
)=(
33
/
73
)h(p
1
)+(
12
/
73
)h(p
2
)+(
28
/
73
)h(p
3
)
Call this process
BufferAnalysis
Discrete version:
Area of new
Voronoi
Cell:
Interpolated value:
NNI Query Processing
Draw
TPVor
(S)
Save and clear
color buffer
Draw
Voronoi
cell for query q
Save color
buffer
BufferAnalysis
Main Memory
GPU Memory
23
Batching NNI Queries
[Fan, et al.
’05]
24
NNI
Batch Query
Processing
25
Draw
TPVor
(S)
Save and clear
color buffer
Draw
Voronoi
cell for query q
Save color
buffer
BufferAnalysis
Batching NNI Queries
•
For a given pixel, only
need to know if
Voronoi
cell for
q
covers it (Y/N)
•
Only use one bit in color
buffer for each query
•
Color buffer performs
bitwise

OR
26
NNI
Batch Query
Processing
27
Draw
TPVor
(S)
Save and clear
color buffer
Draw
Voronoi
cell
for 32 queries
Save color buffer
BufferAnalysis
Batching Grids of NNI Queries
28
NNI for Grid DEM Construction
Grid of queries,
M
x
M
grid
29
Batched NNI on Grids
30
•
w
is number of bits in
color buffer (and
number of queries we
can handle by previous
algorithm)
•
Break grid into query
blocks of size
B
x
B
•
Could handle
each in
one pass
with previous
algorithm
B
w
Batched NNI on Grids
•
Assumptions:
2𝑟
<
𝐵
•
Queries in same position
in different query blocks
are
independent
•
Execute previous
algorithm on each query
block simultaneously
31
NNI
Grid Query
Processing
32
Draw
TPVor
(S)
Save and clear
color buffer
Draw
Voronoi
cell
for ~10
6
queries
Save color buffer
BufferAnalysis
Larger Grids
•
Grids restricted by size of
memory on GPU
•
Use I/O

efficient
partitioning
–
(
log
ℳ
ℬ
/
𝑛
)
recursion
depth
33
Putting it together
34
Implementation
•
Ran on
–
Intel Core2 Duo CPU running Ubuntu 10.4
–
NVIDIA GeForce GTX 470 with CUDA 3.0
•
OpenGL
•
Templated
Portable I/O Environment (TPIE
) for
interacting with disk efficiently
35
NNI
Batch Query
Processing
36
Draw
TPVor
(S)
Save and clear
color buffer
Draw
Voronoi
cell
for ~10
6
queries
Save color buffer
BufferAnalysis
•
Optimize GPU to CPU
communication
–
Transferring color buffers between
GPU and CPU memory is slow
–
For each query we have a multiple
pixels
–
Transferring
extra data
–
Perform
BufferAnalysis
with CUDA
directly
on GPU
–
Only transfer one value for each
query point
Draw
TPVor
(S)
Draw
Voronoi
cell for ~10
6
queries
BufferAnalysis
Save
interpolated
heights
Tests
Afghanistan:
3.5 gigabytes
186 million data
points
4
km
2
region
Fort Leonard Wood (Missouri)
57
GB
2.2 billion data
points
600
km
2
region
Source: NASA
Data from the Army Research Office
Performance

Efficiency
Afghanistan
Fort
Leonard Wood
Size
of input (10
6
)
186
2180
Size of output (10
6
)
9.5
151
RST
95m
34h
Linear Interpolation
16m
338m
38
Times in seconds
Performance

Efficiency
Afghanistan
Fort
Leonard Wood
Size
of input (10
6
)
186
2180
Size of output (10
6
)
9.5
151
RST
95m
34h
Linear Interpolation
16m
338m
NNI without CUDA
21m
186m
Binning Time
1m 30s
17m
Interpolation Time
19m
30s
169m
39
Times in seconds
Performance

Efficiency
Afghanistan
Fort
Leonard Wood
Size
of input (10
6
)
186
2180
Size of output (10
6
)
9.5
151
RST
95m
34h
Linear Interpolation
16m
338m
NNI without CUDA
21m
186m
NNI with CUDA
2m 40s
36m
Binning Time
1m
10s
17m
Interpolation Time
1m 30s
19m
40
Times in seconds
Performance

Quality
Afghanistan
all ground points
Afghanistan
sparse
ground points
41
NNI
Linear Interpolation
Future Work
•
Make region of influence more flexible
•
Extend algorithm to 3D
–
Spatial

temporal data
42
Thank you
43
Thanks to the Army Research Office for access to data
Comments 0
Log in to post a comment