Parallel BVH Construction using k -means Clustering Daniel Meister - - PowerPoint PPT Presentation

parallel bvh construction using k means clustering
SMART_READER_LITE
LIVE PREVIEW

Parallel BVH Construction using k -means Clustering Daniel Meister - - PowerPoint PPT Presentation

Parallel BVH Construction using k -means Clustering Daniel Meister and Ji r Bittner Department of Computer Graphics and Interaction Faculty of Electrical Engineering Czech Technical University in Prague Motivation: Interactive Ray


slide-1
SLIDE 1

Parallel BVH Construction using k-means Clustering

Daniel Meister and Jiˇ r´ ı Bittner

Department of Computer Graphics and Interaction Faculty of Electrical Engineering Czech Technical University in Prague

slide-2
SLIDE 2

Motivation: Interactive Ray Tracing

t = tbuild + ttrace + tshading Trade-off between BVH quality (ttrace) and BVH build (tbuild) Goal minimize tbuild + ttrace camera image plane

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 2/19

slide-3
SLIDE 3

Bounding Volume Hierarchy

Ray tracing, collision detection, and visibility culling Rooted tree of arbitrary branching factor

Geometric primitives in leaves Bounding volumes in interior nodes

Branching factor 2, axis aligned bounding boxes A B A B [Clark 1976]

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 3/19

slide-4
SLIDE 4

Surface Area Heuristic

(2n − 3)!!1 valid binary bounding volume hierarchies c(N) = ⎧ ⎪ ⎪ ⎨ ⎪ ⎪ ⎩ kT + P(NL∣N)c(NL) + P(NR∣N)c(NR) if N is interior node kI∣N∣

  • therwise

P(NL∣N) = SA(NL) SA(N) P(NR∣N) = SA(NR) SA(N) N NL NR [MacDonald and Booth 1990]

1double factorial defined as k!! = k(k − 2)(k − 4) . . . 1 for odd k Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 4/19

slide-5
SLIDE 5

BVH Construction Methods

Top-down Surface Area Heuristic [Hunt et al. 2007, ...] Binning [Wald 2007, ...] Bottom-up Agglomerative clustering [Walter et al. 2008, Gu et al. 2013] Insertion Heuristic greedy search [Goldsmith and Salmon 1987] Online construction [Bittner et al. 2015]

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 5/19

slide-6
SLIDE 6

BVH Construction Methods

Top-down Surface Area Heuristic [Hunt et al. 2007, ...] Binning [Wald 2007, ...] k-means clustering Bottom-up Agglomerative clustering [Walter et al. 2008, Gu et al. 2013] Insertion Heuristic greedy search [Goldsmith and Salmon 1987] Online construction [Bittner et al. 2015]

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 5/19

slide-7
SLIDE 7

k-means Clustering

pass n pass 2 pass 1

.... ... ... ... ...

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 6/19

slide-8
SLIDE 8

k-means Clustering

Lloyd’s algorithm [Lloyd 1982] Initialize k representatives k-means loop

Assignment step Update step

Initialization of k representatives r1,...,rk Randomly draw r1 To select ri

Randomly draw p candidates Select one maximizing distance to the nearest already selected representative

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 7/19

slide-9
SLIDE 9

BVH Construction via k-means Clustering

Distance d between bounding boxes b1 and b2 d(b1,b2) = ∣∣bmin

1

− bmin

2

∣∣2 + ∣∣bmax

1

− bmax

2

∣∣2 Positions of representatives rt+1

i

= 1 ∣Ct

i∣( ∑ bj∈Ct

i

bmin

j

, ∑

bj∈Ct

i

bmax

j

) bmin

1

bmin

2

bmax

1

bmax

2

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 8/19

slide-10
SLIDE 10

Agglomerative Clustering

All treelets processed in parallel Na¨ ıve algorithm without additional data structures O(n3) Surface area of merged cluster as a distance between clusters [Walter et al. 2008] pass n+1

... ... ... ...

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 9/19

slide-11
SLIDE 11

k-means Visualization

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 10/19

slide-12
SLIDE 12

Results

9 scenes, 66k - 12M tris, 3 representatives views, resolution 1024 × 768 Path tracing with Russian roulette (GPU ray tracing kernel [Aila and Laine 2009])

Low quality rendering (total time LQ): 8 samples per pixel, 2 shadow samples High quality rendering (total time HQ): 128 samples per pixel, 2 shadow samples

Intel Core I7-3770 3.4 GHz CPU (4 cores), 16 GB RAM CUDA: NVIDIA GeForce GTX TITAN Black, 6 GB RAM

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 11/19

slide-13
SLIDE 13

Tested Methods

parameters k ... the number of clusters p ... the number of candidates in initialization procedure i ... the number of iterations reference methods Full sweep SAH (idealized with zero build time) LBVH [Karras 2012]: 60-bit Morton codes HLBVH [Garanzha et al. 2011]: 60-bit Morton codes, 15 bits for SAH splits ATRBVH [Domingues and Pedrini 2015]: 2 iterations, treelet size 9

  • Max. 8 triangles per leaf for all methods, SAH cost constants kT = 3, kI = 2

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 12/19

slide-14
SLIDE 14

Sponza

66k tris, k = 32, p = 20, i = 10

0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2 1.25

trace speed SAH cost total time LQ total time HQ k-means LBVH HLBVH ATRBVH

Normalized with the respect to idelized full sweep SAH builder

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 13/19

slide-15
SLIDE 15

Conference

331k tris, k = 8, p = 5, i = 2

0.7 0.8 0.9 1 1.1 1.2 1.3 1.4

trace speed SAH cost total time LQ total time HQ k-means LBVH HLBVH ATRBVH

Normalized with the respect to idelized full sweep SAH builder

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 14/19

slide-16
SLIDE 16

Power Plant

12759k tris, k = 16, p = 5, i = 5

0.5 1 1.5 2 2.5 3 3.5

trace speed SAH cost total time LQ total time HQ k-means LBVH HLBVH ATRBVH

Normalized with the respect to idelized full sweep SAH builder

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 15/19

slide-17
SLIDE 17

Power Plant

Kernel times of BVH construction

Q1: k = 8, p = 5, i = 0 Q2: k = 8, p = 5, i = 2 Q3: k = 16, p = 5, i = 5 Q4: k = 32, p = 20, i = 10 Q5: k = 64, p = 30, i = 15

500 1000 1500 2000 2500 3000 3500 4000 Q1 Q2 Q3 Q4 Q5 time [ms]

k-means initialization k-means loop cluster size computation triangle indices reordering bounding boxes computation agglomerative clustering

  • ther computation

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 16/19

slide-18
SLIDE 18

Power Plant

SAH cost stabilization rate (kT = 3, kI = 2)

k = 8, p = 5 k = 16, p = 5 k = 32, p = 20 k = 64, p = 30

85 90 95 100 105 110 115 2 4 6 8 10 SAH cost [-] iteration [-]

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 17/19

slide-19
SLIDE 19

Conclusion and Future Work

BVH construction k-means and agglomerative clustering Viable alternative to Morton ordering Implementation in CUDA Future work k-ary BVH Evaluation for larger k Other distance functions (e.g. k-medians)

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 18/19

slide-20
SLIDE 20

Thank you for your attention!

Daniel Meister and Jiˇ r´ ı Bittner

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 19/19

slide-21
SLIDE 21

Euclidean Distance

min

r n

i=1

∣∣xi − r∣∣2

2

d dr (

n

i=1

∣∣xi − r∣∣2

2) = −2 n

i=1

(xi − r) 0 = −2

n

i=1

(xi − r) =

n

i=1

(xi − r) =

n

i=1

xi − nr r = 1 n

n

i=1

xi (mean)

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 20/19

slide-22
SLIDE 22

Manhattan Distance

min

r n

i=1

∣∣xi − r∣∣1 d dr (

n

i=1

∣∣xi − r∣∣1) =

n

i=1

d dr∣∣xi − r∣∣1 =

n

i=1 d

j=1

d drj ∣xj

i − rj∣ = 0

d drj ∣xj

i − rj∣ =

⎧ ⎪ ⎪ ⎨ ⎪ ⎪ ⎩ −1 xj

i > rj

1 xj

i < rj

rj = ⎧ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎩ xj

( n+1

2 )

n odd

1 2(xj ( n

2 ) + xj

( n

2 +1))

n even (component-wise median)

Daniel Meister and Jiˇ r´ ı Bittner Parallel BVH Construction using k-means Clustering 21/19