David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Collisions and Intersections When objects move, test for collision. When projecting surfaces, check for intersections. (Many slides adapted from Amitabh.
CSE 681 Bounding Volumes. CSE 681 Bounding Volumes Use simple volume enclose object(s) tradeoff for rays where there is extra intersection test for object.
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.
Collision Detection and Resolution Zhi Yuan Course: Introduction to Game Development 11/28/
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.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
CS 445 Greg Humphreys, Spring 2003 Ray Tracing 2: Acceleration.
Visibility Culling. Back face culling View-frustrum culling Detail culling Occlusion culling.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Ray Tracing Variants Distributed ray tracing Generalized rays Cone Tracing Beam Tracing Pencil.
David Luebke1/19/99 CS 551/651: Advanced Computer Graphics David Luebke
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
Ray Tracing Acceleration Structures Solomon Boulos 4/16/2004.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
Computer Graphics (Fall 2005) COMS 4160, Lecture 21: Ray Tracing
Introduction General Data Structures - Arrays, Linked Lists - Stacks & Queues - Hash Tables & Binary Search Trees - Graphs Spatial Data Structures -Why.
Bounding Volume Hierarchies and Spatial Partitioning Kenneth E. Hoff III COMP-236 lecture Spring 2000.
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.
Lecture 8 Advanced Rendering – Ray Tracing, Radiosity & NPR.
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.
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
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.
David Luebke10/9/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
On a Few Ray Tracing like Algorithms and Structures. -Ravi Prakash Kammaje -Swansea University.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
Week 13 - Monday.  What did we talk about last time?  Exam 2!  Before that…  Polygonal techniques ▪ Tessellation and triangulation  Triangle strips,
Collision/Acceleration University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
12/4/2001CS 638, Fall 2001 Today Managing large numbers of objects Some special cases.
Collaborative Visual Computing Lab Department of Computer Science University of Cape Town Graphics Topics in VR By Shaun Nirenstein.
CS-378: Game Technology Lecture #2.2: Clipping and Hidden Surfaces Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney,
Real-time Graphics for VR Chapter 23. What is it about? In this part of the course we will look at how to render images given the constrains of VR: –we.
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 6, 2002 Day 10.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
Fast BVH Construction on GPUs (Eurographics 2009) Park, Soonchan KAIST (Korea Advanced Institute of Science and Technology)
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
第五课 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.
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.
David Luebke2/23/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Ray Tracing Optimizations
Ray Tracing Acceleration (5). Ray Tracing Acceleration Techniques Too Slow! Uniform grids Spatial hierarchies K-D Octtree BSP Hierarchical grids Hierarchical.
David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke
Path/Ray Tracing Examples. Path/Ray Tracing Rendering algorithms that trace photon rays Trace from eye – Where does this photon come from? Trace from.
Ray Tracing Acceleration (1). Acceleration of Ray Tracing Goal: Reduce the number of ray/primitive intersections.
Ray Tracing Acceleration (3)
Hierarchical Data Structure in Game Programming Yanci Zhang Game Programming Practice.
Bounding Volume Hierarchies and Spatial Partitioning
Bounding Volume Hierarchies and Spatial Partitioning
Deformable Collision Detection
Real-Time Ray Tracing Stefan Popov.
Parts of these slides are based on
Anti-aliased and accelerated ray tracing
CMSC 635 Ray Tracing.
CS 551 / 645: Introductory Computer Graphics
Deformable Collision Detection
Anti-aliased and accelerated ray tracing
Ray Tracing Sung-Eui Yoon (윤성의) CS580: Course URL:
David Johnson Cs6360 – Virtual Reality
Presentation transcript:

David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke

David Luebke 3/5/2016 Administrivia l Read Chapter 9 l Verify collection of Exercise 1

David Luebke 3/5/2016 Recap l Ray tracing is too slow l Chapter 9: –Different methods to speed it up –Ways of using ray tracing selectively

David Luebke 3/5/2016 Recap l Speedup Techniques –Intersect rays faster –Shoot fewer rays –Shoot “smarter” rays

David Luebke 3/5/2016 Recap l Intersect Rays Faster –Bounding volumes –Spatial partitions –Reordering ray intersection tests –Optimizing intersection tests

David Luebke 3/5/2016 Recap l Bounding volumes –Idea: before intersecting a ray with a collection of objects, test it against one simple object that bounds the collection

David Luebke 3/5/2016 Recap l Hierarchical bounding volumes –Group nearby volumes hierarchically –Test rays against hierarchy top-down

David Luebke 3/5/2016 Bounding Volumes l Some different bounding volumes: –Spheres –Axis-aligned bounding boxes (AABBs) –Oriented bounding boxes (OBBs) –Slabs l Show examples

David Luebke 3/5/2016 Bounding Volumes l What makes a “good” bounding volume? –Tightness of fit (expressed how?) –Simplicity of intersection Total cost = b*B + i*I b : # times volume tested for intersection b : # times volume tested for intersection B : cost of ray-volume intersection test B : cost of ray-volume intersection test i : # times item is tested for intersection i : # times item is tested for intersection I : cost of ray-item intersection test I : cost of ray-item intersection test

David Luebke 3/5/2016 Bounding Volumes l Spheres –Cheap intersection test –Poor fit –A pain to fit to data

David Luebke 3/5/2016 Bounding Volumes l Axis-aligned bounding boxes (AABBs) –Relatively cheap intersection test –Usually better fit –Trivial to fit to data

David Luebke 3/5/2016 Bounding Volumes l Oriented bounding boxes (OBBs) –Medium-expensive intersection test –Very good fit (asymptotically better) –Medium-difficult to fit to data

David Luebke 3/5/2016 Intermission: Parallel Close Proximity We will analyze how OBBs, AABBs, and spheres should perform in parallel close proximity situations. Define parallel close proximity Convergence rates of BV types Asymptotic performance Experimental evidence (graph) (The following 11 slides are courtesy Stefan Gottschalk, UNC)

David Luebke 3/5/2016 Parallel Close Proximity Q: How does the number of BV tests increase as the gap size decreases? Two models are in parallel close proximity when every point on each model is a given fixed distance (  ) from the other model.

David Luebke 3/5/2016 Parallel Close Proximity: Convergence 1

David Luebke 3/5/ / / Parallel Close Proximity: Convergence

David Luebke 3/5/ Parallel Close Proximity: Convergence

David Luebke 3/5/ / / Parallel Close Proximity: Convergence

David Luebke 3/5/ Parallel Close Proximity: Convergence

David Luebke 3/5/ / 1 16 / Parallel Close Proximity: Convergence

David Luebke 3/5/ / 1 4 / 1 4 / Parallel Close Proximity: Convergence

David Luebke 3/5/2016 OBBs k O(n) Spheres & AABBs 2k O(n ) 2 Parallel Close Proximity: Asymptotic Performance

David Luebke 3/5/2016 OBBs asymptotically outperform AABBs and spheres Log-log plot Gap Size (  ) Number of BV tests Parallel Close Proximity: Experiment

David Luebke 3/5/2016 Bounding Volumes l Slabs (parallel planes) –Comparatively expensive –Very good fit –A pain to fit to data

David Luebke 3/5/2016 Bounding Volume Hierarchies l What makes a “good” bounding volume hierarchy? –Grouped objects (or volumes) should be near each other –Volume should be minimal –Sum of all volumes should be minimal –Top of the tree is most critical –Constructing the hierarchy should pay for itself!

David Luebke 3/5/2016 Spatial Partitioning l Hierarchical bounding volumes surround objects in the scene with (possibly overlapping) volumes –Often tightest fit l Spatial partitioning techniques classify all space into non-overlapping portions –Easier to generate automatically –Can “walk” ray from partition to partition

David Luebke 3/5/2016 Spatial Partitioning l Some spatial partitioning schemes: –Uniform grid (2-D or 3-D) –Octree –k-D tree –BSP-tree l Show examples

David Luebke 3/5/2016 Uniform Grid l Uniform grid pros: –Very simple and fast to generate –Very simple and fast to trace rays across (How?) l Uniform grid cons: –Not adaptive n Wastes storage on empty space n Assumes uniform spread of data

David Luebke 3/5/2016 Octree l Octree pros: –Simple to generate –Adaptive l Octree cons: –Less easy to trace rays across (How?) –Adaptive only in scale

David Luebke 3/5/2016 k-D Trees l k-D tree pros: –Moderately simple to generate –More adaptive than octrees l k-D tree cons: –Less efficient to trace rays across –Moderately complex data structure

David Luebke 3/5/2016 BSP Trees l BSP tree pros: –Extremely adaptive –Simple & elegant data structure l BSP tree cons: –Very hard to create optimum BSP –Splitting planes can explode storage –Simple but slow to trace rays across

David Luebke 3/5/2016 Ray Space Subdivision l Weird acceleration scheme award… l Octree, BSP Tree, grids: 3-D subdivision schemes l Arvo & Kirk: 5-D subdivision scheme –Position: x, y, z –Direction: u, v l Draw it…

David Luebke 3/5/2016 Reordering Ray Intersection Tests l Caching ray hits l Memory-coherent ray tracing

David Luebke 3/5/2016 Caching Ray Hits l Record what object the “last ray” hit l Start by checking that object l Especially for shadow rays…(why?) l RSRT uses a multi-level shadow cache (what’s that?)

David Luebke 3/5/2016 Memory-Coherent Ray Tracing l Goal: ray trace very large scenes l Problem: ray tracing typically exhibits poor memory coherence (Why?) l Solution: re-order ray computations –Ray trace where geometry in cache –Postpone rays going out-of-core

David Luebke 3/5/2016 Optimizing Ray Intersection Tests l Fine-tune the math! –Share subexpressions –Precompute everything possible l Code with care –Even use assembly, if necessary –Will get its own lecture

David Luebke 3/5/2016 Speedup Techniques l Speedup Techniques –Intersect rays faster –Shoot fewer rays –Shoot “smarter” rays

David Luebke 3/5/2016 Shoot Fewer Rays l Adaptive depth control –Naïve ray tracer: spawn 2 rays per intersection until max recursion limit –In practice, few surfaces are transparent or reflective n Contribution of most rays to image: 0% n Don’t shoot rays w/ contribution near 0%

David Luebke 3/5/2016 Shoot Fewer Rays l Adaptive sampling –Shoot rays coarsely, interpolating their values across pixels –Where adjacent rays differ greatly in value, sample more finely –Stop when some maximum resolution is reached l Show example