MIT EECS 6.837, Durand and Cutler Acceleration Data Structures for Ray Tracing.

Slides:



Advertisements
Similar presentations
Transformations in Ray Tracing MIT EECS 6.837, Durand and Cutler.
Advertisements

GR2 Advanced Computer Graphics AGR
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Intersection Testing Chapter 13 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
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.
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.
Retrospect Digital Image Synthesis Yu-Ting Wu. So far we have learned: Geometry and transforms Shapes Accelerators Color and radiometry Cameras Sampling.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Ray Tracing Variants Distributed ray tracing Generalized rays Cone Tracing Beam Tracing Pencil.
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
Christian Lauterbach COMP 770, 2/11/2009
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Collision Detection CSE 191A: Seminar on Video Game Programming Lecture 3: Collision Detection UCSD, Spring, 2003 Instructor: Steve Rotenberg.
Computer Graphics (Fall 2005) COMS 4160, Lecture 21: Ray Tracing
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
Bounding Volume Hierarchies and Spatial Partitioning Kenneth E. Hoff III COMP-236 lecture Spring 2000.
Ray Tracing Jerry Sui Adam Conner. Part I – Introduction to Ray Tracing Final Product.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Lecture 8 Advanced Rendering – Ray Tracing, Radiosity & NPR.
Collision Detection David Johnson Cs6360 – Virtual Reality.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Hidden Surface Removal
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
Acceleration Digital Image Synthesis Yung-Yu Chuang 10/4/2005 with slides by Mario Costa Sousa and Pat Hanrahan.
Ray Tracing II A More Practical Version. A QUICK REVIEW.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
CS 431/636 Advanced Rendering Techniques Dr. David Breen University Crossings 149 Tuesday 6PM  8:50PM Presentation 2 4/7/09.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
COMP 175: Computer Graphics March 24, 2015
1 Speeding Up Ray Tracing Images from Virtual Light Field Project ©Slides Anthony Steed 1999 & Mel Slater 2004.
Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand.
Graphics Graphics Korea University cgvr.korea.ac.kr Solid Modeling 고려대학교 컴퓨터 그래픽스 연구실.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
Ray Tracing Jian Huang, CS 594, Fall, 2002 This set of slides are used at Ohio State by Prof. Roger Crawfis.
MIT EECS 6.837, Durand and Cutler Acceleration Data Structures for Ray Tracing.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Recursion and Data Structures in Computer Graphics Ray Tracing 1.
Binary Space Partitioning Trees Ray Casting Depth Buffering
CSE 681 DISTRIBUTED RAY TRACING some implementation notes.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
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.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
Ray Tracing Optimizations
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
RENDERING : Global Illumination
Ray Tracing Acceleration (5). Ray Tracing Acceleration Techniques Too Slow! Uniform grids Spatial hierarchies K-D Octtree BSP Hierarchical grids Hierarchical.
Global Illumination (3) Path Tracing. Overview Light Transport Notation Path Tracing Photon Mapping.
David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke
Distributed Ray Tracing. Can you get this with ray tracing?
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi.
Distributed Ray Tracing. Can you get this with ray tracing?
Ray Tracing Acceleration (1). Acceleration of Ray Tracing Goal: Reduce the number of ray/primitive intersections.
Ray Tracing Acceleration (3)
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Modeliranje kompleksnih modelov
© University of Wisconsin, CS559 Fall 2004
Anti-aliased and accelerated ray tracing
Distributed Ray Tracing
Ray Tracer Spring 2004 Help Session.
Modeliranje kompleksnih modelov
Presentation transcript:

MIT EECS 6.837, Durand and Cutler Acceleration Data Structures for Ray Tracing

MIT EECS 6.837, Durand and Cutler Today Review & Schedule Motivation – Distribution Ray Tracing Bounding Boxes Spatial Acceleration Data Structures Flattening the transformation hierarchy

MIT EECS 6.837, Durand and Cutler Cool results from Assignment 2 koi seantek

MIT EECS 6.837, Durand and Cutler Last Week: Ray Tracing –Shadows –Reflection –Refraction Local Illumination –Bidirectional Reflectance Distribution Function (BRDF) –Phong Model ii rr ii rr

MIT EECS 6.837, Durand and Cutler Schedule Wednesday October 1 st : Assignment 3 (Ray Tracing & Phong Materials) due Sunday October 5 th, 5-7 PM, Room TBA: Review Session for Quiz 1 Tuesday October 7 th : Quiz 1: In class Wednesday October 15th: Assignment 4 (Grid Acceleration) due

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Today Review & Schedule Motivation – Distribution Ray Tracing Bounding Boxes Spatial Acceleration Data Structures Flattening the transformation hierarchy

MIT EECS 6.837, Durand and Cutler Extra rays needed for these effects: Distribution Ray Tracing –Soft shadows –Anti-aliasing (getting rid of jaggies) –Glossy reflection –Motion blur –Depth of field (focus)

MIT EECS 6.837, Durand and Cutler Shadows one shadow ray per intersection per point light source no shadow rays one shadow ray

MIT EECS 6.837, Durand and Cutler Soft Shadows multiple shadow rays to sample area light source one shadow ray lots of shadow rays

MIT EECS 6.837, Durand and Cutler Antialiasing – Supersampling multiple rays per pixel point light area light jaggiesw/ antialiasing

MIT EECS 6.837, Durand and Cutler one reflection ray per intersection perfect mirror Reflection θ θ

MIT EECS 6.837, Durand and Cutler Glossy Reflection multiple reflection rays polished surface θ θ Justin Legakis

MIT EECS 6.837, Durand and Cutler Motion Blur Sample objects temporally Rob Cook

MIT EECS 6.837, Durand and Cutler Depth of Field multiple rays per pixel Justin Legakis focal length film

MIT EECS 6.837, Durand and Cutler Algorithm Analysis Ray casting Lots of primitives Recursive Distributed Ray Tracing Effects –Soft shadows –Anti-aliasing –Glossy reflection –Motion blur –Depth of field cost ≤ height * width * num primitives * intersection cost * num shadow rays * supersampling * num glossy rays * num temporal samples * max recursion depth *... can we reduce this?

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Today Review & Schedule Motivation – Distribution Ray Tracing Bounding Boxes –of each primitive –of groups –of transformed primitives Spatial Acceleration Data Structures Flattening the transformation hierarchy

MIT EECS 6.837, Durand and Cutler Acceleration of Ray Casting Goal: Reduce the number of ray/primitive intersections

MIT EECS 6.837, Durand and Cutler Conservative Bounding Region First check for an intersection with a conservative bounding region Early reject

MIT EECS 6.837, Durand and Cutler Conservative Bounding Regions axis-aligned bounding box non-aligned bounding box bounding sphere arbitrary convex region (bounding half-spaces) tight → avoid false positives fast to intersect

MIT EECS 6.837, Durand and Cutler Intersection with Axis-Aligned Box From Lecture 3, Ray Casting II For all 3 axes, calculate the intersection distances t 1 and t 2 t near = max (t 1x, t 1y, t 1z ) t far = min (t 2x, t 2y, t 2z ) If t near > t far, box is missed If t far < t min, box is behind If box survived tests, report intersection at t near y=Y2 y=Y1 x=X1 x=X2 t near t far t 1x t 1y t 2x t 2y

MIT EECS 6.837, Durand and Cutler Bounding Box of a Triangle (x min, y min, z min ) (x max, y max, z max ) (x 0, y 0, z 0 ) (x 1, y 1, z 1 ) (x 2, y 2, z 2 ) = (min(x 0,x 1,x 2 ), min(y 0,y 1,y 2 ), min(z 0,z 1,z 2 )) = (max(x 0,x 1,x 2 ), max(y 0,y 1,y 2 ), max(z 0,z 1,z 2 ))

MIT EECS 6.837, Durand and Cutler Bounding Box of a Sphere r (x min, y min, z min ) (x max, y max, z max ) (x, y, z) = (x-r, y-r, z-r) = (x+r, y+r, z+r)

MIT EECS 6.837, Durand and Cutler Bounding Box of a Plane (x min, y min, z min ) (x max, y max, z max ) = (-∞, -∞, -∞)* = (+∞, +∞, +∞)* n = (a, b, c) ax + by + cz = d * unless n is exactly perpendicular to an axis

MIT EECS 6.837, Durand and Cutler Bounding Box of a Group (x min_b, y min_b, z min_b ) (x min, y min, z min ) (x max, y max, z max ) = (min(x min_a,x min_b ), min(y min_a,y min_b ), min(z min_a,z min_b )) = (max(x max_a,x max_b ), max(y max_a,y max_b ), max(z max_a,z max_b )) (x min_a, y min_a, z min_a ) (x max_b, y max_b, z max_b ) (x max_a, y max_a, z max_a )

MIT EECS 6.837, Durand and Cutler Bounding Box of a Transform (x' min, y' min, z' min ) (x' max, y' max, z' max ) = (min(x 0,x 1,x 2,x 3,x 4,x 5,x 6,x 7 ), min(y 0,y 1,y 2,y 3,y 4,x 5,x 6,x 7 ), min(z 0,z 1,z 2,z 3,z 4,x 5,x 6,x 7 )) M (x min, y min, z min ) (x 0,y 0,z 0 ) = M (x min,y min,z min ) = (max(x 0,x 1,x 2,x 3,x 4,x 5,x 6,x 7 ), max(y 0,y 1,y 2,y 3,y 4,x 5,x 6,x 7 ), max(z 0,z 1,z 2,z 3,z 4,x 5,x 6,x 7 )) (x 1,y 1,z 1 ) = M (x max,y min,z min ) (x 2,y 2,z 2 ) = M (x min,y max,z min ) (x 3,y 3,z 3 ) = M (x max,y max,z min ) (x max, y max, z max )

MIT EECS 6.837, Durand and Cutler Special Case: Transformed Triangle M Can we do better?

MIT EECS 6.837, Durand and Cutler Special Case: Transformed Triangle (x max, y max, z max ) = (max(x' 0,x' 1,x' 2 ), max(y' 0,y' 1,y' 2 ), max(z' 0,z' 1,z' 2 )) M (x min, y min, z min ) = (min(x' 0,x' 1,x' 2 ), min(y' 0,y' 1,y' 2 ), min(z' 0,z' 1,z' 2 )) (x' 0,y' 0,z' 0 ) = M (x 0,y 0,z 0 ) (x' 1,y' 1,z' 1 ) = M (x 1,y 1,z 1 ) (x' 2,y' 2,z' 2 ) = M (x 2,y 2,z 2 ) (x 2, y 2, z 2 ) (x 1, y 1, z 1 ) (x 0, y 0, z 0 )

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Today Review & Schedule Motivation – Distribution Ray Tracing Bounding Boxes Spatial Acceleration Data Structures –Regular Grid –Adaptive Grids –Hierarchical Bounding Volumes Flattening the transformation hierarchy

MIT EECS 6.837, Durand and Cutler Regular Grid

MIT EECS 6.837, Durand and Cutler Cell (i, j) Create grid Find bounding box of scene Choose grid spacing grid x need not = grid y grid y grid x

MIT EECS 6.837, Durand and Cutler Insert primitives into grid Primitives that overlap multiple cells? Insert into multiple cells (use pointers)

MIT EECS 6.837, Durand and Cutler For each cell along a ray Does the cell contain an intersection? Yes: return closest intersection No: continue

MIT EECS 6.837, Durand and Cutler Preventing repeated computation Perform the computation once, "mark" the object Don't re-intersect marked objects

MIT EECS 6.837, Durand and Cutler Don't return distant intersections If intersection t is not within the cell range, continue (there may be something closer)

MIT EECS 6.837, Durand and Cutler Where do we start? Intersect ray with scene bounding box Ray origin may be inside the scene bounding box t min t next_v t next_h t min t next_v t next_h Cell (i, j)

MIT EECS 6.837, Durand and Cutler Is there a pattern to cell crossings? Yes, the horizontal and vertical crossings have regular spacing dt v = grid y / dir y dt h = grid x / dir x grid y grid x (dir x, dir y )

MIT EECS 6.837, Durand and Cutler What's the next cell? dt v dt h Cell (i, j) if t next_v < t next_h i += sign x t min = t next_v t next_v += dt v else j += sign y t min = t next_h t next_h += dt h t min t next_v t next_h Cell (i+1, j) (dir x, dir y ) if (dir x > 0) sign x = 1 else sign x = -1 if (dir y > 0) sign y = 1 else sign y = -1

MIT EECS 6.837, Durand and Cutler What's the next cell? 3DDDA – Three Dimensional Digital Difference Analyzer We'll see this again later, for line rasterization

MIT EECS 6.837, Durand and Cutler Pseudo-code create grid insert primitives into grid for each ray r find initial cell c(i,j), t min, t next_v & t next_h compute dt v, dt h, sign x and sign y while c != NULL for each primitive p in c intersect r with p if intersection in range found return c = find next cell

MIT EECS 6.837, Durand and Cutler Regular Grid Discussion Advantages? –easy to construct –easy to traverse Disadvantages? –may be only sparsely filled –geometry may still be clumped

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Today Review & Schedule Motivation – Distribution Ray Tracing Bounding Boxes Spatial Acceleration Data Structures –Regular Grid –Adaptive Grids –Hierarchical Bounding Volumes Flattening the transformation hierarchy

MIT EECS 6.837, Durand and Cutler Adaptive Grids Nested GridsOctree/(Quadtree) Subdivide until each cell contains no more than n elements, or maximum depth d is reached

MIT EECS 6.837, Durand and Cutler Primitives in an Adaptive Grid Can live at intermediate levels, or be pushed to lowest level of grid Octree/(Quadtree)

MIT EECS 6.837, Durand and Cutler Adaptive Grid Discussion Advantages? –grid complexity matches geometric density Disadvantages? –more expensive to traverse (especially octree)

MIT EECS 6.837, Durand and Cutler Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse

MIT EECS 6.837, Durand and Cutler Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse

MIT EECS 6.837, Durand and Cutler Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse

MIT EECS 6.837, Durand and Cutler Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse

MIT EECS 6.837, Durand and Cutler Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse

MIT EECS 6.837, Durand and Cutler Where to split objects? At midpoint OR Sort, and put half of the objects on each side OR Use modeling hierarchy

MIT EECS 6.837, Durand and Cutler Intersection with BVH Check subvolume with closer intersection first

MIT EECS 6.837, Durand and Cutler Intersection with BVH Don't return intersection immediately if the other subvolume may have a closer intersection

MIT EECS 6.837, Durand and Cutler Bounding Volume Hierarchy Discussion Advantages –easy to construct –easy to traverse –binary Disadvantages –may be difficult to choose a good split for a node –poor split may result in minimal spatial pruning

MIT EECS 6.837, Durand and Cutler Today Review & Schedule Motivation – Distribution Ray Tracing Bounding Boxes Spatial Acceleration Data Structures Flattening the transformation hierarchy

MIT EECS 6.837, Durand and Cutler Transformation Hierarchy group transform A C D E Group & Transformation hierarchy may not be a good spatial hierarchy transform B group transform A B transform C D transform C E Flatten

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Assignment 4 (due Oct 15 th ) Bounding boxes for primitives Regular grid acceleration data structure Flatten the transformation hierarchy Collect statistics –Average # of rays per pixel –Average # of ray/primitive intersections per pixel Extra Credit: Distribution Ray Tracing (and anything else from past weeks)

MIT EECS 6.837, Durand and Cutler Next Time: Curves & Surfaces