University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Distribution Ray Tracing.

Slides:



Advertisements
Similar presentations
Sampling and Reconstruction
Advertisements

Advanced Effects CMSC 435/634. General Approach Ray Tracing – Shoot more rays Rasterization – Render more images.
Photorealistic Rendering. Ray tracing v. photorealistic rendering What illumination effects are not captured by ray tracing? What illumination effects.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Ray Tracing Variants Distributed ray tracing Generalized rays Cone Tracing Beam Tracing Pencil.
Advanced Ray Tracing CMSC 435/634. Basic Ray Tracing For each pixel – Compute ray direction – Find closest surface – For each light Compute direct illumination.
Christian Lauterbach COMP 770, 2/11/2009
Monte Carlo Integration Robert Lin April 20, 2004.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lectures 18, 19: Monte Carlo Integration Ravi Ramamoorthi Acknowledgements.
CSCE 641: Photon Mapping Jinxiang Chai. Outline Rendering equation Photon mapping.
Photon Tracing with Arbitrary Materials Patrick Yau.
1 Advanced Ray Tracing Mani Thomas CISC 440/640 Computer Graphics.
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 10: Global Illumination Ravi Ramamoorthi Some images courtesy.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
Paper by Alexander Keller
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Computer Graphics (Spring 2008) COMS 4160, Lecture 22: Global Illumination
Presentation of LR2V Kadi Bouatouch IRISA
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
Global Illumination Jian Huang, CS 594, Fall 2002 This set of slides reference text book and the course note of Dutre et. al on SIGGRAPH 2001.
01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency.
Today More raytracing stuff –Soft shadows and anti-aliasing More rendering methods –The text book is good on this –I’ll be using images from the CDROM.
-Global Illumination Techniques
Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand.
Monte Carlo I Previous lecture Analytical illumination formula This lecture Numerical evaluation of illumination Review random variables and probability.
Ray Tracing Jian Huang, CS 594, Fall, 2002 This set of slides are used at Ohio State by Prof. Roger Crawfis.
02/10/03© 2003 University of Wisconsin Last Time Participating Media Assignment 2 –A solution program now exists, so you can preview what your solution.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Ray Tracing.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Stochastic Radiosity K. H. Ko School of Mechatronics Gwangju Institute.
Cameras Digital Image Synthesis Yung-Yu Chuang 10/26/2006 with slides by Pat Hanrahan and Matt Pharr.
CSE 681 DISTRIBUTED RAY TRACING some implementation notes.
CS348B Lecture 9Pat Hanrahan, Spring 2005 Overview Earlier lecture Statistical sampling and Monte Carlo integration Last lecture Signal processing view.
Monte-Carlo Ray Tracing and
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Hybrid Algorithms K. H. Ko School of Mechatronics Gwangju Institute.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
02/12/03© 2003 University of Wisconsin Last Time Intro to Monte-Carlo methods Probability.
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.
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Stochastic Path Tracing Algorithms K. H. Ko School of Mechatronics Gwangju.
Slide 1Lastra, 2/14/2016 Monte-Carlo Methods. Slide 2Lastra, 2/14/2016 Topics Kajiya’s paper –Showed that existing rendering methods are approximations.
Monte Carlo Path Tracing
University of Texas at Austin CS395T - Advanced Image Synthesis Spring 2007 Don Fussell Photon Mapping and Irradiance Caching.
Global Illumination (3) Photon Mapping (1). Overview Light Transport Notation Path Tracing Photon Mapping –Photon Tracing –The Photon Map.
01/26/05© 2005 University of Wisconsin Last Time Raytracing and PBRT Structure Radiometric quantities.
Global Illumination (3) Path Tracing. Overview Light Transport Notation Path Tracing Photon Mapping.
David Luebke 3/17/2016 Advanced Computer Graphics Antialiasing David Luebke
Distributed Ray Tracing. Can you get this with ray tracing?
Distributed Ray Tracing. Can you get this with ray tracing?
Computer graphics III – Multiple Importance Sampling Jaroslav Křivánek, MFF UK
Global Illumination (3) Cone Tracing / Distributed Ray Tracing.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Sampling and Reconstruction of Visual Appearance
Distributed Ray Tracing
Mike Merchant Nicholas Hilbert
© University of Wisconsin, CS559 Fall 2004
(c) 2002 University of Wisconsin
Distribution Ray Tracing
Path Tracing (some material from University of Wisconsin)
Distributed Ray Tracing
Distributed Ray Tracing
(c) 2002 University of Wisconsin
Progressive Photon Mapping Toshiya Hachisuka Henrik Wann Jensen
Monte Carlo Rendering Central theme is sampling:
CS5500 Computer Graphics May 29, 2006
Distributed Ray Tracing
Anti-aliased and accelerated ray tracing
Distributed Ray Tracing
Distributed Ray Tracing
Monte Carlo Path Tracing and Caching Illumination
Monte Carlo Integration
Photon Density Estimation using Multiple Importance Sampling
Presentation transcript:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Distribution Ray Tracing

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 2 Reading Required: Watt, sections 10.6,14.8. Further reading: A. Glassner. An Introduction to Ray Tracing. Academic Press, [In the lab.] Robert L. Cook, Thomas Porter, Loren Carpenter. “Distributed Ray Tracing.” Computer Graphics (Proceedings of SIGGRAPH 84). 18 (3). pp James T. Kajiya. “The Rendering Equation.” Computer Graphics (Proceedings of SIGGRAPH 86). 20 (4). pp Henrik Wann Jensen, “Basic Monte Carlo Integration”, Appendix A from book “Realistic Image Synthesis Using Photon Mapping”.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 3 Pixel anti-aliasing No anti-aliasing Pixel anti-aliasing

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 4 Surface reflection equation In reality, surfaces do not reflect in a mirror-like fashion. To compute the reflection from a real surface, we would actually need to solve the surface reflection equation: How might we represent light from a single direction? We can plot the reflected light as a function of viewing angle for multiple light source contributions:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 5 Simulating gloss and translucency The mirror-like form of reflection, when used to approximate glossy surfaces, introduces a kind of aliasing, because we are undersampling reflection (and refraction). For example: Distributing rays over reflection directions gives:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 6 Reflection anti-aliasing

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 7 Full anti-aliasing Full anti-aliasing…lots of nested integrals! Computing these integrals is prohibitively expensive. We’ll look at ways to approximate integrals…

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 8 Approximating integrals Let’s say we want to compute the integral of a function: If f(x) is not known analytically, but can be evaluated, then we can approximate the integral by: Evaluating an integral in this manner is called quadrature.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 9 Integrals as expected values An alternative to distributing the sample positions regularly is to distribute them stochastically. Let’s say the position in x is a random variable X, which is distributed according to p(x), a probability density function (strictly positive that integrates to unity). Now let’s consider a function of that random variable, f(X)/p(X). What is the expected value of this new random variable? First, recall the expected value of a function g(X): Then, the expected value of f(X)/p(X) is:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 10 Monte Carlo integration Thus, given a set of samples positions, X i, we can estimate the integral as: This procedure is known as Monte Carlo integration. The trick is getting as accurate as possible with as few samples as possible. More concretely, we would like the variance of the estimate of the integral to be low: The name of the game is variance reduction…

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 11 Uniform sampling One approach is uniform sampling (i.e., choosing X from a uniform distribution):

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 12 Importance sampling A better approach, if f(x) is positive, would be to choose p(x) ~ f(x). In fact, this choice would be optimal. Why don’t we just do that? Alternatively, we can use heuristics to guess where f(x) will be large. This approach is called importance sampling.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 13 Summing over ray paths We can think of this problem in terms of enumerated rays: The intensity at a pixel is the sum over the primary rays: For a given primary ray, its intensity depends on secondary rays: Substituting back in:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 14 Summing over ray paths We can incorporate tertiary rays next: Each triple i,j,k corresponds to a ray path: So, we can see that ray tracing is a way to approximate a complex, nested light transport integral with a summation over ray paths (of arbitrary length!). Problem: too expensive to sum over all paths. Solution: choose a small number of “good” paths.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 15 Whitted integration An anti-aliased Whitted ray tracer chooses very specific paths, i.e., paths starting on a regular sub-pixel grid with only perfect reflections (and refractions) that terminate at the light source. One problem with this approach is that it doesn’t account for non-mirror reflection at surfaces.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 16 Monte Carlo path tracing Instead, we could choose paths starting from random sub- pixel locations with completely random decisions about reflection (and refraction). This approach is called Monte Carlo path tracing [Kajiya86]. The advantage of this approach is that the answer is known to be unbiased and will converge to the right answer.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 17 Importance sampling The disadvantage of the completely random generation of rays is the fact that it samples unimportant paths and neglects important ones. This means that you need a lot of rays to converge to a good answer. The solution is to re-inject Whitted-like ideas: spawn rays to the light, and spawn rays that favor the specular direction.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 18 Stratified sampling Another method that gives faster convergence is stratified sampling. E.g., for sub-pixel samples: We call this a jittered sampling pattern. One interesting side effect of these stochastic sampling patterns is that they actually injects noise into the solution (slightly grainier images). This noise tends to be less objectionable than aliasing artifacts.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 19 Distribution ray tracing These ideas can be combined to give a particular method called distribution ray tracing [Cook84]: uses non-uniform (jittered) samples. replaces aliasing artifacts with noise. provides additional effects by distributing rays to sample: Reflections and refractions Light source area Camera lens area Time [Originally called “distributed ray tracing,” but we will call it distribution ray tracing so as not to confuse with parallel computing.]

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 20 DRT pseudocode TraceImage() looks basically the same, except now each pixel records the average color of jittered sub-pixel rays. function traceImage (scene): for each pixel (i, j) in image do I(i, j)  0 for each sub-pixel id in (i,j) do s  pixelToWorld(jitter(i, j, id)) p  COP d  (s - p).normalize() I(i, j)  I(i, j) + traceRay(scene, p, d, id) end for I(i, j)  I(i, j)/numSubPixels end for end function A typical choice is numSubPixels = 4*4.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 21 DRT pseudocode (cont’d) Now consider traceRay(), modified to handle (only) opaque glossy surfaces: function traceRay(scene, p, d, id): (q, N, material)  intersect (scene, p, d) I  shade(…) R  jitteredReflectDirection(N, -d, id) I  I + material. k r  traceRay(scene, q, R, id) return I end function

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 22 Pre-sampling glossy reflections

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 23 Distributing rays over light source area gives: Soft shadows

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 24 The pinhole camera The first camera - “camera obscura” - known to Aristotle. In 3D, we can visualize the blur induced by the pinhole (a.k.a., aperture): Q: How would we reduce blur?

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 25 Shrinking the pinhole Q: How can we simulate a pinhole camera more accurately? Q: What happens as we continue to shrink the aperture?

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 26 Shrinking the pinhole, cont’d

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 27 Pinhole cameras in the real world require small apertures to keep the image in focus. Lenses focus a bundle of rays to one point => can have larger aperture. For a “thin” lens, we can approximately calculate where an object point will be in focus using the the Gaussian lens formula: where f is the focal length of the lens. Lenses

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 28 Depth of field Lenses do have some limitations. The most noticeable is the fact that points that are not in the object plane will appear out of focus. The depth of field is a measure of how far from the object plane points can be before appearing “too blurry.

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 29 Simulating depth of field Distributing rays over a finite aperture gives:

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 30 In general, you can trace rays through a scene and keep track of their id’s to handle all of these effects: Chaining the ray id’s

University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 31 DRT to simulate motion blur Distributing rays over time gives: