Acceleration Structures
CS 6965 Fall 2011
Acceleration Structures CS 6965 Fall 2011 Program 2 Run Program - - PowerPoint PPT Presentation
Acceleration Structures CS 6965 Fall 2011 Program 2 Run Program 1 in simhwrt Also run Program 2 and include that output Lab time? Inheritance probably doesnt work CS 6965 Fall 2011 2 Boxes Axis aligned boxes
CS 6965 Fall 2011
Fall 2011 CS 6965
2
Fall 2011 CS 6965
3
Fall 2011 CS 6965
N ⋅ P − d = 0 t = d − N ⋅O N ⋅V x plane: N = 1
t = d − Ox Vx d1 = P
1x,d2 = P 2x
tx1 = P
1x − Ox
Vx ,tx2 = P
2x − Ox
Vx Same for y, z planes O
4
P
1
P
2
O V tx1 tx2
Fall 2011 CS 6965
5
P
1
P
2
O x interval y interval Intersection occurs where x interval overlaps y interval x interval: min(tx1,tx2) ≤ t ≤ max(tx1,tx2) y interval: min(ty1,ty2) ≤ t ≤ max(ty1,ty2) intersection: max(minx,miny) ≤ t ≤ min(maxx,maxy)
Fall 2011 CS 6965
6
Fall 2011 CS 6965
Adapted from Arvo/Kirk “A survey of ray tracing acceleration techniques”
7
Fall 2011 CS 6965
8
Fall 2011 CS 6965
Volume Hierarchy
9
Fall 2011 CS 6965
acceleration structure
10
ray
Fall 2011 CS 6965
11
ray
Fall 2011 CS 6965
12
Pmax Pmin
Fall 2011 CS 6965
13
Fall 2011 CS 6965
14
tnear Pmax Pmin
Fall 2011 CS 6965
V
15
Pmax Pmin P,L
Fall 2011 CS 6965
16
Pmax Pmin diy=1 diy=-1
Fall 2011 CS 6965
17
dtdy dtdx
Fall 2011 CS 6965
18
far near far near L.x L.x
Fall 2011 CS 6965
19
far tnext_y tnext_x
Fall 2011 CS 6965
20
zenter zexit Side view
Fall 2011 CS 6965
21
zenter zexit Side view
Fall 2011 CS 6965
22
datamax datamin zmax zmin
Fall 2011 CS 6965
patch, Bicubic patch
that partially overlap cell
23
Fall 2011 CS 6965
24
Pmin far tnext_y tnext_x
Fall 2011 CS 6965
25
– Stop if hit the surface at t>epsilon – Stop if L.x == stop_x or L.y == stop_y – Stop if tnear > tfar – Otherwise, back to step 8
– Cannot stop if you find a hit! – Stop if hit.minT < new tnear – Stop if L.x == stop_x or L.y == stop_y or L.z == stop_z – tnear > tfar condition is redundant
Pmax Pmin
Fall 2011 CS 6965
finds yellow triangle, t outside
intersect again, ray finds blue circle with smaller t
1 2 3 1 2 3
Fall 2011 CS 6965
intersections
27
1 2 3
Fall 2011 CS 6965
intersect if ray ID == last ray ID for object (NOT thread safe!)
28
1 2 3
Fall 2011 CS 6965
29
CS6620 Spring 07
–Required:
// Get the bounding box for this object // Expand the input bounding box void getBounds(BoundingBox& bbox);
–Optional:
// Does the object intersect this box? // always return true if you aren’t sure bool intersects(BoundingBox& cell_bbox);
CS6620 Spring 07
Compute bounding box Transform extents to index space (careful with rounding)
Rounding: Lower: round down Upper: round up lx hx hy ly
CS6620 Spring 07
Compute bounding box Transform extents to index space (careful with rounding) 3D loop lx,ly,lz to hx,hy,hz:
Add object to each cell Loop over green area lx hx hy ly
CS6620 Spring 07
Compute bounding box Transform extents to index space (careful with rounding) 3D loop lx,ly,lz to hx,hy,hz:
If(object intersects cell boundary) Add object to each cell Blue cells won’t get added with an additional check lx hx hy ly
CS6620 Spring 07
–First pass: count objects in each cell –Allocate memory all at once –Second pass: insert objects into list
CS6620 Spring 07
–Objects only at bottom levels –Objects mixed throughout the tree –Lots of variations
–Theoretically optimal –BUT traversal across grid is much faster than up/down grid
Fall 2011 CS 6965
and redundant intersections vs. efficiency)
36
Fall 2011 CS 6965
37
Fall 2011 CS 6965
that a ray hits a particular
38
Fall 2011 CS 6965
39
Fall 2011 CS 6965
40
P1 P2 C
Fall 2011 CS 6965
renderer at this point
41
P1 P2 P3
Fall 2011 CS 6965
Cx ± rad Ny
2 + Nz 2
N = 1 Similar for y/z
42
Fall 2011 CS 6965
Volume Hierarchy or similar
43
Fall 2011 CS 6965
for sorted lists
44
Fall 2011 CS 6965
spatial relationships
bounding box of all the objects below it
45
Fall 2011 CS 6965
intersect the ray with the bounding box
subtree
children
46
Fall 2011 CS 6965
intersect the ray with the bounding box
subtree
children
47
Fall 2011 CS 6965
intersect the ray with the bounding box
subtree
children
48
Fall 2011 CS 6965
intersect the ray with the bounding box
subtree
children
49
Fall 2011 CS 6965
closer than the BVH node
50
Fall 2011 CS 6965
closer than the BVH node
that is closer to origin of the ray first
51
Fall 2011 CS 6965
closer than the BVH node
that is closer to origin of the ray first
52
Fall 2011 CS 6965
NP-hard problem
surface area)
53
bad
Fall 2011 CS 6965
bounding box
half of objects on left and half on right
54
Fall 2011 CS 6965
tree
cause smallest increase to area
55
Fall 2011 CS 6965
tree
cause smallest increase to area
56
Fall 2011 CS 6965
tree
cause smallest increase to area
57
Fall 2011 CS 6965
tree
cause smallest increase to area
58
Fall 2011 CS 6965
node
plane?
dimension?
59
Fall 2011 CS 6965
can be arbitrarily located
dimension?
plane?
bounds
60
Fall 2011 CS 6965
61
Fall 2011 CS 6965
62
Fall 2011 CS 6965
63
Min: 0 Max: ∞
Fall 2011 CS 6965
with updated intervals
64
Min: 0 Max: ∞ Split: 1.0 Stack: 1 New min: 0 New max: 1.0 1 2
Fall 2011 CS 6965
with updated intervals
65
Min: 0 Max: 1.0 Split: 1.3 Stack: 1 New min: 0 New max: 1.0 3 4
Fall 2011 CS 6965
with updated intervals
66
Min: 0 Max: 1.0 Split: 0.4 Stack: 1 5 New min: 0 New max: 0.4 5 6
Fall 2011 CS 6965
with updated intervals
67
Min: 0.4 Max: 1.0 Split: 0.7 Stack: 1 8 New min: 0.4 New max: 0.6 7 8
Fall 2011 CS 6965
with updated intervals
68
Min: 0.7 Max: 1.0 Split: Stack: 1 New min: 0.4 New max: 0.6 7 8
Fall 2011 CS 6965
with updated intervals
69
Min: 1.0 Max: ∞ Split: 1.5 Stack: 10 New min: 1.0 New max: 1.5 9 10
Fall 2011 CS 6965
with updated intervals
70
Min: 1.0 Max: 1.5 Split: 1.4 Stack: 10 11 New min: 1.0 New max: 1.4 11 12
Fall 2011 CS 6965
71
Fall 2011 CS 6965
72
Fall 2011 CS 6965
73