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

Similar documents
CS 431/636 Advanced Rendering Techniques

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

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

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

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

Advanced Ray Tracing

Lecture 11: Ray tracing (cont.)

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

Spatial Data Structures

Spatial Data Structures

Acceleration Data Structures

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

Spatial Data Structures

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

Accelerated Raytracing

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

Spatial Data Structures

Spatial Data Structures

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

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

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

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

Computer Graphics Ray Casting. Matthias Teschner

Intersection Acceleration

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

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

CPSC GLOBAL ILLUMINATION

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

CS 431/636 Advanced Rendering Techniques

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

Ray Tracing Acceleration. CS 4620 Lecture 20

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

Ray Tracing Acceleration Data Structures

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

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

Ray Intersection Acceleration

improving raytracing speed

Sung-Eui Yoon ( 윤성의 )

Lecture 2 - Acceleration Structures

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

CS 465 Program 5: Ray II

Ray Tracing Acceleration. CS 4620 Lecture 22

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

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

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline

Local vs. Global Illumination & Radiosity

Computer Graphics. - Spatial Index Structures - Philipp Slusallek

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

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

Collision and Proximity Queries

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

CS 4620 Program 4: Ray II

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

Accelerating Ray-Tracing

The Traditional Graphics Pipeline

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

Accelerating Ray Tracing

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

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

Accelerating Ray-Scene Intersection Calculations

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

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

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

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

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

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

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

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

Computer Graphics. Bing-Yu Chen National Taiwan University

Graphics and Interaction Rendering pipeline & object modelling

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

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

CS 563 Advanced Topics in Computer Graphics Culling and Acceleration Techniques Part 1 by Mark Vessella

Acceleration Structures. CS 6965 Fall 2011

Ray Intersection Acceleration

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

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

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

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

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

COMP 175: Computer Graphics April 11, 2018

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

Rasterization. MIT EECS Frédo Durand and Barb Cutler. MIT EECS 6.837, Cutler and Durand 1

Ray Tracing. Outline. Ray Tracing: History

Schedule. MIT Monte-Carlo Ray Tracing. Radiosity. Review of last week? Limitations of radiosity. Radiosity

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

EECS 487: Interactive Computer Graphics

CS535 Fall Department of Computer Science Purdue University

Lecture 11. More Ray Casting/Tracing

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

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp

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

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Determination (Penentuan Permukaan Tampak)

Visible-Surface Detection Methods. Chapter? Intro. to Computer Graphics Spring 2008, Y. G. Shin

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

MIT Monte-Carlo Ray Tracing. MIT EECS 6.837, Cutler and Durand 1

Hidden Surfaces II. Week 9, Mon Mar 15

Transcription:

CS 586/480 Computer Graphics II Dr. David Breen Matheson 408 Thursday 6PM Æ 8:50PM Presentation 4 10/28/04 Logistics Read research paper and prepare summary and question P. Hanrahan, "Ray Tracing Algebraic Surfaces," Proc. SIGGRAPH '83, July 1983, pp. 83-90 Shailaja Kaveti presents next week Questions from Last Week? Color models Light models Phong shading model Assignment 3 Slide Credits Leonard McMillan, Seth Teller, Fredo Durand, Barb Cutler - MIT David Luebke - University of Virginia Matt Pharr - Stanford University Jonathan Cohen - Johns Hopkins U. Kevin Suffern -University of Technology, Sydney, Australia 1

Extra rays needed for these effects Motivation Distribution Ray Tracing Soft shadows Anti-aliasing (getting rid of jaggies) Glossy reflection Motion blur Depth of field (focus) Shadows Soft Shadows one shadow ray per intersection per point light source no shadow rays multiple shadow rays to sample area light source one shadow ray one shadow ray lots of shadow rays 2

Antialiasing Supersampling multiple rays per pixel point light jaggies w/ antialiasing Reflection one reflection ray per intersection area light perfect mirror Glossy Reflection multiple reflection rays Motion Blur Sample objects temporally Justin Legakis polished surface Rob Cook 3

Depth of Field multiple rays per pixel film focal length Justin Legakis 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? Bounding Regions 4

Acceleration of Ray Casting Goal: Reduce the number of ray/primitive intersection tests Conservative Bounding Region First check for an intersection with a conservative bounding region Early reject Conservative Bounding Regions tight Æ avoid false positives fast to intersect non-aligned bounding box bounding sphere axis-aligned bounding box Bounding Volumes 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: cost of ray-volume intersection test i: # times item is tested for intersection I: cost of ray-item intersection test arbitrary convex region (bounding half-spaces) 5

Bounding Volumes Spheres Cheap intersection test Poor fit A pain to fit to data bounding sphere Bounding Volumes Axis-aligned bounding boxes (AABBs) Relatively cheap intersection test Usually better fit Trivial to fit to data axis-aligned bounding box 6

Bounding Volumes Oriented bounding boxes (OBBs) Medium-expensive intersection test Very good fit (asymptotically better) Medium-difficult to fit to data Bounding Volumes Slabs (parallel planes) Comparatively expensive Very good fit A pain to fit to data oriented bounding box arbitrary convex region (bounding half-spaces) Intersection with Axis-Aligned Box Bounding Box of a Triangle From Lecture 2 For all 3 axes, calculate the intersection t 1y t near t 1x t far x=x1 t 2y t 2x x=x2 y=y2 y=y1 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 < 0, box is behind If box survived tests, report intersection at t near (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 1, y 1, z 1 ) (x 0, y 0, z 0 ) (x 2, y 2, z 2 ) (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 )) 7

Bounding Box of a Sphere Bounding Box of a Group r (x max, y max, z max ) = (x+r, y+r, z+r) (x max_a, y max_a, z max_a ) (x max_b, y max_b, z max_b ) (x max, y max, z max ) = (max(x max_a,x max_b ), max(y max_a,y max_b ), max(z max_a,z max_b )) (x, y, z) (x min_b, y min_b, z min_b ) (x min_a, y min_a, z min_a ) (x min, y min, z min ) = (x-r, y-r, z-r) (x min, 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 )) Acceleration Spatial Data Structures Spatial Data Structures Spatial partitioning techniques classify all space into non-overlapping portions Easier to generate automatically Can walk ray from partition to partition Hierarchical bounding volumes surround objects in the scene with (possibly overlapping) volumes Often tightest fit 8

Spatial Partitioning Some spatial partitioning schemes: Regular grid (2-D or 3-D) Octree k-d tree BSP-tree Acceleration Spatial Data Structures Regular Grid Regular Grid Create grid Find bounding box of scene Choose grid spacing grid x need not = grid y grid y Cell (i, j) grid x 9

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) 10

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_v t next_h Yes, the horizontal and vertical crossings have regular spacing dt v = grid y / dir y t min t min t next_v t next_h (dir x, dir y ) dt h = grid x / dir x grid y grid x What's the next cell? 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 (dir x, dir y ) Cell (i+1, j) Cell (i, j) t min t next_v if (dir x > 0) sign x = 1 else sign x = -1 if (dir y > 0) sign y = 1 else sign y = -1 dt h t next_h dt v What's the next cell? 3DDDA Three Dimensional Digital Difference Analyzer 3D Bresenham Algorithm 11

Pseudo-code Regular Grid Discussion 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 Advantages? easy to construct easy to traverse Disadvantages? may be only sparsely filled geometry may still be clumped Acceleration Spatial Data Structures Adaptive Grids Subdivide until each cell contains no more than n elements, or maximum depth d is reached Adaptive Grids Nested Grids Octree/(Quadtree) 12

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) k-d Trees k-d tree pros: Moderately simple to generate More adaptive than octrees k-d tree cons: Less efficient to trace rays across Moderately complex data structure BSP Trees BSP tree pros: Extremely adaptive Simple & elegant data structure BSP tree cons: Very hard to create optimal BSP Splitting planes can explode storage Simple but slow to trace rays across 13

Acceleration Spatial Data Structures Bounding Volume Hierarchy Bounding Volume Hierarchy 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! 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 14

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 15

Intersection with BVH Check subvolume 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 transform A transform B group transform C group transform transform D E Group & Transformation hierarchy may not be a good spatial hierarchy Flatten transform A B group transform C D transform C E 16

What s the best method? What kind of scene are you rendering? Teapot in a stadium vs. uniform distribution Impact on surface tessellation on distribution Parameter values are critical Shoot Fewer Rays Adaptive depth control Naïve ray tracer: spawn 2 rays per intersection until max recursion limit In practice, few surfaces are transparent or reflective Just shoot the rays you need Determine contribution of ray Don t shoot rays w/ contribution near 0% Shoot Fewer Rays 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 Generalized Rays Beams, cones, pencils Area sampling, rather than point sampling Geometric computations are tricky (expensive?) Problems with reflection/refractions 17

Wrap Up Discuss next week s programming assignment Add an acceleration technique Uniform grid Adaptive grid Bounding volume hierarchy Supersample image Discuss status/problems/issues with this week s programming assignment 18