Motivation. Monte Carlo Path Tracing. Monte Carlo Path Tracing. Monte Carlo Path Tracing. Monte Carlo Path Tracing

Similar documents
Motivation. Advanced Computer Graphics (Fall 2009) CS 283, Lecture 11: Monte Carlo Integration Ravi Ramamoorthi

Motivation: Monte Carlo Path Tracing. Sampling and Reconstruction of Visual Appearance. Monte Carlo Path Tracing. Monte Carlo Path Tracing

To Do. Real-Time High Quality Rendering. Motivation for Lecture. Monte Carlo Path Tracing. Monte Carlo Path Tracing. Monte Carlo Path Tracing

Monte Carlo Ray Tracing. Computer Graphics CMU /15-662

Raytracing & Epsilon. Today. Last Time? Forward Ray Tracing. Does Ray Tracing Simulate Physics? Local Illumination

Monte-Carlo Ray Tracing. Antialiasing & integration. Global illumination. Why integration? Domains of integration. What else can we integrate?

Choosing the Right Algorithm & Guiding

The Rendering Equation. Computer Graphics CMU /15-662, Fall 2016

Advanced Graphics. Path Tracing and Photon Mapping Part 2. Path Tracing and Photon Mapping

Biased Monte Carlo Ray Tracing

The Rendering Equation and Path Tracing

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

Lecture 7: Monte Carlo Rendering. MC Advantages

13 Distribution Ray Tracing

Monte Carlo Integration of The Rendering Equation. Computer Graphics CMU /15-662, Spring 2017

Part I The Basic Algorithm. Principles of Photon Mapping. A two-pass global illumination method Pass I Computing the photon map

INFOMAGR Advanced Graphics. Jacco Bikker - February April Welcome!

Overview. Radiometry and Photometry. Foundations of Computer Graphics (Spring 2012)

2/1/10. Outline. The Radiance Equation. Light: Flux Equilibrium. Light: Radiant Power. Light: Equation. Radiance. Jan Kautz

Lecture 7 - Path Tracing

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

The Rendering Equation. Computer Graphics CMU /15-662

Path Tracing part 2. Steve Rotenberg CSE168: Rendering Algorithms UCSD, Spring 2017

Korrigeringar: An introduction to Global Illumination. Global Illumination. Examples of light transport notation light

Realistic Image Synthesis

Assignment 3: Path tracing

Paths, diffuse interreflections, caching and radiometry. D.A. Forsyth

Global Illumination The Game of Light Transport. Jian Huang

Lecture 12: Photon Mapping. Biased Methods

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

MULTI-DIMENSIONAL MONTE CARLO INTEGRATION

MONTE-CARLO PATH TRACING

Recent Advances in Monte Carlo Offline Rendering

Monte Carlo Integration

Motivation: Monte Carlo Rendering. Sampling and Reconstruction of Visual Appearance. Caustics. Illumination Models. Overview of lecture.

Monte Carlo Integration COS 323

Virtual Spherical Lights for Many-Light Rendering of Glossy Scenes

Monte Carlo Path Tracing. The Rendering Equation

Biased Monte Carlo Ray Tracing:

Rendering Equation & Monte Carlo Path Tracing I

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

Global Illumination. Why Global Illumination. Pros/Cons and Applications. What s Global Illumination

Photon Mapping. Due: 3/24/05, 11:59 PM

Global Illumination. CSCI 420 Computer Graphics Lecture 18. BRDFs Raytracing and Radiosity Subsurface Scattering Photon Mapping [Ch

Lighting and Shading

Discussion. Smoothness of Indirect Lighting. History and Outline. Irradiance Calculation. Irradiance Caching. Advanced Computer Graphics (Spring 2013)

Monte Carlo Integration

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

Stochastic Path Tracing and Image-based lighting

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

Numerical Integration

Radiance. Radiance properties. Radiance properties. Computer Graphics (Fall 2008)

The Rendering Equation & Monte Carlo Ray Tracing

Monte Carlo Integration COS 323

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

Ray-Tracing. Misha Kazhdan

Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker

Final Project: Real-Time Global Illumination with Radiance Regression Functions

GAMES Webinar: Rendering Tutorial 2. Monte Carlo Methods. Shuang Zhao

A Brief Overview of. Global Illumination. Thomas Larsson, Afshin Ameri Mälardalen University

rendering equation computer graphics rendering equation 2009 fabio pellacini 1

The Rendering Equation Philip Dutré. Course 4. State of the Art in Monte Carlo Global Illumination Sunday, Full Day, 8:30 am - 5:30 pm

Raytracing. COSC 4328/5327 Scott A. King

CS 563 Advanced Topics in Computer Graphics Irradiance Caching and Particle Tracing. by Stephen Kazmierczak

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Shading Models. Welcome!

6. Illumination, Lighting

Lecture 10: Ray tracing

Announcement. Lighting and Photometric Stereo. Computer Vision I. Surface Reflectance Models. Lambertian (Diffuse) Surface.

Photon Mapping. Michael Doggett Department of Computer Science Lund university

TDA361/DIT220 Computer Graphics, January 15 th 2016

Spherical Harmonic Lighting: The Gritty Details Robin Green

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Ground Truth. Welcome!

Global Illumination and Monte Carlo

To Do. Advanced Computer Graphics. Course Outline. Course Outline. Illumination Models. Diffuse Interreflection

Illumination Algorithms

Radiometry & BRDFs CS295, Spring 2017 Shuang Zhao

Today. Anti-aliasing Surface Parametrization Soft Shadows Global Illumination. Exercise 2. Path Tracing Radiosity

COMPUTER GRAPHICS COURSE. LuxRender. Light Transport Foundations

Towards Interactive Global Illumination Effects via Sequential Monte Carlo Adaptation. Carson Brownlee Peter S. Shirley Steven G.

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

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

CS-184: Computer Graphics. Today. Lecture 22: Radiometry! James O Brien University of California, Berkeley! V2014-S

Photon Maps. The photon map stores the lighting information on points or photons in 3D space ( on /near 2D surfaces)

Anti-aliasing and Monte Carlo Path Tracing

CS Simple Raytracer for students new to Rendering

Shading and Illumination

Tentti/Exam Midterm 2/Välikoe 2, December

Physically Realistic Ray Tracing

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

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

Intro to Ray-Tracing & Ray-Surface Acceleration

CPSC / Texture Mapping

Realistic Image Synthesis

SOME THEORY BEHIND REAL-TIME RENDERING

Radiometry and reflectance

CS5620 Intro to Computer Graphics

Monte Carlo Ray-tracing and Rendering

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Global Illumination with Glossy Surfaces

Transcription:

Advanced Computer Graphics (Spring 2013) CS 283, Lecture 11: Monte Carlo Path Tracing Ravi Ramamoorthi http://inst.eecs.berkeley.edu/~cs283/sp13 Motivation General solution to rendering and global illumination Suitable for a variety of general scenes Based on Monte Carlo methods Enumerate all paths of light transport Acknowledgements and some slides: Szymon Rusinkiewicz and Pat Hanrahan Monte Carlo Path Tracing Monte Carlo Path Tracing Big diffuse light source, 20 minutes 1000 paths/pixel Jensen Jensen Monte Carlo Path Tracing Advantages Any type of geometry (procedural, curved,...) Any type of BRDF (specular, glossy, diffuse,...) Samples all types of paths (L(SD)*E) Accuracy controlled at pixel level Low memory consumption - error appears as noise in final image Disadvantages (standard Monte Carlo problems) Slow convergence (square root of number of samples) Noise in final image Monte Carlo Path Tracing Integrate radiance for each pixel by sampling paths randomly L o (x, w) = L e (x, w) + Ω Eye Pixel Specular Surface Diffuse Surface f r (x, w, w)li (x, w )( w n)d w x Light 1

Simple Monte Carlo Path Tracer Step 1: Choose a ray (u,v,θ,ϕ ) [per pixel]; assign weight = 1 Step 2: Trace ray to find intersection with nearest surface Step 3: Randomly choose between emitted and reflected light Step 3a: If emitted, return weight * Le Step 3b: If reflected, weight *= reflectance Generate ray in random direction Go to step 2 Sampling Techniques Problem: how do we generate random points/directions during path tracing and reduce variance? Importance sampling (e.g. by BRDF) Stratified sampling Eye x Surface Outline Motivation and Basic Idea Implementation of simple path tracer Variance Reduction: Importance sampling Other variance reduction methods Specific 2D sampling techniques Simplest Monte Carlo Path Tracer For each pixel, cast n samples and average Choose a ray with p=camera, d=(θ,ϕ ) within pixel Simplest Monte Carlo Path Tracer For each pixel, cast n samples and average over paths Choose a ray with p=camera, d=(θ,ϕ) within pixel Simplest Monte Carlo Path Tracer For each pixel, cast n samples and average Choose a ray with p=camera, d=(θ,ϕ ) within pixel Weight = 1/probability Remember: unbiased requires having f(x) / p(x) 2

Simplest Monte Carlo Path Tracer For each pixel, cast n samples and average Choose a ray with p=camera, d=(θ,ϕ) within pixel Path terminated when Emission evaluated Arnold Renderer (M. Fajardo) Works well diffuse surfaces, hemispherical light From CS 283(294) a few years ago Daniel Ritchie and Lita Cho Advantages and Drawbacks Advantage: general scenes, reflectance, so on By contrast, standard recursive ray tracing only mirrors This algorithm is unbiased, but horribly inefficient Sample emitted 50% of the time, even if emitted=0 Reflect rays in random directions, even if mirror If light source is small, rarely hit it Goal: improve efficiency without introducing bias Variance reduction using many of the methods discussed for Monte Carlo integration last week Subject of much interest in graphics in 90s till today Outline Motivation and Basic Idea Implementation of simple path tracer Variance Reduction: Importance sampling Other variance reduction methods Specific 2D sampling techniques 3

Importance Sampling Pick paths based on energy or expected contribution More samples for high-energy paths Don t pick low-energy paths At macro level, use to select between reflected vs emitted, or in casting more rays toward light sources At micro level, importance sample the BRDF to pick ray directions Tons of papers in 90s on tricks to reduce variance in Monte Carlo rendering Importance sampling now standard in production. I consulted on Pixar s system for upcoming movies Importance Sampling Can pick paths however we want, but contribution weighted by 1/probability Already seen this division of 1/prob in weights to emission, reflectance E(f(x)) x 1 x N f (x)dx = 1 N Y i Ω Y i = f (x i ) p(x i ) N i=1 Simplest Monte Carlo Path Tracer For each pixel, cast n samples and average Choose a ray with p=camera, d=(θ,ϕ) within pixel Importance sample Emit vs Reflect If Le = (0,0,0) then p emit = 0 else p emit = 0.9 (say) If random() < p emit then: return (1/ p emit ) * (Le red, Le green, Le blue ) Else Reflected: return (1/(1- p emit )) * f r (d è d ) * (n d ) * TracePath(p, d ) Importance sample Emit vs Reflect If Le = (0,0,0) then p emit = 0 else p emit = 0.9 (say) If random() < p emit then: Can never be 1 unless Reflectance is 0 return (1/ p emit ) * (Le red, Le green, Le blue ) Else Reflected: return (1/(1- p emit )) * f r (d è d ) * (n d ) * TracePath(p, d ) Outline Motivation and Basic Idea Implementation of simple path tracer Variance Reduction: Importance sampling Other variance reduction methods Specific 2D sampling techniques 4

More variance reduction Discussed macro importance sampling Emitted vs reflected How about micro importance sampling Shoot rays towards light sources in scene Distribute rays according to BRDF One Variation for Reflected Ray Pick a light source Trace a ray towards that light Trace a ray anywhere except for that light Rejection sampling Divide by probabilities 1/(solid angle of light) for ray to light source (1 the above) for non-light ray Extra factor of 2 because shooting 2 rays Russian Roulette Maintain current weight along path (need another parameter to TracePath) Terminate ray iff weight < const. Be sure to weight by 1/probability 5

RenderPark Heinrich Unfiltered Fixed Filtered Jensen Adaptive Ohbuchi Monte Carlo Path Tracing Image Jensen 2000 samples per pixel, 30 computers, 30 hours Jensen 6

Outline Motivation and Basic Idea Implementation of simple path tracer Variance Reduction: Importance sampling Other variance reduction methods Specific 2D sampling techniques 2D Sampling: Motivation Final step in sending reflected ray: sample 2D domain According to projected solid angle Or BRDF Or area on light source Or sampling of a triangle on geometry Etc. Sampling Upper Hemisphere Uniform directional sampling: how to generate random ray on a hemisphere? Option #1: rejection sampling Generate random numbers (x,y,z), with x,y,z in 1..1 If x 2 +y 2 +z 2 > 1, reject Normalize (x,y,z) If pointing into surface (ray dot n < 0), flip Sampling Upper Hemisphere Option #2: inversion method In polar coords, density must be proportional to sin θ (remember d(solid angle) = sin θ dθ dϕ) Integrate, invert è cos -1 So, recipe is Generate ϕ in 0..2π Generate z in 0..1 Let θ = cos -1 z (x,y,z) = (sin θ cos ϕ, sin θ sin ϕ, cos θ) BRDF Importance Sampling Better than uniform sampling: importance sampling Because you divide by probability, ideally probability proportional to f r * cos θ i 7

BRDF Importance Sampling For cosine-weighted Lambertian: Density = cos θ sin θ Integrate, invert è cos -1 (sqrt) So, recipe is: Generate ϕ in 0..2π Generate z in 0..1 Let θ = cos -1 (sqrt(z)) BRDF Importance Sampling Phong BRDF: f r ~ cos n α where α is angle between outgoing ray and ideal mirror direction Constant scale = k s (n+2)/(2π) Can t sample this times cos θ i Can only sample BRDF itself, then multiply by cos θ i That s OK still better than random sampling BRDF Importance Sampling Recipe for sampling specular term: Generate z in 0..1 Let α = cos -1 (z 1/(n+1) ) Generate ϕ α in 0..2π This gives direction w.r.t. ideal mirror direction Convert to (x,y,z), then rotate such that z points along mirror dir. Summary Monte Carlo methods robust and simple (at least until nitty gritty details) for global illumination Must handle many variance reduction methods in practice Importance sampling, Bidirectional path tracing, Russian roulette etc. Rich field with many papers, systems researched over last 10 years 8