Computer graphics III Path tracing. Jaroslav Křivánek, MFF UK

Similar documents
The Rendering Equation. Computer Graphics CMU /15-662

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

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

Choosing the Right Algorithm & Guiding

Bidirectional Path Tracing

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

Monte Carlo Path Tracing. The Rendering Equation

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

SOME THEORY BEHIND REAL-TIME RENDERING

INFOMAGR Advanced Graphics. Jacco Bikker - February April Welcome!

The Rendering Equation and Path Tracing

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

I present Adjoint-Driven Russian Roulette and Splitting for efficient light transport simulation which is a part of my PhD.

In the real world, light sources emit light particles, which travel in space, reflect at objects or scatter in volumetric media (potentially multiple

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

Realistic Image Synthesis

Assignment 3: Path tracing

Virtual Spherical Lights for Many-Light Rendering of Glossy Scenes

Lecture 7 - Path Tracing

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

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

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

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

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

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

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

Monte Carlo Path Tracing

Rendering Equation & Monte Carlo Path Tracing I

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

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

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

Global Illumination The Game of Light Transport. Jian Huang

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

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

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

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

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

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

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

13 Distribution Ray Tracing

MONTE-CARLO PATH TRACING

Lighting and Shading

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

COMPUTER GRAPHICS COURSE. LuxRender. Light Transport Foundations

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

Local vs. Global Illumination & Radiosity

Glossy Reflection. Objectives Modeling

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

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

Capturing light. Source: A. Efros

Biased Monte Carlo Ray Tracing

11/2/2010. In the last lecture. Monte-Carlo Ray Tracing : Path Tracing. Today. Shadow ray towards the light at each vertex. Path Tracing : algorithm

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

Global Illumination. COMP 575/770 Spring 2013

Monte Carlo Integration

Anti-aliasing and Monte Carlo Path Tracing

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

Recent Advances in Monte Carlo Offline Rendering

Importance Sampling of Area Lights in Participating Media

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

Volumetric Path Tracing

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

Monte Carlo Integration

Stochastic Path Tracing and Image-based lighting

Raytracing. COSC 4328/5327 Scott A. King

CS 5625 Lec 2: Shading Models

Illumination Algorithms

The Rendering Equation & Monte Carlo Ray Tracing

Numerical Integration

COMP371 COMPUTER GRAPHICS

CS5620 Intro to Computer Graphics

Representativity for Robust and Adaptive Multiple Importance Sampling

Photorealism: Ray Tracing

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

Ray Tracing: shading

Lecture 12: Photon Mapping. Biased Methods

Efficient Caustic Rendering with Lightweight Photon Mapping

Lecture 7: Monte Carlo Rendering. MC Advantages

Other approaches to obtaining 3D structure

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

Ray Tracing. CSCI 420 Computer Graphics Lecture 15. Ray Casting Shadow Rays Reflection and Transmission [Ch ]

Ambien Occlusion. Lighting: Ambient Light Sources. Lighting: Ambient Light Sources. Summary

Photon Mapping. Michael Doggett Department of Computer Science Lund university

REAL-TIME GPU PHOTON MAPPING. 1. Introduction

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

Path differentials and applications

Reducing the Number of Shadow Rays. in Bidirectional Path Tracing. Department of Computer Science, Katholieke Universiteit Leuven

Recall: Basic Ray Tracer

Global Illumination using Photon Maps

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

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

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

Indirect Illumination

Metropolis Light Transport

In this part of the course, I will discuss various approaches for generating VPLs where they are most needed for a given camera view.

An introduction to Global Illumination. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Photon Differentials

Bidirectional Lightcuts

CS-184: Computer Graphics. Today. Lecture #16: Global Illumination. Sunday, November 8, 2009

Monte Carlo Ray-tracing and Rendering

Transcription:

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 { w k := random direction through the pixel pixelcolor += getli(campos, w k ) } pixelcolor /= N; writepixel(pixelcolor); }

Path tracing, v. zero (recursive form) getli (x, ω): y = traceray(x, ω) return Le(y, ω) + Lr (y, ω) // emitted radiance // reflected radiance Lr(x, ω): ω = genuniformhemisphererandomdir( n(x) ) return 2p * brdf(x, ω, ω ) * dot(n(x), ω ) * getli(x, ω )

Path Tracing Loop version getli(x, w) { Color thrput = (1,1,1) Color accum = (0,0,0) while(1) { } hit = NearestIntersect(x, w) if no intersection return accum + thrput * bgradiance(x, w) if isonlightsource(hit) accum += thrput * Le(hit.pos, -w) ρ = reflectance(hit.pos, -w) if rand() < ρ // russian roulette survive (reflect) wi := SampleDir(hit) thrput *= fr(hit.pos, wi, -w) * dot(hit.n, wi) / (ρ * pdf(wi)) x := hit.pos w := wi else // absorb break; return accum; }

Terminating paths Russian roulette getli(x, w) { Color thrput = (1,1,1) Color accum = (0,0,0) while(1) { } hit = NearestIntersect(x, w) if no intersection return accum + thrput * bgradiance(x, w) if isonlightsource(hit) accum += thrput * Le(hit.pos, -w) ρ = reflectance(hit.pos, -w) if rand() < ρ // russian roulette survive (reflect) wi := SampleDir(hit) thrput *= fr(hit.pos, wi, -w) * dot(hit.n, wi) / (ρ * pdf(wi)) x := hit.pos w := wi else // absorb break; return accum; }

Terminating paths Russian roulette Continue the path with probability q Multiply weight (throughput) of surviving paths by 1 / q Y / q if q Z 0 otherwise RR is unbiased! E[ Y] 1 E[ Z] q 0 E[ Y] q q 1

Survival probability 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: 1. First sample a random direction w i according to p(w i ) 2. Use the sampled w i it to calculate the survival probability as q survival min 1, f r ( w i wo)cos i p( wi )

Direction sampling getli(x, w) { Color thrput = (1,1,1) Color accum = (0,0,0) while(1) { } hit = NearestIntersect(x, w) if no intersection return accum + thrput * bgradiance(x, w) if isonlightsource(hit) accum += thrput * Le(hit.pos, -w) ρ = reflectance(hit.pos, -w) if rand() < ρ // russian roulette survive (reflect) wi := SampleDir(hit) thrput *= fr(hit.pos, wi, -w) * dot(hit.n, wi) / (ρ * pdf(wi)) x := hit.pos w := wi else // absorb break; return accum; }

Direction sampling We usually sample the direction w i from a pdf similar to f r (w i, w o ) cos i Ideally, we would want to sample proportionally to the integrand itself L i (w i ) f r (w i, w o ) cos i, but this is difficult, because we do not know L i upfront. With some precomputation, it is possible to use a rough estimate of L i for sampling [Jensen 95, Vorba et al. 2014], cf. guiding.

No incoming radiance information [Vorba et al. 2014] Bidirectional path tracing (1h)

Guiding by incoming radiance [Vorba et al. 2014] Guided bidirectional path tracing (1h)

BRDF importance sampling Let s see what happens when the pdf is exactly proportional to f r (w i, w o ) cos i? Normalization (recall that a pdf must integrate to 1) ) ( i i o i i o i d cos ) ( cos ) ( x H r r f f w w w w w i o i i cos ) ( ) ( w w w r f p ) ( i w p The normalization factor is nothing but the reflectance r

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 p( wi ) f r ( wi wo) cos i r Physicists and nuclear engineers call this the analog simulation, because this is how real particles behave.

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 1. BRDF-proportional sampling 2. Light source area sampling Image: Alexander Wilkie

Images: Eric Veach Direct illumination: Two strategies BRDF proportional sampling Light source area sampling

Image: Alexander Wilkie Direct illumination calculation using MIS Sampling technique (pdf) p 1 : BRDF sampling Sampling technique (pdf) p 2 : Light source area sampling

Image: Alexander Wilkie Combination Arithmetic average Preserves bad properties of both techniques Balance heuristic Bingo!!!

MIS weight calculation Sample weight for BRDF sampling w 1 ( w j ) p 1 p 1 w j w p w j 2 j PDF for BRDF sampling PDF with which the direction w j would have been generated, if we used light source area sampling

PDFs BRDF sampling: p 1 (w) Depends on the BRDF, e.g. for a Lambertian BRDF: p 1 ( w) cos x p Light source area sampling: p 2 (w) p 2 ( w) 1 A x y cos y 2 Conversion of the uniform pdf 1/ A from the area measure (da) to the solid angle measure (dw)

Where is the conversion factor coming from? Pdfs (unlike ordinary function) change under a change of coordinates. In general, it must always hold: p ( w) dw p( y) da And so p ( w) p( y) da dw conversion factor

The use of MIS in a path tracer For each path vertex: Generate an explicit shadow ray for the techniques p 2 (light source area sampling) Secondary ray for technique p 1 (BRDF sampling) One ray can be shared for the calculation of both direct and indirect illumination But the MIS weight is of curse applied only on the direct term (indirect illumination is added unweighted because there is no second technique to calculate it)

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 (with prob proportional to power) 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.