Reading Ray Intersection Chapter 2: Geometry and Transformations Acceleration Covers basic math and PBRT implementation: read on your own

Similar documents
Ray Intersection Acceleration

Ray Intersection Acceleration

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Accelerated Raytracing

Computer Graphics. - Spatial Index Structures - Philipp Slusallek

Topics. Ray Tracing II. Transforming objects. Intersecting transformed objects

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Topics. Ray Tracing II. Intersecting transformed objects. Transforming objects

Accelerating Ray-Tracing

Accelerating Geometric Queries. Computer Graphics CMU /15-662, Fall 2016

Acceleration Data Structures

Accelerating Ray Tracing

Ray Tracing Acceleration. CS 4620 Lecture 20

improving raytracing speed

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

Ray Tracing Acceleration. CS 4620 Lecture 22

Intersection Acceleration

Spatial Data Structures

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

Ray Genealogy. Raytracing: Performance. Bounding Volumes. Bounding Volume. Acceleration Classification. Acceleration Classification

Spatial Data Structures

Speeding Up Ray Tracing. Optimisations. Ray Tracing Acceleration

Ray Tracing I: Basics

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

Acceleration. Digital Image Synthesis Yung-Yu Chuang 10/11/2007. with slides by Mario Costa Sousa, Gordon Stoll and Pat Hanrahan

Acceleration Structures. CS 6965 Fall 2011

Parallel Physically Based Path-tracing and Shading Part 3 of 2. CIS565 Fall 2012 University of Pennsylvania by Yining Karl Li

Computer Graphics. - Ray-Tracing II - Hendrik Lensch. Computer Graphics WS07/08 Ray Tracing II

Spatial Data Structures

Lecture 2 - Acceleration Structures

Spatial Data Structures

Ray Tracing. Computer Graphics CMU /15-662, Fall 2016

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Ray Tracing Acceleration Data Structures

Ray Casting. Outline in Code. Outline. Finding Ray Direction. Heckbert s Business Card Ray Tracer. Foundations of Computer Graphics (Fall 2012)

CPSC GLOBAL ILLUMINATION

INFOGR Computer Graphics. J. Bikker - April-July Lecture 11: Acceleration. Welcome!

Computer Graphics Ray Casting. Matthias Teschner

Questions from Last Week? Extra rays needed for these effects. Shadows Motivation

CS 431/636 Advanced Rendering Techniques

Bounding Volume Hierarchies. CS 6965 Fall 2011

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Spatial Data Structures

Logistics. CS 586/480 Computer Graphics II. Questions from Last Week? Slide Credits

Sung-Eui Yoon ( 윤성의 )

Ray Tracing. Foley & Van Dam, Chapters 15 and 16

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Ray Casting. 3D Rendering. Ray Casting. Ray Casting. Ray Casting. Ray Casting

Computer Graphics. Bing-Yu Chen National Taiwan University

EDAN30 Photorealistic Computer Graphics. Seminar 2, Bounding Volume Hierarchy. Magnus Andersson, PhD student

Advanced Ray Tracing

Recall: Inside Triangle Test

6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, :05-12pm Two hand-written sheet of notes (4 pages) allowed 1 SSD [ /17]

Ray Casting. To Do. Outline. Outline in Code. Foundations of Computer Graphics (Spring 2012) Heckbert s Business Card Ray Tracer

Spatial Data Structures for Computer Graphics

CS770/870 Spring 2017 Ray Tracing Implementation

Solid Modeling. Ron Goldman Department of Computer Science Rice University

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

Ray-tracing Acceleration. Acceleration Data Structures for Ray Tracing. Shadows. Shadows & Light Sources. Antialiasing Supersampling.

Physically Based Rendering ( ) Intersection Acceleration

Ray Tracer System Design & lrt Overview. cs348b Matt Pharr

CPSC / Sonny Chan - University of Calgary. Collision Detection II

The Traditional Graphics Pipeline

782 Schedule & Notes

Programming projects. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer

VIII. Visibility algorithms (II)

Today. Acceleration Data Structures for Ray Tracing. Cool results from Assignment 2. Last Week: Questions? Schedule

Lecture 11. More Ray Casting/Tracing

Lecture 11: Ray tracing (cont.)

The Traditional Graphics Pipeline

Ray tracing. EECS 487 March 19,

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Ray Casting. COS 426, Spring 2015 Princeton University

Direct Rendering of Trimmed NURBS Surfaces

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

Spatial Data Structures. Steve Rotenberg CSE168: Rendering Algorithms UCSD, Spring 2017

The Traditional Graphics Pipeline

1999, Denis Zorin. Ray tracing

Effects needed for Realism. Computer Graphics (Fall 2008) Ray Tracing. Ray Tracing: History. Outline

Effects needed for Realism. Ray Tracing. Ray Tracing: History. Outline. Foundations of Computer Graphics (Spring 2012)

Ray Tracing II. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

CS 465 Program 4: Modeller

Introduction to Spatial Database Systems

CS 563 Advanced Topics in Computer Graphics. by Emmanuel Agu

Ray Tracing with Spatial Hierarchies. Jeff Mahovsky & Brian Wyvill CSC 305

Advanced 3D-Data Structures

CS348B Lecture 2 Pat Hanrahan, Spring Greeks: Do light rays proceed from the eye to the light, or from the light to the eye?

RAY-TRACING WITH UNIFORM SPATIAL DIVISION:PRACTICE

11 - Spatial Data Structures

CMSC427 Final Practice v2 Fall 2017

CS 563 Advanced Topics in Computer Graphics QSplat. by Matt Maziarz

CS 465 Program 5: Ray II

Specialized Acceleration Structures for Ray-Tracing. Warren Hunt

Today. Anti-aliasing Surface Parametrization Soft Shadows Global Illumination. Exercise 2. Path Tracing Radiosity

Point Cloud Filtering using Ray Casting by Eric Jensen 2012 The Basic Methodology

Computer Graphics. - Rasterization - Philipp Slusallek

Lecture 17: Solid Modeling.... a cubit on the one side, and a cubit on the other side Exodus 26:13

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

Transcription:

eading ay Intersection Acceleration eadings Chapter 2 Geometry & Transformations Chapter 3 Shapes Chapter 4 rimitives & Intersection Acceleration Covers basic math and BT implementation: read on your own Chapter 2: Geometry and Transformations 2.1-2.5 eview basic geometry 2.6 3D Bounding boxes in BT 2.7-2.8 Transformation & applying them in BT We ll cover this in class 2.5.1 & 2.9 Differential geometry eading Chapter 3: Shapes 3.1 Basic BT shape interface ay Tracing Shoot a ray through each pixel; Find first object intersected by ray 3.2-3.5 Specific shapes - quadrics Image plane 3.6 Triangles and meshes Eye 3.7 Subdivision surfaces Compute ray. (More linear algebra.) Compute ray-object intersection. Spawn more rays for reflection and refraction ay Tracing Architecture Optimizing ay Tracing Scene LT arse Sample Generator Film TIFF Image Image Main computation load is ray-object intersection rimitives Shape Lights ays Camera Eye rays intersect adiance Shadow, reflection, refraction rays 50-90% of run time when profiled Test for possible intersection before committing to computing intersections Material Integrator

Consider this Complexity! I rays or pixels in image N objects O(NI) Can we do O(I logn)? Efficient intersectors for parametric surfaces, fractals, etc. ay Intersection Acceleration ay Tracing Acceleration Techniques Faster Intersections Fewer ays Generalized ays Faster ray-object intersections Examples: Object bounding volumes Fewer ray-object intersections Examples: Bounding volume hierarchies Space subdivision Directional techniques Examples: Adaptive tree-depth control Statistical optimizations for anti-aliasing Examples: Beam tracing Cone tracing encil tracing brt and Intersections rimitive base class Shapes are subclasses of primitive Aggregate class Methods WorldBound CanIntersect Intersect Intersect efine First four return Intersection structures Last returns rimitives rimitives Shapes Lights Materials brt and Intersections Intersection Geometry WorldBound Intersect Intersect efine eturns a bounding box in world space eturn!true" if an intersection and an intersection structure eturn!true" if an intersection occurs but does not return an intersection structure If non-intersectable, refines shape into (some) intersectable new shapes Shape independent representation for intersections DifferentialGeometry Intersection::dg oint Normal N arametric (u,v) artial derivatives Tangents: dpdu, dpdv change in normal: dndu, dndv

Speeding up Intersection Calculation Object-based vs. World-based Common dichotomy in graphics objects situated in (world) space (world) space in which objects reside Bounding volumes are object-based Spatial Subdivision is world-based approach Sub-linear search logarithmic? Bounding Volumes Surround object with a simple volume Test ray against volume first Test object-space or world-space bound? (pros and cons) Cost model - N*cb + pi*n*co N (number of rays) is given pi fraction of rays intersecting bounding volume Minimize cb (cost of intersecting bounding volume) and co (cost of intersecting object) educe ray path Minimize cost/fit ratio educe ray path Arvo&Kirk-Glassner pp.209 Bounding Volumes Bounding Volumes Bounding sphere Difficult to compute good one Easy to test for intersection Bounding box Easy to compute for given object elatively difficult to intersect (maybe?) educe ray path Arvo&Kirk-Glassner pp.209 brt s Bounding Boxes Virtual BBox ObjectBound() const=0; Virtual BBox WorldBound() const { # return ObjectToWorld(ObjectBound()); } Bool BBox::Intersect(Const ay &ray, Float *hit0, Float *hitt1) const { } Compute min/max for x,y,z 3 options Compute in world space Bounding Box Chance of ill fitting b-box Compute in object space and transform w/object Object space b-box probably better fit than world space Need to intersect ray with arbitrary hexahedral in world sp. Compute in object space and test in object space Inverse transform ray into object space

ay & Cube Square/Cube (t) = s + tc t x1 = (x1 - s x )/c x t x2 = (x2 - s x )/c x X = x1 Y = y2 Z = z2 Z = z1 X = x2 Note entering and leaving intersections separately t y1 = (y1 - s x )/c x Y = y1 ay is inside after last entering and before first leaving Algorithm set Tnear = - infinity, Tfar = infinity ay (t) = O + t * ay For each pair of planes associated with X, Y, and Z do: # # # # (example using X planes) if direction ay x = 0 then the ray is parallel to the X planes # #if origin Ox is not between the slabs ( Ox < Xl or Ox > Xh) then # #return false else # #if the ray is not parallel to the plane then #begin # compute the intersection distance of the planes # T1 = (Xl - Ox) / Xd # T2 = (Xh - Ox) / Xd # If T1 > T2 swap (T1, T2) - since T1 intersection with near plane # # If T1 > Tnear # Tnear =T1 #- want largest Tnear # If T2 < Tfar # Tfar="T2" # - want smallest Tfar # If Tnear > Tfar # # # - box is missed so return false # If Tfar < 0 # # # - box is behind ray return false # #end If Box survived all above tests, return true with intersection point Tnear and exit point Tfar. Bounding Sphere Find min/max points in x,y,z -> 3 pairs Use maximally separated pair to define initial sphere For each point If point is outside of current sphere, increase old sphere to just include new point Bounding Slabs C rad C rad newrad = (+rad)/2 newc More complex to compute Better fit of object Use multiple pairs of parallel planes to bound object Can add more slabs to get tighter fit newrad newrad newc C 2004 harr, Humphreys newc = +(newrad/)(c-)

Bounding Slabs Use algorithm for axis aligned bounding box intersect ray with arbitrary plane N = D N t1 t2 D1 D2 (t) N = D i ( + t) N = D i t = D i N N Approximate Convex Hull Find highest vertex Find plane through vertex parallel to ground plane Find second vertex that makes minimum angle with first vertex and up vector Find third vertex that makes plane whose normal makes minimum angle with up vector For any unmatched edge, find unused vertex such that the plane of the vertex and edge makes a minimum angle with the plane of edge"s face Slabs - More effort to compute, better fit Hierarchical Bounding Volumes Hierarchical Bounding Volumes Compute bounding volume for groups of objects Compute bounding volume for groups of groups of objects 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) ) else eturn the closest of all hits! intersect(nodeprims,ray,hits) for each child intersect(child,ray,hits) roblem Subtrees overlap Does not contain all objects it overlaps Balance Spatial Enumeration Divide space into!voxels" Bucket sort objects in voxels they intersect Object goes into each voxel it touches euse results from one voxel calculation Determine voxels that a ray intersects Only deal with the objects in those voxels Tree Organization

Spatial Enumeration Uniform Grids Identifying voxels hit is like a line drawing algorithm reprocess scene Find Big bounding box Uniform Grids Uniform Grids reprocess scene Find Big bounding box Determine grid resolution (how?) reprocess scene Find bounding box Determine grid resolution lace object in cell if its bounding box overlaps the cell Uniform Grids Add Sorting reprocess scene Find Big bounding box Determine grid resolution lace object in cell if its bounding box overlaps the cell Check that object overlaps cell (expensive!) If objects/voxels/cells are processed in front-toback sorted order, stop processing when first intersection is detected e.g., process cells in bottom to top, left to right order and stop at first intersection

Uniform Grids reprocess scene Traverse grid 3D line = 3D-DDA 6-connected line pbrt algorithm (grid accelarator) Amanatides & Woo Algorithm J. Amanatides and A. Woo, "A Fast Voxel Traversal Algorithm for ay Tracing", roc. Eurographics '87, Amsterdam, The Netherlands, August 1987, pp 1-10. Step[X,Y] +/- 1 tmax[x,y] first intersection tdelta[x,y] - voxel distance in [X,Y] A&W Algorithm A&W Algorithm esults endering time for different levels of subdivision Objects Across Multiple Voxels Hierarchical Spatial Subdivision Mailboxes eliminate redundant intersection tests Objects have mailboxes Assign rays numbers check against objects last tested ray number Intersection must be within current voxel ecursive subdivision of space 1-1 elationship between scene points and leaf nodes Example: point location by recursive search(log time) Solves the lack-of-adaptivity problem DDA works Effective in practice

Variations Example A D B B C C D KD tree octtree BS tree A Leaves are unique regions in space ecursive search KdTreeAccel - pbrt Creating Spatial Hierarchies Comparison Insert(node,prim) {! If (overlap(node->bound,prim)) {!! If (leaf(node)) {!!! If (node->nprims > MAXIMS && node->depth < MAXDETH) {!!!! subdivide(node);!!!! foreach child in node!!!!!!! insert(child,prim)!!! }!!! else list_insert(node->prims,prim);!! }!! foreach child in node!!! insert(child,prim)! } } // Typically MAXDETH=16, MAX IMS = 2-8 Scheme Spheres ings Tree Uniform grid D=1 244 129 1517 D=20 38 83 781 Hierarchical grid 34 116 34 # See A roposal for Standard Graphics Environments, IEEE Computer Graphics and Applications, vol. 7, no. 11, November 1987, pp. 3-5 Questions? Teapot in a stadium versus uniform distribution Multiplicative constants important Adaptivity allows robustness Cache effects are important