Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on...

57
Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014

Transcript of Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on...

Page 1: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Multi-Hit Ray Traversal

Christiaan GribbleAlexis NaverosEthan Kerzner

ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games15 March 2014

Page 2: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Raise awareness of JCGT paper– Overview– Algorithm– Performance– Examples– Wrap-up

• Generate interest

Why present at i3D?

Gribble et al., Multi-Hit Ray Traversal 2

Page 3: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Raise awareness of JCGT paper• Generate interest

– Applying algorithm– Improving algorithm– Exploring non-optical rendering

Looking to collaborate on interesting problems in rendering

Why present at i3D?

Gribble et al., Multi-Hit Ray Traversal 3

Page 4: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Overview

Page 5: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Optical rendering Non-optical rendering

Interval computation

5Gribble et al., Multi-Hit Ray Traversal

Page 6: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Non-optical rendering Interval computation

Interval computation

6Gribble et al., Multi-Hit Ray Traversal

Page 7: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Difficult or impossible– Epsilon hacks– Missed/repeated intersections

• Performance impacts

7

Interval computation

Gribble et al., Multi-Hit Ray Traversal

Page 8: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Difficult or impossible• Performance impacts

– Traversal restart– Operational overhead

Are overlapping coplanar facets actually a problem?

8

Interval computation

Gribble et al., Multi-Hit Ray Traversal

Page 9: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Overlapping coplanar facets

Interval computation

9Gribble et al., Multi-Hit Ray Traversal

Page 10: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Algorithm

Page 11: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Which primitives are intersected?– One or more, & possibly all– Ordered by t-value along ray

• Core operation in ray engine• Critical to interval generation• Applications

11

Multi-hit ray traversal

Gribble et al., Multi-Hit Ray Traversal

Page 12: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Which primitives are intersected?• Core operation in ray engine

– Avoids negative epsilon hacks– Alleviates traversal restart

• Critical to interval generation• Applications

12

Multi-hit ray traversal

Gribble et al., Multi-Hit Ray Traversal

Page 13: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Which primitives are intersected?• Core operation in ray engine• Critical to interval generation

– Handles bad geometry gracefully– Enables early exit

• Applications

13

Multi-hit ray traversal

Gribble et al., Multi-Hit Ray Traversal

Page 14: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Which primitives are intersected?• Core operation in ray engine• Critical to interval generation• Applications

– Ballistic simulation– Transparent rendering– …

14

Multi-hit ray traversal

Gribble et al., Multi-Hit Ray Traversal

Page 15: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Buffered multi-hit with early exit

15Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

Page 16: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Initialization

16Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

ray

Page 17: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Initialization

17Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

ray

- - -

Page 18: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Traverse nodes

18Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

ray

- - -

Page 19: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Traverse nodes

19Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

ray

- - -

- - - - - -

node

Page 20: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some hits

20Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- - -

- - - - - -

F

Page 21: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some hits

21Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- - -

- - - - - -

F

hitData

Page 22: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some hits

22Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- -

- - - - - -

F

Page 23: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some hits

23Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- - -

- - - - - -

F

hitData

Page 24: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some hits

24Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- - -

- - - - - -

F

hitData

Page 25: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some hits

25Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- - - - - -

F

Page 26: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some hits

26Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- - - - - -

F

hitData

T

Page 27: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Process some hits

27Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- - - - - -

T

-

Page 28: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Process some hits

28Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- - - - -

T

- -

Page 29: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Process some hits

29Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- - - -

T

- - -

Page 30: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some (more) hits

30Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode T

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

F

- - -

- - -

Page 31: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some (more) hits

31Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

F

- - -

- - -

Page 32: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some (more) hits

32Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

F

- - -

- - -

Page 33: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some (more) hits

33Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

F

hitData

- - -

- - -

Page 34: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some (more) hits

34Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- -

F

- - -

Page 35: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some (more) hits

35Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

F

- -

- - -

Page 36: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find some (more) hits

36Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

- -

F

- - -

Page 37: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Process some (more) hits

37Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

F

- -

- --

-

Page 38: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Traverse (more) nodes

38Gribble et al., Multi-Hit Ray Traversal

hitMask

repeatNode

1 function Traverse(root, ray) 2 Initialize(hitList) 3 node <- root 4 while Valid(node) do 5 if !Empty(node) then 6 Initialize(hitMask) 7 repeat 8 repeatNode <- FALSE 9 for triangle in node do10 if !Contains(hitMask, tID) then11 if Intersect(triangle, ray) then12 hitData <- (t, u, v, tID, ...)13 if Full(hitList) then14 repeatNode <- TRUE15 Insert(hitList, hitData)16 for hitData in hitList do17 if !UserHit(ray, hitData) then18 return19 if repeatNode then20 Add(hitMask, hitData.tID)21 until !repeatNode22 node <- Next(node)

Buffered multi-hit ray traversal

hitList

node

ray

F

- -

- --

-

Page 39: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Results

Page 40: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Find-first-intersection– First-hit v. buffered multi-hit– Isolates multi-hit overhead

• Find-all-intersections• Find-some-intersections

40

Performance – tests

Gribble et al., Multi-Hit Ray Traversal

Page 41: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Find-first-intersection• Find-all-intersections

– Naive v. buffered multi-hit– Bounds performance expectations

• Find-some-intersections

41

Performance – tests

Gribble et al., Multi-Hit Ray Traversal

Page 42: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Find-first-intersection• Find-all-intersections• Find-some-intersections

– Naive v. buffered multi-hit– Demonstrates in situ performance

42

Performance – tests

Gribble et al., Multi-Hit Ray Traversal

Page 43: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Performance – scenes

43Gribble et al., Multi-Hit Ray Traversal

• First-hit, naive & buffered multi-hit traversal implemented in Rayforce• First-hit performance is in range of 200-800 Mrps• Images rendered at 1024x768 pixels on an NVIDIA GeForce GTX 690

sanm10M tris

tank1M tris

conf282K tris

fair174K tris

sibe80K tris

Page 44: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find-first-intersection

44Gribble et al., Multi-Hit Ray Traversal

sibe fair conf tank sanm0

100200300400500600700800

first-hit

buffered multi-hit

Mips

-31.69%

-30.75%

-29.08%

-31.76% -30.44%

Page 45: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find-all-intersections

45Gribble et al., Multi-Hit Ray Traversal

sibe fair conf tank sanm0

100

200

300

400

500

600naive multi-hit

buffered multi-hit

Mips

+8.07%

+12.30%+11.80%

+9.74%

+7.42%

Page 46: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Find-some-intersections

46Gribble et al., Multi-Hit Ray Traversal

sibe fair conf tank sanm0

100

200

300

400

500

600naive multi-hit

buffered multi-hit

Mips

+100.52% +80.97%

+14.95%+8.38%

+15.40% Scenes of highest complexity

Page 47: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Transparent rendering Ballistic simulation

Example applications

47Gribble et al., Multi-Hit Ray Traversal

Page 48: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.
Page 49: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Other (possible) applications

49

• Alpha textures• Thin fibers• Constructive solid geometry

Gribble et al., Multi-Hit Ray Traversal

[Wald et al. 2007]

Page 50: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Other (possible) applications

50

• Alpha textures• Thin fibers• Constructive solid geometry

Gribble et al., Multi-Hit Ray Traversal

[Sintorn & Assarson 2008]

Page 51: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Other (possible) applications

51

• Alpha textures• Thin fibers• Constructive solid geometry

Gribble et al., Multi-Hit Ray Traversal

Image source: Wikipedia

Page 52: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Wrap-up

Page 53: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Multi-hit ray traversal– Generalizes first-hit & all-hit traversal– Handles overlapping, coplanar facets– Useful in CG & simulation

• Buffered multi-hit algorithm• Future work

Conclusions

Gribble et al., Multi-Hit Ray Traversal 53

Page 54: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Multi-hit ray traversal• Buffered multi-hit algorithm

– Imposes only modest overhead– Outperforms naive algorithm– Makes all-hit unnecessary

• Future work

Conclusions

Gribble et al., Multi-Hit Ray Traversal 54

Page 55: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

• Multi-hit ray traversal• Buffered multi-hit algorithm• Future work

– Add multi-hit + object-partitioning– Explore multi-hit + direction change– Apply to new problems

Conclusions

Gribble et al., Multi-Hit Ray Traversal 55

Page 56: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

SURVICE EngineeringJeff AmstutzMark ButkiewiczScott Shaw

Intel LabsCarsten BenthinIngo WaldSven Woop

US Army Research LaboratoryLee Butler

JCGTMorgan McGuireMatt PharrAnonymous reviewers

Ethan Kerzner is funded in part by the US Army Research Laboratory Cooperative Agreement: Applying GPU Computing & Computer

Graphics to Engineering Analysis & Military Applications

Acknowledgements

56Gribble et al., Multi-Hit Ray Traversal

Page 57: Multi-Hit Ray Traversal Christiaan Gribble Alexis Naveros Ethan Kerzner ACM SIGGRAPH Symposium on Interactive 3D Graphics & Games 15 March 2014.

Contact information

57

AddressApplied Technology OperationSURVICE Engineering6014 Penn AvenuePittsburgh, PA 15206

[email protected]

Webhttp://www.rtvtk.org/~cgribble/

Gribble et al., Multi-Hit Ray Traversal