Docsity

Image Synthesis Lecture 3: Preprocessing Scene with Uniform Grids and Spatial Hierarchies , Study notes of Computer Science

Partial preview of the text

Download Image Synthesis Lecture 3: Preprocessing Scene with Uniform Grids and Spatial Hierarchies and more Study notes Computer Science in PDF only on Docsity!

http://www.cs.virginia/edu/~gfx/Courses/2005/ImageSynthesis/

CS 447/647: Image Synthesis

Greg Humphreys, Spring 2005

Ray Tracing 2:

Acceleration

Preprocess scene

  1. Find bounding box Uniform Grids

Uniform Grids Preprocess scene

  1. Find bounding box
  2. Determine grid resolution
  3. Place object in cell if its bounding box overlaps the cell n 3 = d|O|

Uniform Grids n 3 = d|O| Preprocess scene

  1. Find bounding box
  2. Determine grid resolution
  3. Place object in cell if its bounding box overlaps the cell
  4. Check that object overlaps cell (expensive!)

Creating Spatial Hierarchies insert(node,prim) { if( overlap(node->bound,prim) ) if( leaf(node) ) { if( node->nprims > MAXPRIMS && node->depth < MAXDEPTH ) { subdivide(node); foreach child in node insert(child,prim) } else list_insert(node->prims,prim); } else foreach child in node insert(child,prim) } // Typically MAXDEPTH=16, MAXPRIMS=2-

Hierarchical Bounding Volumes Create tree of bounding volumes Children are contained within parent Creation preprocess  From model hierarchy  Automatic clustering Search intersect(node,ray,hits) { if( intersectp(node->bound,ray) if( leaf(node) ) intersect(node->prims,ray,hits) else for each child inter sect(child,ray,hits) }