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

Similar documents
Advanced Ray Tracing

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

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

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

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

CS 431/636 Advanced Rendering Techniques

Lecture 11: Ray tracing (cont.)

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

Homework 1: Implicit Surfaces, Collision Detection, & Volumetric Data Structures. Loop Subdivision. Loop Subdivision. Questions/Comments?

Acceleration Data Structures

Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

Ray Tracing. Last Time? Reading for Today. Reading for Today

Spatial Data Structures

Intersection Acceleration

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

Ray Tracing Acceleration Data Structures

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

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

Accelerated Raytracing

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

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

Ray Tracing. Quiz Discussion. Announcements: Final Projects. Last Time? Durer s Ray Casting Machine. Today

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

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

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

Announcements. Written Assignment 2 out (due March 8) Computer Graphics

Ray Tracing. Last Time? Today. Ray Casting. Durer s Ray Casting Machine. Reading for Today

Lecture 2 - Acceleration Structures

Ray Tracing. Announcements: Quiz. Last Time? Today. Durer s Ray Casting Machine. Ray Casting

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

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

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

Computer Graphics Ray Casting. Matthias Teschner

Bounding Volume Hierarchies. CS 6965 Fall 2011

Local vs. Global Illumination & Radiosity

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

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

Sung-Eui Yoon ( 윤성의 )

MSBVH: An Efficient Acceleration Data Structure for Ray Traced Motion Blur

CS 465 Program 5: Ray II

Distributed Ray Tracing

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

Using Bounding Volume Hierarchies Efficient Collision Detection for Several Hundreds of Objects

Ray Tracing Acceleration. CS 4620 Lecture 20

Accelerating Ray-Scene Intersection Calculations

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1

VIII. Visibility algorithms (II)

The Traditional Graphics Pipeline

CPSC GLOBAL ILLUMINATION

Ray Tracing. CS334 Fall Daniel G. Aliaga Department of Computer Science Purdue University

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

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Ray tracing. EECS 487 March 19,

Computer Graphics. - Spatial Index Structures - Philipp Slusallek

Speeding Up Ray Tracing. Optimisations. Ray Tracing Acceleration

EECS 487: Interactive Computer Graphics

Anti-aliasing and Monte Carlo Path Tracing. Brian Curless CSE 457 Autumn 2017

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

Collision and Proximity Queries

Real-Time Voxelization for Global Illumination

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Acceleration Structures. CS 6965 Fall 2011

CS 4620 Program 4: Ray II

Ray Tracing Acceleration. CS 4620 Lecture 22

Collision Detection. These slides are mainly from Ming Lin s course notes at UNC Chapel Hill

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

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

Recursive Ray Tracing. Ron Goldman Department of Computer Science Rice University

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Accelerating Ray-Tracing

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

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

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline

Sampling: Antialiasing - Intro

Solid Modeling. Thomas Funkhouser Princeton University C0S 426, Fall Represent solid interiors of objects

Distribution Ray-Tracing. Programação 3D Simulação e Jogos

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Computer Graphics. Si Lu. Fall uter_graphics.htm 11/22/2017

Werner Purgathofer

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

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

Visible Surface Detection Methods

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

Accelerating Ray Tracing

3D Rendering and Ray Casting

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

Anti-aliasing and Monte Carlo Path Tracing. Brian Curless CSE 557 Autumn 2017

Ray Tracing. Outline. Ray Tracing: History

3D Rendering and Ray Casting

Anti-aliasing and Monte Carlo Path Tracing

Rendering. Basic Math Review. Rasterizing Lines and Polygons Hidden Surface Remove Multi-pass Rendering with Accumulation Buffers.

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

Computer Graphics. Bing-Yu Chen National Taiwan University

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

Hello, Thanks for the introduction

Two Optimization Methods for Raytracing. W. Sturzlinger and R. F. Tobler

Transcription:

Ray-tracing Acceleration Acceleration Data Structures for Ray Tracing Thanks to Fredo Durand and Barb Cutler Soft shadows Antialiasing (getting rid of jaggies) Glossy reflection Motion blur Depth of field (focus) Shadows Shadows & Light Sources one shadow ray per intersection per point light source no shadow rays http://www.davidfay.com/index.php one shadow ray http://3media.initialized.org/photos/2000-10-18/index_gall.htm clear bulb frosted bulb http://www.pa.uky.edu/~sciworks/light/preview/bulb2.htm Soft Shadows Antialiasing Supersampling Multiple shadow rays to sample area light source Distribute rays over an interval light source one shadow ray Multiple rays per pixel Distribute rays over an interval multiple rays per pixel point light jaggies w/ antialiasing lots of shadow rays area light 1

Reflection one reflection ray per intersection Glossy Reflection multiple reflection rays Distribute rays over an interval multiple reflection rays Justin Legakis θ θ perfect mirror θ θ polished surface Motion Blur Sample objects temporally Distribute rays over an interval - time Depth of Field Distribute rays over an interval - lens area Rob Cook film focal length Justin Legakis Ray Tracing Algorithm Analysis Ray-Tracing Taxonomy 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 * size of recursive ray tree * num shadow rays * num supersamples * num glossy rays * num temporal samples * num focal samples *... can we reduce this? by James Arvo and David Kirk 2

Ray-tracing Acceleration of each primitive of groups of ed primitives Acceleration of Ray Casting Goal: Reduce the number of ray/primitive intersections Conservative Bounding Region Conservative Bounding Regions First check for an intersection with a conservative bounding region Early reject tight avoid false positives fast to intersect non-aligned bounding box bounding sphere axis-aligned bounding box arbitrary convex region (bounding half-spaces) Intersection with Axis-Aligned Box Bounding Box of a Triangle t 1y t near t far t 2y t 1x x=x1 t 2x x=x2 y=y2 y=y1 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 = (min(x 0,x 1,x 2 ), min(y 0,y 1,y 2 ), min(z 0,z 1,z 2 )) (x 1, y 1, z 1 ) (x 0, y 0, z 0 ) (x 2, y 2, z 2 ) = (max(x 0,x 1,x 2 ), max(y 0,y 1,y 2 ), max(z 0,z 1,z 2 )) 3

Bounding Box of a Sphere Bounding Box of a Plane = (x+r, y+r, z+r) = (+, +, + )* (x, y, z) r ax + by + cz = d n = (a, b, c) = (x-r, y-r, z-r) = (-, -, - )* * unless n is exactly perpendicular to an axis Bounding Box of a Group Bounding Box of a Transform (x max_a, y max_a, z max_a ) (x max_b, y max_b, z max_b ) = (max(x max_a,x max_b ), max(y max_a,y max_b ), max(z max_a,z max_b )) M (x 3,y 3,z 3 ) = M (x max,y max,z min ) (x' max, y' max, z' max ) = (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 min_b, y min_b, z min_b ) (x min_a, y min_a, z min_a ) (x 2,y 2,z 2 ) = M (x min,y max,z min ) (x 1,y 1,z 1 ) = M (x max,y min,z min ) = (min(x min_a,x min_b ), min(y min_a,y min_b ), min(z min_a,z min_b )) (x' min, y' min, z' min ) = (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 )) (x 0,y 0,z 0 ) = M (x min,y min,z min ) Special Case: Transformed Triangle Special Case: Transformed Triangle Can we do better? M (x 0, y 0, z 0 ) M (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 ) = (max(x' 0,x' 1,x' 2 ), max(y' 0,y' 1,y' 2 ), max(z' 0,z' 1,z' 2 )) (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 )) 4

Ray-tracing Acceleration Regular Grid Regular Grid Adaptive Grids Hierarchical Bounding Volumes Create Grid Find bounding box of scene Choose grid resolution (n x, n y, n z ) grid x need not = grid y Cell (i, j) Insert Primitives into Grid Primitives that overlap multiple cells? Insert into multiple cells (use pointers) grid y grid x For Each Cell Along a Ray Does the cell contain an intersection? Yes: return closest intersection No: continue Preventing Repeated Computation Perform the computation once, "mark" the object Don't re-intersect marked objects 5

Don't Return Distant Intersections If intersection t is not within the cell range, continue (there may be something closer) Which Cells Should We Examine? Should we intersect the ray with each voxel? No! we can do better! Where Do We Start? Is there a Pattern to Cell Crossings? Intersect ray with scene bounding box Ray origin may be inside the scene bounding box Cell (i, j) t next_y Yes, the horizontal and vertical crossings have regular spacing dt x = grid x / dir x t next_x t min t min t next_x t next_y dir x dir y dt y = grid y / dir y grid y grid x What's the Next Cell? What's the Next Cell? if ( t next_x < t next_y ) i += sign x t min = t next_x Cell (i, j) Cell (i+1, j) 3DDDA Three Dimensional Digital Difference Analyzer t next_x += dt x else j += sign y t min = t next_y t min t next_x t next_y Similar to Bresenham s Line Rasterization! t next_y += dt y (dir x, dir y ) dt y dt x if (dir x > 0) sign x = 1 else sign x = -1 if (dir y > 0) sign y = 1 else sign y = -1 6

Pseudo-Code create grid insert primitives into grid for each ray r find initial cell c(i,j), t min, t next_x & t next_y compute dt x, dt y, 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 Regular Grid Discussion Advantages? easy to construct easy to traverse Disadvantages? may be only sparsely filled geometry may still be clumped Ray-tracing Acceleration Regular Grid Adaptive Grids Hierarchical Bounding Volumes Adaptive Grids Subdivide until each cell contains no more than n elements, or maximum depth d is reached Nested Grids Octree/(Quadtree) Primitives in an Adaptive Grid Can live at intermediate levels, or be pushed to lowest level of grid Adaptive Grid Discussion Advantages? grid complexity matches geometric density Disadvantages? more expensive to traverse (especially octree) Octree/(Quadtree) 7

Ray-tracing Acceleration Regular Grid Adaptive Grids Hierarchical Bounding Volumes Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse 8

Where to split objects? At midpoint OR Sort, and put half of the objects on each side OR Use modeling hierarchy Intersection with BVH Check sub-volume with closer intersection first Intersection with BVH Don't return intersection immediately if the other subvolume may have a closer intersection 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 Ray-tracing Acceleration Transformation Hierarchy A B group C group D E Flatten Group & Transformation hierarchy may not be a good spatial hierarchy A B group C D C E 9

Ray Marching Visualization Next time: ray-tracing at Pixar sphere voxelization cells traversed primitive density entered faces 10