Computer graphics III – Path tracing

Slides:



Advertisements
Similar presentations
Insu Yu (Research Fellow) James Tompkin (Research Engineer & T.A.) ( me with questions)
Advertisements

Real-time Shading with Filtered Importance Sampling
PATH INTEGRAL FORMULATION OF LIGHT TRANSPORT Jaroslav Křivánek Charles University in Prague
Many-light methods – Clamping & compensation
Photorealistic Rendering. Ray tracing v. photorealistic rendering What illumination effects are not captured by ray tracing? What illumination effects.
Rendering with Environment Maps Jaroslav Křivánek, KSVI, MFF UK
Advanced Computer Graphics (Spring 2005) COMS 4162, Lectures 18, 19: Monte Carlo Integration Ravi Ramamoorthi Acknowledgements.
Photon Tracing with Arbitrary Materials Patrick Yau.
Advanced Computer Graphics (Fall 2009) CS 294, Rendering Lecture 5: Monte Carlo Path Tracing Ravi Ramamoorthi
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 20: Monte Carlo Path Tracing Ravi Ramamoorthi Acknowledgements.
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Stochastic Path Tracing Algorithms K. H. Ko School of Mechatronics Gwangju.
© Machiraju/Möller Rendering Equation Unbiased MC Methods CMPT 461/770 Advanced Computer Graphics Torsten Möller.
Presentation by Dr. David Cline Oklahoma State University
Selected Topics in Global Illumination Computation Jaroslav Křivánek Charles University, Prague
02/25/05© 2005 University of Wisconsin Last Time Meshing Volume Scattering Radiometry (Adsorption and Emission)
-Global Illumination Techniques
Computer graphics & visualization Photon Mapping.
Computer Graphics Global Illumination: Photon Mapping, Participating Media Lecture 12 Taku Komura.
Path Integral Formulation of Light Transport
Improved VPL Distribution Jaroslav Křivánek Charles University in Prague (Optimizing) Realistic Rendering with Many-Light Methods (part of the “Handling.
Charles University in Prague
Real-Time High Quality Rendering
Monte-Carlo Ray Tracing and
02/12/03© 2003 University of Wisconsin Last Time Intro to Monte-Carlo methods Probability.
Computer Graphics III – Monte Carlo integration Direct illumination
Bidirectional Path Sampling Techniques
Jaroslav Křivánek, MFF UK
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Stochastic Path Tracing Algorithms K. H. Ko School of Mechatronics Gwangju.
Computer Graphics III Winter Term 2015 Organization Jaroslav Křivánek, MFF UK
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
Global Illumination (3) Photon Mapping (1). Overview Light Transport Notation Path Tracing Photon Mapping –Photon Tracing –The Photon Map.
Global Illumination (3) Path Tracing. Overview Light Transport Notation Path Tracing Photon Mapping.
02/9/05© 2005 University of Wisconsin Last Time Lights Next assignment – Implement Kubelka-Munk as a BSDF.
PATH INTEGRAL FORMULATION OF LIGHT TRANSPORT Jaroslav Křivánek Charles University in Prague
Distributed Ray Tracing. Can you get this with ray tracing?
Computer graphics III – Low-discrepancy sequences and quasi-Monte Carlo methods Jaroslav Křivánek, MFF UK
Computer graphics III – Multiple Importance Sampling Jaroslav Křivánek, MFF UK
Computer graphics III – Rendering equation and its solution
Computer graphics III – Path tracing Jaroslav Křivánek, MFF UK
Lesson 8: Basic Monte Carlo integration

Shading Revisited Some applications are intended to produce pictures that look photorealistic, or close to it The image should look like a photograph A.
Computer Graphics III Winter Term 2017 Organization
Sampling and Reconstruction of Visual Appearance
Ray Tracing via Markov Chain Monte-Carlo Method
3D Graphics Rendering PPT By Ricardo Veguilla.
© University of Wisconsin, CS559 Fall 2004
© 2005 University of Wisconsin
Simple and Robust Iterative Importance Sampling of Virtual Point Lights Iliyan Georgiev Philipp Slusallek.
Radiative Transfer & Volume Path Tracing
Path Tracing (some material from University of Wisconsin)
Homework #3 Environment Lights
Chapter XVI Texturing toward Global Illumination
Virtual Spherical Lights for Many-Light Rendering of Glossy Scenes
Computer Graphics III Monte Carlo estimators – Exercises
Efficient Importance Sampling Techniques for the Photon Map
Monte Carlo Path Tracing
Monte Carlo Rendering Central theme is sampling:
Bidirectional Path Sampling Techniques
CS5500 Computer Graphics May 29, 2006
Jaroslav Křivánek, MFF UK
Metropolis Light Transit
Jaroslav Křivánek, MFF UK
Jaroslav Křivánek, MFF UK
Lesson 4: Application to transport distributions
Monte Carlo Path Tracing and Caching Illumination
Monte Carlo Integration
open research problems
Photon Density Estimation using Multiple Importance Sampling
Presentation transcript:

Computer graphics III – Path tracing Jaroslav Křivánek, MFF UK Jaroslav.Krivanek@mff.cuni.cz

Tracing paths from the camera renderImage() { for all pixels Color pixelColor = (0,0,0); for k = 1 to N wk := random direction through the pixel pixelColor += getLi(camPos, wk) } pixelColor /= N; writePixel(pixelColor); CG III (NPGR010) - J. Křivánek

Path tracing, v. 0.1 (recursive form) getLi (x, ω): y = nearestIntersect (x, ω) return getLe(y, –ω) + // emitted radiance getLr (y, –ω) // reflected radiance getLr(x, ωinc): [ωgen, pdfgen] = genRndDirBrdfIs(ωinc, normal(x) ) 1/pdfgen * getLi(x, ωgen) * brdf(x, ωinc, ωgen) * dot(normal(x), ωgen) CG III (NPGR010) - J. Křivánek

Path Tracing – Loop version getLi(x, wo) { Spectrum throughput = (1,1,1) Spectrum accum = (0,0,0) while(1) hit = nearestIntersect(x, wo) if no intersection return accum + throughput * bgRadiance(x, wo) if isOnLightSource(hit) accum += thrput * getLe(hit.pos, -wo) [wi, pdf(wi)] := SampleDir(hit) Spectrum tputUpdate = 1/pdf(wi) * fr(hit.pos, wi, -wo) * dot(hit.n, wi) survivalProb = min(1, tputUpdate.maxComponent) if rand() < survivalProb // russian roulette – survive (reflect) thrput *= tputUpdate / survivalProb x := hit.pos wo := wi else // terminate path break; } return accum; CG III (NPGR010) - J. Křivánek

Path termination – Russian roulette getLi(x, wo) { Spectrum throughput = (1,1,1) Spectrum accum = (0,0,0) while(1) hit = nearestIntersect(x, wo) if no intersection return accum + throughput * bgRadiance(x, wo) if isOnLightSource(hit) accum += thrput * getLe(hit.pos, -wo) [wi, pdf(wi)] := SampleDir(hit) Spectrum tputUpdate = 1/pdf(wi) * fr(hit.pos, wi, -wo) * dot(hit.n, wi) survivalProb = min(1, tputUpdate.maxComponent) if rand() < survivalProb // russian roulette – survive (reflect) thrput *= tputUpdate / survivalProb x := hit.pos wo := wi else // terminate path break; } return accum; CG III (NPGR010) - J. Křivánek

Terminating paths – Russian roulette Continue the path with probability q Multiply weight (throughput) of surviving paths by 1 / q RR is unbiased! CG III (NPGR010) - J. Křivánek

Survival probability – How to set it? It makes sense to use the surface reflectivity r as the survival probability If the surface reflects only 30% of energy, we continue with the probability of 30%. That’s in line with what happens in reality. What if we cannot calculate r? Then there’s a convenient alternative, which in fact works even better: First sample a random direction wi according to p(wi) Use the sampled wi it to calculate the survival probability as CG III (NPGR010) - J. Křivánek

Adjoint-drive RR and splitting Vorba and Křivánek. Adjoint-Driven Russian Roulette and Splitting in Light Transport Simulation. ACM SIGGRAPH 2016 CG III (NPGR010) - J. Křivánek

CG III (NPGR010) - J. Křivánek Direction sampling getLi(x, wo) { Spectrum throughput = (1,1,1) Spectrum accum = (0,0,0) while(1) hit = nearestIntersect(x, wo) if no intersection return accum + throughput * bgRadiance(x, wo) if isOnLightSource(hit) accum += thrput * getLe(hit.pos, -wo) [wi, pdf(wi)] := SampleDir(hit) Spectrum tputUpdate = 1/pdf(wi) * fr(hit.pos, wi, -wo) * dot(hit.n, wi) survivalProb = min(1, tputUpdate.maxComponent) if rand() < survivalProb // russian roulette – survive (reflect) thrput *= tputUpdate / survivalProb x := hit.pos wo := wi else // terminate path break; } return accum; CG III (NPGR010) - J. Křivánek

CG III (NPGR010) - J. Křivánek Direction sampling We usually sample the direction wi from a pdf similar to fr(wi, wo) cos qi Ideally, we would want to sample proportionally to the integrand itself Li(wi) fr(wi, wo) cos qi, but this is difficult, because we do not know Li upfront. With some precomputation, it is possible to use a rough estimate of Li for sampling [Jensen 95, Vorba et al. 2014], cf. “guiding”. CG III (NPGR010) - J. Křivánek

BRDF importance sampling Let’s see what happens when the pdf is exactly proportional to fr(wi, wo) cos qi ? Normalization (recall that a pdf must integrate to 1) The normalization factor is nothing but the reflectance r CG III (NPGR010) - J. Křivánek

CG III (NPGR010) - J. Křivánek BRDF IS in a path tracer Throughput update for a general pdf ... thrput *= fr(.) * dot(.) / ( ρ * p(wi) ) A pdf that is exactly proportional to BRDF * cos keeps the throughput constant because the different terms cancel out! thrput *= 1 Physicists and nuclear engineers call this the “analog” simulation, because this is how real particles behave. CG III (NPGR010) - J. Křivánek

CG III (NPGR010) - J. Křivánek Path guiding Vorba, Karlík, Šik, Ritschel, and Křivánek.  On-line Learning of Parametric Mixture Models for Light Transport Simulation.  ACM SIGGRAPH 2014 CG III (NPGR010) - J. Křivánek

CG III (NPGR010) - J. Křivánek Path guiding Vorba, Karlík, Šik, Ritschel, and Křivánek.  On-line Learning of Parametric Mixture Models for Light Transport Simulation.  ACM SIGGRAPH 2014 CG III (NPGR010) - J. Křivánek

Direct illumination calculation in a path tracer

Direct illumination: Two strategies At each path vertex x, we are calculating direct illumination i.e. radiance reflected from a point x on a surface exclusively due to the light coming directly from the sources Two sampling strategies BRDF-proportional sampling Light source area sampling Image: Alexander Wilkie CG III (NPGR010) - J. Křivánek

The use of MIS in a path tracer For each path vertex: Generate an explicit shadow ray for the techniques pb (light source area sampling – a.k.a. “next event estimation”) Secondary ray for technique pa (BRDF sampling) One ray can be shared for the calculation of both direct and indirect illumination But the MIS weight is – of course – applied only on the direct term (indirect illumination is added unweighted because there is no second technique to calculate it) CG III (NPGR010) - J. Křivánek

Dealing with multiple light sources Option 1: Loop over all sources and send a shadow ray to each one Option 2: Choose one source at random (ideally with prob proportional to light contribution) Sample illumination only on the chosen light, divide the result by the prob of picking that light (Scales better with many sources but has higher variance per path) Beware: The probability of choosing a light influences the sampling pds and therefore also the MIS weights. CG III (NPGR010) - J. Křivánek

Learning the lights’ contributions Before (no learning) Vévoda, Kondapaneni, Křivánek. Bayesian online regression for adaptive direct illumination sampling. ACM SIGGRAPH 2018 CG III (NPGR010) - J. Křivánek

Learning the lights’ contributions After (with learning) Vévoda, Kondapaneni, Křivánek. Bayesian online regression for adaptive direct illumination sampling. ACM SIGGRAPH 2018 CG III (NPGR010) - J. Křivánek