Anti-aliased and accelerated ray tracing

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
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.
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.
CS 445 Greg Humphreys, Spring 2003 Ray Tracing 2: Acceleration.
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.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
CS 376 Introduction to Computer Graphics 04 / 09 / 2007 Instructor: Michael Eckmann.
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
Introduction General Data Structures - Arrays, Linked Lists - Stacks & Queues - Hash Tables & Binary Search Trees - Graphs Spatial Data Structures -Why.
Bounding Volume Hierarchies and Spatial Partitioning Kenneth E. Hoff III COMP-236 lecture Spring 2000.
Lecture 8 Advanced Rendering – Ray Tracing, Radiosity & NPR.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
Hidden Surface Removal
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
1 Speeding Up Ray Tracing Images from Virtual Light Field Project ©Slides Anthony Steed 1999 & Mel Slater 2004.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Distribution Ray Tracing.
Graphics Graphics Korea University cgvr.korea.ac.kr Solid Modeling 고려대학교 컴퓨터 그래픽스 연구실.
Visible-Surface Detection Jehee Lee Seoul National University.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Ray Tracing.
Real-time Graphics for VR Chapter 23. What is it about? In this part of the course we will look at how to render images given the constrains of VR: –we.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Hierarchical Penumbra Casting Samuli Laine Timo Aila Helsinki University of Technology Hybrid Graphics, Ltd.
Duy & Piotr. How to reconstruct a high quality image with the least amount of samples per pixel the least amount of resources And preserving the image.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
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.
Bounding Volume Hierarchy. The space within the scene is divided into a grid. When a ray travels through a scene, it only passes a few boxes within the.
Advanced topics Advanced Multimedia Technology: Computer Graphics Yung-Yu Chuang 2006/01/04 with slides by Brian Curless, Zoran Popovic, Mario Costa Sousa.
CS559: Computer Graphics Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008.
Ray Tracing Optimizations
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
CSE 681 Introduction to Ray Tracing. CSE 681 Ray Tracing Shoot a ray through each pixel; Find first object intersected by ray. Image plane Eye Compute.
Ray Tracing Acceleration (5). Ray Tracing Acceleration Techniques Too Slow! Uniform grids Spatial hierarchies K-D Octtree BSP Hierarchical grids Hierarchical.
David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke
Path/Ray Tracing Examples. Path/Ray Tracing Rendering algorithms that trace photon rays Trace from eye – Where does this photon come from? Trace from.
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
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.
Bounding Volume Hierarchies and Spatial Partitioning
CSE 167 [Win 17], Lecture 15: Ray Tracing Ravi Ramamoorthi
Photorealistic Rendering vs. Interactive 3D Graphics
(c) 2002 University of Wisconsin, CS559
Distributed Ray Tracing
Visible-Surface Detection Methods
Bounding Volume Hierarchies and Spatial Partitioning
Real-Time Ray Tracing Stefan Popov.
3D Graphics Rendering PPT By Ricardo Veguilla.
Ray Tracing Acceleration Techniques
3D Object Representations
Mike Merchant Nicholas Hilbert
Jim X. Chen George Mason University
© University of Wisconsin, CS559 Fall 2004
CSCE 441: Computer Graphics Hidden Surface Removal
Distribution Ray Tracing
CMSC 635 Ray Tracing.
UMBC Graphics for Games
Distributed Ray Tracing
CSCE 441: Computer Graphics Ray Tracing
Primitive Drawing Algorithm
Distributed Ray Tracing
Anti-aliased and accelerated ray tracing
Primitive Drawing Algorithm
Introduction to Ray Tracing
Distributed Ray Tracing
Presentation transcript:

Anti-aliased and accelerated ray tracing

Reading Required: Further reading: Watt, sections 12.5.3 – 12.5.4, 14.7 Further reading: A. Glassner. An Introduction to Ray Tracing. Academic Press, 1989. [In the lab.] University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 2

Aliasing in rendering Sketch the triangle that would create the given image -- lower right corner coverage. Called the jaggies. Point to frame 1, 4, 7, 10, 13 One of the most common rendering artifacts is the “jaggies”. Consider rendering a white polygon against a black background: We would instead like to get a smoother transition: University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 3

Anti-aliasing Q: How do we avoid aliasing artifacts? Sampling: 1. Increase sampling rate -- not practical for fixed resolution display. 2. Smooth out high frequences analytically. Requires an analytic function. 3. Supersample and average down. Q: How do we avoid aliasing artifacts? Sampling: Pre-filtering: Combination: Example - polygon: University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 4

Polygon anti-aliasing Show anti-aliased image with ray sample. A: Motion blur Draw a dot streaking across the screen, first as jumps then as smear. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 5

Antialiasing in a ray tracer Put a box around the “support of a pixel”. Show ray-traced output We would like to compute the average intensity in the neighborhood of each pixel. When casting one ray per pixel, we are likely to have aliasing artifacts. To improve matters, we can cast more than one ray per pixel and average the result. A.k.a., super-sampling and averaging down. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 6

Speeding it up Vanilla ray tracing is really slow! Put a box around the “support of a pixel”. Show ray-traced output Vanilla ray tracing is really slow! Consider: m x m pixels, k x k supersampling, and n primitives, average ray path length of d, with 2 rays cast recursively per intersection. Complexity = For m=1,000,000, k = 5, n = 100,000, d=8…very expensive!! In practice, some acceleration technique is almost always used. We’ve already looked at reducing d with adaptive ray termination. Now we look at reducing the effect of the k and n terms. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 7

Antialiasing by adaptive sampling |I1 - I2| > thresh I1/I2 or I2/I1 > 1 + thresh -- better since it’s based on relative values, which is the way the eye perceives. Show how ray sample doesn’t take 16X longer to trace. Casting many rays per pixel can be unnecessarily costly. For example, if there are no rapid changes in intensity at the pixel, maybe only a few samples are needed. Solution: adaptive sampling. Q: When do we decide to cast more rays in a particular area? University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 8

Faster ray-polyhedron intersection Let’s say you were intersecting a ray with a polyhedron: Straightforward method intersect the ray with each triangle return the intersection with the smallest t-value. Q: How might you speed this up? University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 9

Ray Tracing Acceleration Techniques 1 N Faster Intersection Fewer Rays Generalized Approaches Tighter bounds Faster intersector Uniform grids Spatial hierarchies k-d, oct-tree, bsp hierarchical grids Hierarchical bounding volumes (HBV) Early ray termination Adaptive sampling Beam tracing Cone tracing Pencil tracing Readings Arvo and Kirk Arvo, Metahierarchies Havran and “Best Efficiency Scheme” Beam tracing techniques fail for two reasons: Intersection calculations are too complicated; imagine cone-algebraic surface Beams don’t remain closed under reflection and refraction off curved surfaces Bounds First test bounds, then do detailed intersection calculation Trade-off on how tight the bounds are; the tighter the bound, the higher the Probability of a real intersection given an intersection with the bound, but the higher the cost of rejection. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 10

Uniform spatial subdivision Another approach is uniform spatial subdivision. Idea: Partition space into cells (voxels) Associate each primitive with the cells it overlaps Trace ray through voxel array using fast incremental arithmetic to step from cell to cell University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 11

Uniform Grids Preprocess scene Find bounding box Two reasons for using a grid. Cull out objects not near the ray. Only consider those objects in the voxels along the ray’s path Early termination. Stop when you find the point of closest intersection. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 12

Uniform Grids Preprocess scene Find bounding box Determine resolution Setting the resolution is tricky. If the resolution is too high, then you step through too many voxels. If the resolution is too low, then you perform too many intersections. Add Tim’s study of voxel density. Roughly set so that the average time spent walking voxels is equal to the average time spent test for intersection. D=3 is typical. Woo describes an algorithm for non-uniformly allocating voxels in each direction. D is the voxel density, and was introduced by Cleary and Wyvill? University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 13

Uniform Grids Preprocess scene Find bounding box Determine resolution Place object in cell, if object overlaps cell University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 14

Uniform Grids Preprocess scene Find bounding box Determine resolution Place object in cell, if object overlaps cell Check that object intersects cell Could remove interior voxels as well. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 15

Uniform Grids Preprocess scene Traverse grid 3D line – 3D-DDA 6-connected line University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 16

Caveat: Overlap Optimize for objects that overlap multiple cells Traverse until tmin(cell) > tmax(ray) Problem: Redundant intersection tests: Solution: Mailboxes Assign each ray an increasing number Primitive intersection cache (mailbox) Store last ray number tested in mailbox Only intersect if ray number is greater Mailboxes first proposed by Amanaidas and Woo Each ray is assigned a unique number. Latter rays have higher numbers than earlier rays. Store the ray number with each primitive. Don’t test rays if their ray number is less than or equal to the primitive’s ray number. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 17

Non-uniform spatial subdivision Still another approach is non-uniform spatial subdivision. Other variants include k-d trees and BSP trees. Various combinations of these ray intersections techniques are also possible. See Glassner and pointers at bottom of project web page for more. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 18

Non-uniform spatial subdivision Best approach - k-d trees or perhaps BSP trees More adaptive to actual scene structure BSP vs. k-d tradeoff between speed from simplicity and better adaptability 1 2 3 4 5 6 7 8 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 19

Spatial Hierarchies Letters correspond to planes (A) As questions? Kay-Kajiya Properties of hierarchical bounding volumes … A Letters correspond to planes (A) Point Location by recursive search University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 20

Spatial Hierarchies Letters correspond to planes (A, B) As questions? Kay-Kajiya Properties of hierarchical bounding volumes … Letters correspond to planes (A, B) Point Location by recursive search University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 21

Spatial Hierarchies Letters correspond to planes (A, B, C, D) As questions? Kay-Kajiya Properties of hierarchical bounding volumes … Letters correspond to planes (A, B, C, D) Point Location by recursive search University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 22

Variations kd-tree oct-tree bsp-tree Kd-tree where you set the position of the splitting plane. Oct-tree where you set the position of the center point. kd-tree oct-tree bsp-tree University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 23

Ray Traversal Algorithms Recursive inorder traversal [Kaplan, Arvo, Jansen] Intersect(L,tmin,tmax) Intersect(L,tmin,t*) Intersect(R,t*,tmax) Intersect(R,tmin,tmax) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 24

Build Hierarchy Top-Down ? What exactly is the surface-area heuristic Choose splitting plane Midpoint Median cut Surface area heuristic University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 25

Surface Area and Rays Number of rays in a given direction that hit an object is proportional to its projected area The total number of rays hitting an object is Crofton’s Theorem: For a convex body For example: sphere University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 26

Surface Area and Rays The probability of a ray hitting a convex shape that is completely inside a convex cell equals Question after class. How is this used? Need to show in detail how this information Is used to find the optimal hierarchy. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 27

Surface Area Heuristic Intersection time Traversal time What exactly is the surface-area heuristic a b University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 28

Surface Area Heuristic b 2n splits What exactly is the surface-area heuristic University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 29

Hierarchical bounding volumes We can generalize the idea of bounding volume acceleration with hierarchical bounding volumes. Key: build balanced trees with tight bounding volumes. Many different kinds of bounding volumes. Note that bounding volumes can overlap. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 30