Octree Traversal

Octree Traversal
Ref: Revelles et al. 2000
Ray Tracing
Global illumination that considers
shadow, reflection, refractions, …
Fall 2005
2
Object-Ray Intersection
The most time-consuming operations in
ray tracing
Fall 2005
3
Octree
Hierarchical spatial structure that
speeds up the computation
Fall 2005
4
Octree Traversal
the process of
finding the subset of
voxels in an octree
pierced by a
directed line
Only ray trace the
objects in the voxels
Fall 2005
Two groups of
algorithms


Bottom-up: traversing
starts at first terminal
node intersected by ray.
Use neighbor-finding to
obtain the next node
Top-down: start from the
root node; recursive
down to the terminal
voxel
5
Ex: SMART[91]
Fall 2005
A bottom-up traversal
6
Top-down Algorithm [Revelles00]
p
Fall 2005
d
o
Node in a tree
x0(o), x1(o)
Lower (upper) bound of o in X
y0(o), y1(o)
Lower (upper) bound of o in Y
s(o)
Side length of o
In the following discussion,
assume dx > 0 dy > 0
7
Ray/Boundary Intersection
ty1
tx1
o
Node in a tree
x0(o), x1(o)
Lower (upper) bound of o in X
y0(o), y1(o)
Lower (upper) bound of o in Y
s(o)
Side length of o
ty0
tx0
x0  p x
x0  p x  td x  t x 0 
dx
x1  p x
t x1 
dx
t x  t x1  t x 0
 s (o) / d x
Fall 2005
8
Ray/SubnodeBoundary
Intersection
o2
txm
o0
tx0
o3
tym
o1
tx1
o
Node in a tree
x0(o), x1(o)
Lower (upper) bound of o in X
y0(o), y1(o)
Lower (upper) bound of o in Y
s(o)
Side length of o
t x o, r   t x1  t x 0
 s (o ) / d x
t x oi , r   s(oi ) / d x
 t x o, r  / 2
With these, the intersection
parameters at child node can be
easily derived
Similarly,
Fall 2005
9
Ray-Node Intersection (1)
ty1
t
and
tx1
Parametrically,
tx0
Fall 2005
ty0
 t0
10
Ray-Node Intersection (2)
ty1
t
and
ty0
tx1
 t0
tx0
Fall 2005
11
Equivalently
tx1
tx0
ty0
tx0
ty1
tx1
ty0
Fall 2005
ty1
12
Algorithm
Use tx0, tx1, ty0, ty1 to compute txm,
tym
This procedure selects the first-hit
subnode
Fall 2005
If ray hit this
node …
q2
q3
q0
q1
13
Observation
Fall 2005
14
Summary
The method is based on parametric
representation of the ray
Incrementally compute the parameter
values at which the ray intersects the
planes
Computation uses only additions and
divisions by two
Fall 2005
15