Presentation is loading. Please wait.

Presentation is loading. Please wait.

Estruturas de Dados Espaciais MC-930 MO-603. Speeding Up Ray Tracing.

Similar presentations


Presentation on theme: "Estruturas de Dados Espaciais MC-930 MO-603. Speeding Up Ray Tracing."— Presentation transcript:

1 Estruturas de Dados Espaciais MC-930 MO-603

2 Speeding Up Ray Tracing

3 Estruturas de Dados Espaciais

4 Bounding Volumes

5 Hierarquical Bounding Volume

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

7 Mais sobre Grids Be Careful! The fact that a ray passes through a cell and hits na object doesn’t 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

8 Octrees

9 Which Structure is Best for Ray Tracing?

10 K-d Trees and BSP Trees

11 Building a BSP Tree the subdivision of space it implies a BSP tree using 2 as root 2 31 1 2 3 abcd a b c d viewpoint

12 Building the Tree 2 1 2a 2b 3 3 2a 2b 1 viewpoint Using line 3 for the root requires a split

13 Building a Good Tree - the tricky part

14 Uses for Binary Space Partitioning (BSP) Trees

15 Painter’s Algorithm with BSP trees

16 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…} }

17 Drawing Back to Front 1 2a 2b 3 3 2a 2b 1 viewpoint Hidden surface removal

18 Clipping BSP Trees

19

20 Clipping Using Spatial Data Structures


Download ppt "Estruturas de Dados Espaciais MC-930 MO-603. Speeding Up Ray Tracing."

Similar presentations


Ads by Google