View
220
Download
0
Category
Tags:
Preview:
Citation preview
Boolean Operations onBoolean Operations onSurfel-Bounded Solids Using Surfel-Bounded Solids Using
Programmable Graphics Programmable Graphics HardwareHardware
Bart Adams Philip Dutré
Katholieke Universiteit Leuven
Goal: CSG on the GPUGoal: CSG on the GPU
not rendering, but construction
GPGPU
Related WorkRelated Work
Adams and DutrAdams and Dutréé [2003] [2003] points, 3-color octreepoints, 3-color octree
Pauly et al.Pauly et al. [2003] [2003] points and MLS, kd-treepoints and MLS, kd-tree
Purcell et al.Purcell et al. [2002] [2002] ray tracing on the GPUray tracing on the GPU
Zwicker et al.Zwicker et al. [2004] [2004] splatting clipped surfelssplatting clipped surfels
Adams and DutrAdams and Dutréé [2003] [2003]
• Space partitioned using 3-color octree
• Boundary cells partitioned using // planes
Adams and DutrAdams and Dutréé [2003] [2003]
• Classification of a surfel:
test against 3-color octree
test against boundary planes
test against nearest surfel:
NN query!
α
CPUCPU GPU: Problems GPU: Problems
• Hierarchical algorithm– solution:
• use 3-color grid instead of octree• only test surfels individually
• NN query for surfels close to the boundary– solution:
• avoid NN query• use local distance fields
Part 1: Inside-Outside Part 1: Inside-Outside PartitioningPartitioning
Partitioning: IdeaPartitioning: Idea
• Partition space around solids
• Construct 3-color grid– interior cells– exterior cells– boundary cells
• Partition boundary cells– signed distance field
Partitioning Boundary CellsPartitioning Boundary Cells
• Lay out cell corners in texture memory
p6
p7
p4
p5
p2
p3
p0
p1
p0 p1 p2
p7 p3
p6 p5 p4
Partitioning Boundary CellsPartitioning Boundary Cells
• Lay out cell corners in texture memory
p4 p5 p6
p11 p7
p10 p9 p8
p6
p7
p4
p5
p10
p11
p8
p9
p2
p3
p0
p1
p0 p1 p2
p7 p3
p6 p5 p4
Partitioning Boundary CellsPartitioning Boundary Cells
• Render each surfel as 3x3 glPoint with center corresponding to cell center
p4 p5 p6
p11 p7
p10 p9 p8
p6
p7
p4
p5
p10
p11
p8
p9
p2
p3
p0
p1
p0 p1 p2
p7 p3
p6 p5 p4
Partitioning Boundary CellsPartitioning Boundary Cells
• Render each surfel as 3x3 glPoint with center corresponding to cell center
p4 p5 p6
p11 p7
p10 p9 p8
p6
p7
p4
p5
p10
p11
p8
p9
p2
p3
p0
p1
p0 p1 p2
p7 p3
p6 p5 p4
Partitioning Boundary CellsPartitioning Boundary Cells
• Render each surfel as 3x3 glPoint with center corresponding to cell center
p4 p5 p6
p11 p7
p10 p9 p8
p6
p7
p4
p5
p10
p11
p8
p9
p2
p3
p0
p1
p0 p1 p2
p7 p3
p6 p5 p4
known as scatter easy in VP
Partitioning Boundary CellsPartitioning Boundary Cells
• Fragment program computes signed distance between surfel and cell corner
p4 p5 p6
p11 p7
p10 p9 p8
p6
p7
p4
p5
p10
p11
p8
p9
p2
p3
p0
p1
p0 p1 p2
p7 p3
p6 p5 p4ps
dist = || p4 – ps ||
sign = (p4 – ps)·ns>0?+1:-1
color = dist * sign
depth = dist/diag
Set glDepthFunc to GL_LEQUAL
• Construct 3-color grid using distance values from boundary cell corners– render textured quad– each pixel corresponds
to a cell
Classifying Empty CellsClassifying Empty Cells
• First pass: cells on the left from boundary cell are classified– inside if di < 0
– outside if di > 0
• Easy in FP: – 4 texture fetches
Classifying Empty CellsClassifying Empty Cells
• Next passes: cells on the left from a classified empty cell are classified
• Easy in FP: – 1 texture fetch
Classifying Empty CellsClassifying Empty Cells
• Next passes: cells on the left from a classified empty cell are classified
• Easy in FP: – 1 texture fetch
• Iterate further
Classifying Empty CellsClassifying Empty Cells
• Next passes: cells on the left from a classified empty cell are classified
• Easy in FP: – 1 texture fetch
• Iterate further
Classifying Empty CellsClassifying Empty Cells
• Next passes: cells on the left from a classified empty cell are classified
• Easy in FP: – 1 texture fetch
• Iterate further
Classifying Empty CellsClassifying Empty Cells
• Next passes: cells on the left from a classified empty cell are classified
• Easy in FP: – 1 texture fetch
• Iterate further
Classifying Empty CellsClassifying Empty Cells
• All non-classified cells are outside (assumption: closed solid)
Classifying Empty CellsClassifying Empty Cells
Part 2: Inside-Outside Part 2: Inside-Outside ClassificationClassification
Classification: IdeaClassification: Idea
• Test surfels against partitioning of other solid:
test against 3-color grid
test against distance field
(+ compute clipping plane)
Implementation: First PassImplementation: First Pass
• Enable depth write
• Render quad textured with surfel positions
• Test each surfel against 3-color grid– if surfel in empty cell:
• surfel takes classification of empty cell
• write depth value z1
– if surfel in boundary cell:
• write depth value z2 with z1 < z2
Implementation: Second Implementation: Second PassPass
• Disable depth write
• Set glDepthFunc to GL_LEQUAL
• Render quad textured with surfel positions– at depth z with z1 < z < z2
• Classify surfel using distance field– 8 texture fetches, tri-linear reconstruction
• Only unclassified surfels pass– fragments with z == z2
• Early z culling!
Clipping PlaneClipping Plane
• Surfels close to other surface:– clipped
– resampled
• Clipping plane defined by:– distance field value– distance field gradient
Timings: partitioningTimings: partitioning
• Distance field creation step (~ #surfels)
# surfels 60k 170k 250k 370k
time 37ms 98ms 142ms 220ms
• 3-color grid creation step (~ grid size)
grid size 103 203 303 403
time 3ms 22ms 104ms 214ms
Timings CPU Timings CPU GPU GPU
Partitioning Classification
[AD03] GPU [AD03] GPU
30k 60k 720ms 245ms 330ms 19ms
90k 170k 1980ms 351ms 490ms 49ms
200k 250k 3500ms 492ms 720ms 80ms
÷5 ÷10
Dragon - dragonDragon - dragon
Each dragon:
#surfels:650k
grid size:363
partitioning:700ms
classification:122ms
DiscussionDiscussion
Limitations– space wasted in distance field texture– not adaptive ( ADFs)– no hierarchy: each surfel classified individually– accuracy dependent on grid resolution
Advantages– 5 to 10 times faster
Recommended