0% found this document useful (0 votes)
22 views20 pages

Estruturas de Dados Espaciais: MC-930 MO-603

The document discusses several spatial data structures used for ray tracing, including grids, octrees, and k-d trees. It provides details on grids, which use a 3D array of cells (voxels) to tile space and each cell points to intersecting surfaces. It notes grids work best when each cell lists a few objects but are poor for nonhomogeneous scenes. The document also covers octrees and briefly mentions k-d trees and binary space partitioning (BSP) trees, including how BSP trees can be used for hidden surface removal through painter's algorithm.

Uploaded by

Ivan Barreto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views20 pages

Estruturas de Dados Espaciais: MC-930 MO-603

The document discusses several spatial data structures used for ray tracing, including grids, octrees, and k-d trees. It provides details on grids, which use a 3D array of cells (voxels) to tile space and each cell points to intersecting surfaces. It notes grids work best when each cell lists a few objects but are poor for nonhomogeneous scenes. The document also covers octrees and briefly mentions k-d trees and binary space partitioning (BSP) trees, including how BSP trees can be used for hidden surface removal through painter's algorithm.

Uploaded by

Ivan Barreto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 20

Estruturas de Dados Espaciais

MC-930
MO-603

Speeding Up Ray Tracing

Estruturas de Dados Espaciais

Bounding Volumes

Hierarquical Bounding Volume

Grids
Data structure: a 3-D array of cells (voxels) that tile space
Each cell points to list of all surfaces intersecting that cell

Mais sobre Grids


Be Careful! The fact that a ray passes through a cell and hits na object
doesnt mean the ray hit that object in that cell
Optimization: cache intersection point and ray id in mailbox
associated with each object
Grids are a poor choice when the world is nonhomogeneous (clumpy)
e.g. a teapot in a stadium: many polygons clustered in a small space

How many cells to use?


too few many objects per cell slow
too many many empty cells to step through slow

Grids work well when you can arrange that each cell lists a few (ten,
say) objects
Better strategy for some scenes: nested grids

Octrees

Which Structure is Best for Ray Tracing?

K-d Trees and BSP Trees

Building a BSP Tree

1
2
3

2
3
a

1
b c

a BSP tree
using 2 as root

viewpoint

a
b

the subdivision
of space it implies

Building the Tree 2


Using line 3 for the root requires a split

1
2a

2a
3

viewpoint

2b

2b
1

Building a Good Tree - the tricky part

Uses for Binary Space Partitioning (BSP) Trees

Painters Algorithm with BSP trees

Drawing a BSP Tree

front_to_back(tree, viewpt) {
if (tree == null) return;
if (positive_side_of(root(tree), viewpt)) {
front_to_back(positive_branch(tree, viewpt);
display_polygon(root(tree));
front_to_back(negative_branch(tree, viewpt);
}
else { draw negative branch first}
}

Drawing Back to Front


Hidden surface removal

1
2a

2a
3

viewpoint

2b

2b
1

Clipping BSP Trees

Clipping BSP Trees

Clipping Using Spatial Data Structures

You might also like