Computer-Aided Design and Manufacturing Laboratory: 3D Minkowski sum computation Sara McMains UC...

31
Computer-Aided Design and Manufacturing Laboratory: 3D Minkowski sum computation Sara McMains UC Berkeley

Transcript of Computer-Aided Design and Manufacturing Laboratory: 3D Minkowski sum computation Sara McMains UC...

Computer-Aided Design and Manufacturing Laboratory: 3D Minkowski sum computation

Sara McMains

UC Berkeley

University of California, Berkeley

Problem Description Input

Triangulated polyhedra Output

Minkowski sum (MS) rendering MS voxelization

University of California, Berkeley

Why Voxelization? GPU-based fast computation

At least one order of magnitude faster than prior algorithms

Varadhan & Manocha 2006

Lien 2008 Ours 2010

3120 s

318 s7.6 s

=

O(m3n3)O(m)

O(n)

University of California, Berkeley

Why Voxelization Ready-to-use sample points

B-rep based MS is usually sampled for motion planning [Lien 08, Varadhan et al. 06]

Free C- Space:Feasible locations where the robot doesn’t collide with the obstacle

start

goal

path

( Obstacle Robot )c

Obstacle RobotForbidden C-Space:

?

University of California, Berkeley

Approach OverviewSurface Primitive

Culling

Outer Boundary Rendering

Solid Voxelization

Surface Voxelization

Rendering

Voxelization

University of California, Berkeley

Surface Primitives MS boundary surfaces:

(trimmed) triangle primitives

Triangle vertex (trimmed) quad

primitives Edge edge

Number of primitives O(n2)

University of California, Berkeley

Primitive Culling Culling out “non-contributing”

primitives Primitives completely hidden inside

Conservative culling Still ~99% of primitives are culled out

Before Culling

After Culling

University of California, Berkeley

Culling Criteria Convexity Test

fA⨁vB contributing only if vB is convex eA⨁eB contributing only if eA and eB are

convex

fA

vB

eAeB

University of California, Berkeley

Culling Criteria Orientation Test [Kaul and Rossignac 92]

fA⨁vB contributing only if ei

B, nAeiB 0

nA: outer normal of fA

eiB: i-th incident edge of vB

eA⨁eB contributing only if ei , (eA×eB)ei has same sign

ei: i-th incident edge of eA or eB

nA

fA e0

vB

e1 em……

eB

e2

e3

eA

e0

e1

University of California, Berkeley

Culling Examples

(500)

(12,396)

(2,116)

Ball + Clutch Ball + Bull Clutch + Bull0

20,000,000

40,000,000

60,000,000

80,000,000

100,000,000

99.11% reduction

99.66% reduction

98.92% reduction

Before culling After culling

# p

rim

itiv

es

University of California, Berkeley

Implementation on CUDA Execution configuration

Block size of 1616 Thread (i,j) for fi⨁vj or ei⨁ej

f1 f2f16

v1v2

v16

thread (i,j)

University of California, Berkeley

Memory Optimization Coalesced global memory

(x1y1z1x2y2z2…xnynzn) – not coalesced

(x1x2…xny1y2…ynz1z2…zn) – coalesced Shared memory

16 triangles and 16 vertices per block(or 16 edges from each polyhedron)

~3 speedup gain

University of California, Berkeley

Memory Optimization

octopus + baby

dancing_kids + torus

octopus + horse

0

5

10

15

20

25

Uncoalesced global memory

Coalesced global memory

Shared memory + coalesced global memory

Tim

e (s

econ

ds)

University of California, Berkeley

Rendering Results

A:

B:

AB:

University of California, Berkeley

Rendering Timings

bunny + ball pig + horse Scooby + torus dancing kids + octopus0

100

200

300

400

500

26x speedup

25x speedup

29xspeedup

32xspeedup

CPU - 3 GHz Pentium 4 GPU - Quadro FX 5800

TIm

e (

seco

nd

s)

University of California, Berkeley

Approach OverviewSurface Primitive

Culling

Outer Boundary Rendering

Solid Voxelization

Surface Voxelization

Rendering

Voxelization

University of California, Berkeley

Overview of Voxelization Algorithm

Primitive Voxelization Orthogonal Fill Flood Fill

University of California, Berkeley

Primitive Voxelization To voxelize the remaining primitives

after culling

Contributing primitives

Non-contributing primitives

University of California, Berkeley

GPU-Based Voxelization [Dong et al. 04]

Volume encoding 3D texture (32-bit RGBA) 1 bit/voxel Or 128 MB for 10243

Multiple Rendering Targets (MRTs) Render to 8 buffers

simultaneously Texture composite

Three directional voxelizations

328 slices per rendering

One of three rendering directions

3D texture visualization: each color band represents eight slices of voxels

University of California, Berkeley

Orthogonal Fill To find outer voxels visible along

one of the six orthogonal directions

Depth buffer 8.0 5.6

Depth

0

1

2

3

4

5

6

7

8

1.2 1.8 2.4 2.3 2.8 8.0

Render to depth buffer

Projection plane

Depth

0

1

2

3

4

5

6

7

8

Color coding(2 bits per color channel)

Depth buffer 8.0 5.6 1.2 1.8 2.4 2.3 2.8 8.0

Projection plane

University of California, Berkeley

Flood Fill To find remaining outer voxels not

visible along any of the six orthogonal directions

Flood fill (seed fill)

Barrier

Seed

University of California, Berkeley

GPU-Based 3D Flood Fill Barrier: primitive voxels Seed: orthogonal outer

voxels Usually a lot of seeds

Mask technique Neighbors of newly found

outer voxels Parallel implementation on

GPU Find a whole new “front” in

each iteration

1 1 1 1 1 1

1 1

2

2

2 23 3

3

4

University of California, Berkeley

Surface Voxelization Identify all the primitive voxels

adjacent to at least one outer voxel

University of California, Berkeley

Voxelization Results

(170,106)

(1,600)

(78,706) (8,276)

Resolution: 10243

Time: 16.2 s

Resolution: 10243

Time: 25.7 s

Limitation: holes are not computed

University of California, Berkeley

Timings

bull + frame grate1 + grate2 clutch + knot bull + knot inner ear + knot0.00

100.00

200.00

300.00

400.00

500.00

600.00

700.00

800.00

900.00

1000.00

148x 169x 351x

336x

454x

21x 42x 72x

66x

95x

Lien's Ours: 512 Ours: 1024

Tim

e (s

econ

ds)

University of California, Berkeley

Summary GPU-based voxelization approach for

MS Robust and easy implementation At least one order of magnitude faster Memory efficient

University of California, Berkeley

Acknowledgments Wei Li NSF DMI-0547675, 0621198 UC Discovery

University of California, Berkeley

THANKS

University of California, Berkeley

Backup Slides

University of California, Berkeley

MS with Holes The yellow disc can be placed at B,

but it cannot go from A to B

Object Space Configuration Space

University of California, Berkeley

Accuracy of Voxelization A sphere needs to be polygonized

with about 5,000 triangles [Baumgardner

and Frederickson, 1985] in order to match the accuracy of the voxelization at a resolution of 10243.