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

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

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

Advanced Ray Tracing

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

Spatial Data Structures

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

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

Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

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

Acceleration Data Structures

The Traditional Graphics Pipeline

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

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

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

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

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

The Traditional Graphics Pipeline

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Accelerated Raytracing

Ray Tracing Acceleration Data Structures

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

CS 465 Program 5: Ray II

CS 4620 Program 4: Ray II

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

The Traditional Graphics Pipeline

Real-Time Voxelization for Global Illumination

Sung-Eui Yoon ( 윤성의 )

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

Intersection Acceleration

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

CPSC GLOBAL ILLUMINATION

Ray tracing. EECS 487 March 19,

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

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

Ray Tracing. Outline. Ray Tracing: History

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

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

CS452/552; EE465/505. Clipping & Scan Conversion

Topics and things to know about them:

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

Computer Graphics Ray Casting. Matthias Teschner

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

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

Computer Graphics. Bing-Yu Chen National Taiwan University

Lecture 2 - Acceleration Structures

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

Ray Tracing Acceleration. CS 4620 Lecture 20

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

For Intuition about Scene Lighting. Today. Limitations of Planar Shadows. Cast Shadows on Planar Surfaces. Shadow/View Duality.

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Werner Purgathofer

Topic #1: Rasterization (Scan Conversion)

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

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

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

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

Graphics 2009/2010, period 1. Lecture 8: ray tracing

Motivation. Sampling and Reconstruction of Visual Appearance. Effects needed for Realism. Ray Tracing. Outline

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

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

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

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

Hidden surface removal. Computer Graphics

COMP371 COMPUTER GRAPHICS

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

Last Time. Why are Shadows Important? Today. Graphics Pipeline. Clipping. Rasterization. Why are Shadows Important?

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

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

CEng 477 Introduction to Computer Graphics Fall 2007

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

Local vs. Global Illumination & Radiosity

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

Introduction to Visualization and Computer Graphics

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Last Time. Reading for Today: Graphics Pipeline. Clipping. Rasterization

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

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

Pipeline Operations. CS 4620 Lecture 10

SUMMARY. CS380: Introduction to Computer Graphics Ray tracing Chapter 20. Min H. Kim KAIST School of Computing 18/05/29. Modeling

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

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

VIII. Visibility algorithms (II)

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

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

Surface shading: lights and rasterization. Computer Graphics CSE 167 Lecture 6

CHAPTER 1 Graphics Systems and Models 3

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

Accelerating Ray-Tracing

RASTERIZING POLYGONS IN IMAGE SPACE

Transcription:

Last Time: Acceleration Data Structures for Ray Tracing Modeling Transformations Illumination (Shading) Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Scan Conversion (Rasterization) Graphics Pipeline!! Clipping Line & Polygon Rasterization Bresenham (DDA) Visibility Depth Buffer (z- buffer) Visibility / Display Schedule Wed Oct 13 th Assignment 4 due (Shadows, Reflection, & Refraction) Wed Oct 20 th Assignment 5 due (Voxel Rendering) Review Session for Quiz 1 Monday 25 th, 7:30 9pm, room TBA Tuesday October 26 th, in class: Quiz 1 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 clear bulb frosted bulb http://3media.initialized.org/photos/2000-10-18/index_gall.htm http://www.pa.uky.edu/~sciworks/light/preview/bulb2.htm

Soft Shadows Antialiasing Supersampling multiple shadow rays to sample area light source multiple rays per pixel jaggies w/ antialiasing one shadow ray point light lots of shadow rays area light Reflection one reflection ray per intersection Glossy Reflection multiple reflection rays Justin Legakis θ θ perfect mirror θ θ polished surface Motion Blur Sample objects temporally Depth of Field multiple rays per pixel Rob Cook film focal length Justin Legakis

Ray Tracing Algorithm Analysis Questions? 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? 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 From Lecture 2, Ray Casting II t far t 2y t 2x y=y2 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 (x 1, y 1, z 1 ) (x 0, y 0, z 0 ) = (max(x 0,x 1,x 2 ), max(y 0,y 1,y 2 ), max(z 0,z 1,z 2 )) t 1y t near t 1x x=x1 y=y1 x=x2 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 2, y 2, z 2 ) 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 ) = (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' 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 ) = (min(x' 0,x' 1,x' 2 ), min(y' 0,y' 1,y' 2 ), min(z' 0,z' 1,z' 2 )) Questions? Regular Grid Adaptive Grids Hierarchical Bounding Volumes Regular Grid 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) grid y grid x

Insert Primitives into Grid Primitives that overlap multiple cells? Insert into multiple cells (use pointers) 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 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? Where Do We Start? Should we intersect the ray with each voxel? No! we can do better! Intersect ray with scene bounding box Ray origin may be inside the scene bounding box Cell (i, j) t next_y t next_x t min t next_y t min t next_x

Is there a Pattern to Cell Crossings? What's the Next Cell? Yes, the horizontal and vertical crossings have regular spacing dt x = grid x / dir x if ( t next_x < t next_y ) i += sign x t min = t next_x t next_x += dt x else j += sign y t min = t next_y Cell (i+1, j) Cell (i, j) t next_x t min t next_y t next_y += dt y dir x dir y dt y = grid y / dir y grid y (dir x, dir y ) dt y dt x grid x if (dir x > 0) sign x = 1 else sign x = -1 if (dir y > 0) sign y = 1 else sign y = -1 What's the Next Cell? 3DDDA Three Dimensional Digital Difference Analyzer Similar to Bresenham s Line Rasterization! 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 A Note about Typos Typos happen in lecture notes Don t be afraid of thinking and asking questions Please tell us about any typos you find & we ll fix them ASAP Typos happen in textbooks The pseudocode for the 3DDDA ray/grid marching in Shirley is buggy Think, don t just copy directly

Questions? 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 Primitives in an Adaptive Grid Can live at intermediate levels, or be pushed to lowest level of grid Nested Grids Octree/(Quadtree) Octree/(Quadtree) Adaptive Grid Discussion Advantages? grid complexity matches geometric density Disadvantages? more expensive to traverse (especially octree) 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 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 Transformation Hierarchy Assignments 5 & 6 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 Assignment 5: Voxel Rendering Bounding boxes for primitives Sphere voxelization Regular grid data structure Fast ray-grid intersection Flatten the ation hierarchy Assignment 6: Grid Acceleration & Solid Textures Accelerated ray tracing (6) Analyze ray tracing statistics (average # of rays, intersections, etc. per pixel) Solid textures (next time) Extra Credit: Distribution Ray Tracing

Ray Marching Visualization Next Time: sphere voxelization cells traversed Texture Mapping primitive density entered faces