Ray Tracing Acceleration Structures Solomon Boulos 4/16/2004.

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

1 Binary Space Partition Trees ©Anthony Steed, Yiorgos Chrysanthou
GR2 Advanced Computer Graphics AGR
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Nearest Neighbor Search
Restart Trail for Stackless BVH Traversal Samuli Laine NVIDIA Research.
Collision Detection CSCE /60 What is Collision Detection?  Given two geometric objects, determine if they overlap.  Typically, at least one of.
Ray Tracing Ray Tracing 1 Basic algorithm Overview of pbrt Ray-surface intersection (triangles, …) Ray Tracing 2 Brute force: Acceleration data structures.
Computer graphics & visualization Collisions. computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization.
Ray Tracing CMSC 635. Basic idea How many intersections?  Pixels  ~10 3 to ~10 7  Rays per Pixel  1 to ~10  Primitives  ~10 to ~10 7  Every ray.
CS 445 Greg Humphreys, Spring 2003 Ray Tracing 2: Acceleration.
Hidden Surface Removal Why make the effort?  Realistic models.  Wasted time drawing. OpenGL and HSR  OpenGL does handle HSR using the depth buffer.
CSE 381 – Advanced Game Programming Scene Management
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
Collision Detection CSE 191A: Seminar on Video Game Programming Lecture 3: Collision Detection UCSD, Spring, 2003 Instructor: Steve Rotenberg.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
A lion in the desert How do you find a lion in the desert? How about when you have a predicate that tells you if the lion is in front or behind a separating.
Introduction General Data Structures - Arrays, Linked Lists - Stacks & Queues - Hash Tables & Binary Search Trees - Graphs Spatial Data Structures -Why.
A lion in the desert How do you find a lion in the desert? How about when you have a predicate that tells you if the lion is in front or behind a separating.
B + -Trees (Part 1). Motivation AVL tree with N nodes is an excellent data structure for searching, indexing, etc. –The Big-Oh analysis shows most operations.
1 Advanced Scene Management System. 2 A tree-based or graph-based representation is good for 3D data management A tree-based or graph-based representation.
Estruturas de Dados Espaciais MC-930 MO-603. Speeding Up Ray Tracing.
Collision Detection David Johnson Cs6360 – Virtual Reality.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
Hidden Surface Removal
BSP Trees, Quadtrees & Octrees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, January 28, 2004.
Acceleration Digital Image Synthesis Yung-Yu Chuang 10/4/2005 with slides by Mario Costa Sousa and Pat Hanrahan.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Data Structures for Computer Graphics Point Based Representations and Data Structures Lectured by Vlastimil Havran.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
1 Speeding Up Ray Tracing Images from Virtual Light Field Project ©Slides Anthony Steed 1999 & Mel Slater 2004.
Implementing Scene Graphs, CSG Trees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, January 26, 2004.
INTRODUCTION TO BINARY TREES P SORTING  Review of Linear Search: –again, begin with first element and search through list until finding element,
Visible-Surface Detection Jehee Lee Seoul National University.
An Evaluation of Existing BVH Traversal Algorithms for Efficient Multi-Hit Ray Tracing Jefferson Amstutz (SURVICE) Johannes Guenther (Intel) Ingo Wald.
Institute of C omputer G raphics, TU Braunschweig Hybrid Scene Structuring with Application to Ray Tracing 24/02/1999 Gordon Müller, Dieter Fellner 1 Hybrid.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
Saarland University, Germany B-KD Trees for Hardware Accelerated Ray Tracing of Dynamic Scenes Sven Woop Gerd Marmitt Philipp Slusallek.
© M. Gross, ETH Zürich, 2014 Informatik I für D-MAVT (FS 2014) Exercise 12 – Data Structures – Trees Sorting Algorithms.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
Interactive Rendering With Coherent Ray Tracing Eurogaphics 2001 Wald, Slusallek, Benthin, Wagner Comp 238, UNC-CH, September 10, 2001 Joshua Stough.
Fast BVH Construction on GPUs (Eurographics 2009) Park, Soonchan KAIST (Korea Advanced Institute of Science and Technology)
第五课 Ray Tracing. Overview of the Section Why Ray Tracing? What is Ray Tracing? How to tracing rays? How to accelerating ray-tracing?
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Ray Tracing II. HW1 Part A due October 10 Camera module Object module –Read from a file –Sphere and Light only Ray tracer module: –No shading. No reflection.
Tree Data Structures. Heaps for searching Search in a heap? Search in a heap? Would have to look at root Would have to look at root If search item smaller.
Maths & Technologies for Games Spatial Partitioning 2
Advanced topics Advanced Multimedia Technology: Computer Graphics Yung-Yu Chuang 2006/01/04 with slides by Brian Curless, Zoran Popovic, Mario Costa Sousa.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Ray Tracing Optimizations
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
Ray Tracing Acceleration (5). Ray Tracing Acceleration Techniques Too Slow! Uniform grids Spatial hierarchies K-D Octtree BSP Hierarchical grids Hierarchical.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
Path/Ray Tracing Examples. Path/Ray Tracing Rendering algorithms that trace photon rays Trace from eye – Where does this photon come from? Trace from.
Solid Modeling Dr. Scott Schaefer.
Visibility Determination – List Priority Methods Chapter 11.
Ray Tracing Acceleration (3)
Hierarchical Data Structure in Game Programming Yanci Zhang Game Programming Practice.
Layout by orngjce223, CC-BY Compact BVH StorageFabianowski ∙ Dingliana Compact BVH Storage for Ray Tracing and Photon Mapping Bartosz Fabianowski ∙ John.
Bounding Volume Hierarchies and Spatial Partitioning
Bounding Volume Hierarchies and Spatial Partitioning
Hidden Surfaces Dr. Scott Schaefer.
Modeliranje kompleksnih modelov
Real-Time Ray Tracing Stefan Popov.
Ray Tracing, Part 1 Dinesh Manocha COMP 575/770.
Tree A tree is a data structure in which each node is comprised of some data as well as node pointers to child nodes
Collision Detection.
BVH Student: Jack Chang.
Modeliranje kompleksnih modelov
Presentation transcript:

Ray Tracing Acceleration Structures Solomon Boulos 4/16/2004

How does ray tracing work? Rays shoot from eyes into scene Find first thing ray hits Shade Becomes a search problem

Why acceleration structures? Trying to find first intersection Linear search is too slow O(n) 95 % of time is spent here Interactive ray tracing Large data sets

Talk Overview Types of Structures Discussion of Three Major Structures –Definition –Construction –Usage –Performance Analysis Which to use Current Problems Current work Future Work

Two Basic Types Divide in space Divide in geometry SpatialObject Empty Space

What are our options? Three Main Types –Uniform Grid ( UG ) –Binary Space Partition ( BSP ) –Bounding Volume Hierarchy ( BVH ) Others Not Discussed –Octree ( Glassner, 1984 ) –5D Tree ( Arvo, 1987 ) –List –Variants –Dynamic

What’s a UG? 3D Grid that divides space uniformly Each cell is a Bounding Volume (BV) A BV contains all the surfaces inside it Traversal is iterative through grid

How do we build one? 1.Find the surrounding bounding box. 2.Subdivide box into grid of boxes. 3.Add primitives to grid cells.

How do we use it? 1.Test Overall BV for intersection. 2.Find first grid intersection. 3.Iteratively update position. 4.Stop when we hit a primitive. 5.Return false if we exit the grid.

Simple Example

for(;;) cell = grid[i][j][k]; if (tx_next <= ty_next && tx_next < tz_next) { r.tmin = t_current; r.tmax = tx_next; if (cell != NULL && cell->hit(r, time, rec)) return true; t_current = tx_next; tx_next += dtx; i += i_step; if (i == i_stop) return false; } // similar cases UG Traversal Code

UG Analysis Build is O(n) Traversal is O(n^( 1/3 )) Great for Dense objects Naïve memory layout is bad Data tiling improves things

What’s a BSP? Space Subdivision Binary Tree Ordered traversal KD-TreeBSP Tree

How do we build one? 1.Choose splitting plane. 2.Pick pivot that divides plane. 3.Place primitives onto each side. 4.Stop if termination conditions met.

How do we use it? Test intersections based on 4 cases Case 1 Case 2 Case 3 Case 4 Splitting Plane

Ray Direction Code Ray::Ray(const Vector3& origin,const Vector3& direction) { tmin = ; tmax = DBL_MAX; data[0] = origin; data[1] = direction; posneg[X] = (data[1].x() >= 0 ? 0 : 1); posneg[Y] = (data[1].y() >= 0 ? 0 : 1); posneg[Z] = (data[1].z() >= 0 ? 0 : 1); }

BSP Traversal Code bool BSP::hit(Ray& r, HitRecord& rec) const { float point = r.origin()[axis] + r.direction()[axis]*r.tmin; float t = (pivot - point)/(r.direction()[axis]); if (point < pivot) // cases 1 and 2 { if ( r.posneg[axis] || t > r.tmax) // ray is negative i.e. posneg = 1 return (child[0] != NULL ) && (child[0]->hit(r, time, rec)); if ( child[0] != NULL && child[0]->hit(r, time, rec) ) return true; return (child[1] != NULL && child[1]->hit(r, time, rec)); } else // symmetric for cases 3 and 4... }

BSP Analysis Build time O(nlogn) or higher usually Objects overlap regions. Traversal time O(logn) expected Build is most important Memory layout can help.

What’s a BVH? Divides objects not space. Hierarchy ( Binary Tree is easy ) Each Node is a Bounding Volume (BV)

How do we build one? Find an all-encompassing BV Split this BV in two by any method Put shapes into each child Recurse

How do we test for intersections? 1.Test root for intersection. 2.If ray hits root, check children; otherwise false. 3.Return closest hit. t =

bool BVH::hit(Ray& r, HitRecord& rec) const { // test BV for intersection if (!(bbox.rayIntersect(r, r.tmin, r.tmax))) return false; // else call hit on both branches bool isahit1 = false; bool isahit2 = false; isahit1 = child[r.posneg[axis]]->hit(r, rec); isahit2 = child[r.posneg[axis]^1]->hit(r,rec); // did we hit either child? return (isahit1 || isahit2); } BVH Traversal Code

BVH Analysis Build time varies like BSP. O(nlogn) and higher in practice. Bounding boxes overlap instead. Traversal is similar O(logn) Code is clean and simple

What affects performance? Build Strategy Scene Geometry View dependence Memory Layout

Which is best? Lots of opinions Not much evidence Typical Scenes Type of Applications

The case for the BSP Tree Ordered Traversal Lots of papers about them “algorithms for building BVHs that are well-suited for fast traversal are less well investigated than similar algorithms for BSP trees.” -- Ingo Wald, Ph.D Thesis ( 2004 )

The case for the UG Iterative traversal Handled huge data Steve Parker’s UG Excellent for dense objects

The case for the BVH Simple No copied geometry Comparable speed Ignores empty space

What’s the problem? Test Data ( SPD Scenes ) Reproduction of Results -- Gordon Mueller

Current Work Build strategy investigation Trying all major types Lots of papers to read Implementation tuning Building test scenes Documenting results

Future Work Dynamic structures Storing structures with models Hybrid structures Rigorous analysis

Any questions?