Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ......

112
Počítačová grafika III Všehochuť Jaroslav Křivánek, MFF UK [email protected]

Transcript of Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ......

Page 1: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Počítačová grafika III – Všehochuť

Jaroslav Křivánek, MFF UK [email protected]

Page 2: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

“Science, it works … (bitches!)” Quote from Richard Dawkins

http://www.youtube.com/watch?v=n6hxo1sC-dU

PG III (NPGR010) - J. Křivánek 2013 2

Page 3: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

… and so does path tracing!

PG III (NPGR010) - J. Křivánek 2013 3

Jerome White

Page 4: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Path Tracing funguje!

PG III (NPGR010) - J. Křivánek 2013 4

Martin Geupel (DeadClown)

Page 5: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Path Tracing funguje!

PG III (NPGR010) - J. Křivánek 2013 5

Chakib Rabia

Page 6: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

PG III (NPGR010) - J. Křivánek 2013 6 Ondra Karlík

Page 7: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Light transport – Global illumination

© Duncan Howdin

Archviz Movies

Image courtesy of Columbia Pictures. © 2006 Columbia Pictures Industries, Inc.

7 PG III (NPGR010) - J. Křivánek 2013

Page 8: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Light transport – Global illumination

Movies

2002, Shrek 2 (PDI/Dreamworks) 1 bounce indirect

Image courtesy of Columbia Pictures. © 2006 Columbia Pictures Industries, Inc.

2006, Monster House (Sony Imageworks) Full light transport

(path traced) Arnold renderer

8 PG III (NPGR010) - J. Křivánek 2013

Page 9: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Full light transport simulation Accuracy Ease of use Visual consistency

Light transport – Global illumination

Movies

Image courtesy of Columbia Pictures. © 2006 Columbia Pictures Industries, Inc.

2006, Monster House (Sony Imageworks) Full light transport

(path traced) Arnold renderer

9 PG III (NPGR010) - J. Křivánek 2013

Page 10: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Full light transport simulation Accuracy Ease of use Visual consistency

Light transport – Global illumination

More information

“The State of Rendering”

10 PG III (NPGR010) - J. Křivánek 2013

Page 11: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Quasi Monte Carlo Metody

Page 12: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Metody Quasi Monte Carlo (QMC)

Použití striktně deterministických sekvencí místo náhodných čísel

Vše funguje jako v MC, důkazy se ale nemohou opírat o teorii pravděpodobnosti (nic není náhodné)

Použité sekvence čísel s nízkou dikrepancí (low-discrepancy sequences)

PG III (NPGR010) - J. Křivánek 2013 12

Page 13: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Diskrepance

Low Discrepancy (more uniform)

High Discrepancy (clusters of points)

PG III (NPGR010) - J. Křivánek 2013 13

Page 14: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Defining discrepancy

s-dimensional “brick” function:

True volume of the “brick” function:

MC estimate of the volume of the “brick”:

total number of sample points number of sample points that actually fell inside the “brick”

PG III (NPGR010) - J. Křivánek 2013 14

Page 15: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Discrepancy

Discrepancy (of a point sequence) is the maximum possible error of the MC quadrature of the “brick” function over all possible brick shapes: serves as a measure of the uniformity of a point set must converge to zero as N -> infty the lower the better (cf. Koksma-Hlawka Inequality)

PG III (NPGR010) - J. Křivánek 2013 15

Page 16: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Koksma-Hlawka inequality

Koksma-Hlawka inequality

the KH inequality only applies to f with finite variation QMC can still be applied even if the variation of f is infinite

„variation“ of f

PG III (NPGR010) - J. Křivánek 2013 16

Page 17: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Van der Corput Sequence (base 2)

point placed in the middle of the interval then the interval is divided in half has low-discrepancy

Table credit: Laszlo Szirmay-Kalos PG III (NPGR010) - J. Křivánek 2013 17

Page 18: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Van der Corput Sequence

b ... base, must be relative prime (2,3,5,7,....)

radical inverse

PG III (NPGR010) - J. Křivánek 2013 18

Page 19: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Van der Corput Sequence (base b)

double RadicalInverse(const int Base, int i) { double Digit, Radical, Inverse; Digit = Radical = 1.0 / (double) Base; Inverse = 0.0; while(i) { Inverse += Digit * (double) (i % Base); Digit *= Radical; i /= Base; } return Inverse; }

PG III (NPGR010) - J. Křivánek 2013 19

Page 20: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Radical inversion based points in higher dimension

Image credit: Alexander Keller PG III (NPGR010) - J. Křivánek 2013 20

Page 21: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Použité pro path tracing

Cesty jsou body ve vysokodimenzionálním prostoru

Veškerá náhodná čísla použitá pro konstrukci jedné cestu jsou různé komponenty jednoho dlouhého „náhodného vektoru“

Další cesta – další náhodný vektor ve vysokodimenzionálním prostoru.

Pokud náhodné vektory dobře pokrývají vysokodimenzionální prostor, pak cesty dobře pokrývají celý prostor cest ve scéně

PG III (NPGR010) - J. Křivánek 2013 21

Page 22: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Transformace náhodných čísel

Image credit: Alexander Keller PG III (NPGR010) - J. Křivánek 2013 22

Page 23: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Ukázka výsledků pro MC a QMC

Image credit: Alexander Keller PG III (NPGR010) - J. Křivánek 2013 23

Page 24: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Metody Quasi Monte Carlo (QMC)

Nevýhody QMC:

V obrázku mohou vzniknout viditelné „vzory“ (místo šumu v MC)

PG III (NPGR010) - J. Křivánek 2013 24

Page 25: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Stratified sampling

Hen

rik

Wan

n Je

nsen

10 cest na pixel

PG III (NPGR010) - J. Křivánek 2013 25

Page 26: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Quasi-Monte Carlo

Hen

rik

Wan

n Je

nsen

10 cest na pixel

PG III (NPGR010) - J. Křivánek 2013 26

Page 27: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Fixní náhodná sekvence

Hen

rik

Wan

n Je

nsen

10 cest na pixel

PG III (NPGR010) - J. Křivánek 2013 27

Page 28: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Měřicí rovnice

Page 29: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Měřicí rovnice

Zobrazovací rovnice Podmínky pro radianci v rovnovážném stavu Umožňuje výpočet radiance v izolovaných bodech

Ve skutečnosti nás zajímá průměrná radiance přes pixel: integrál

Měřicí rovnice (Measurement equation)

PG III (NPGR010) - J. Křivánek 2013 29

Page 30: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Měřicí rovnice

PG III (NPGR010) - J. Křivánek 2013 30

ALWIM H

ddcos),(),()(

ie∫ ∫ ⋅⋅=x

xx ωθωω

odezva virtuálního (lineárního) senzoru na radianci (barva pixelu)

přes celou plochu scény a všechny směry (virtuální senzory musí být součástí scény, nenulový příspěvek pouze na ploše senzoru kvůli We)

relativní odezva senzoru (váha) různé We pro každý senzor (pixel)

Page 31: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Příklad: Zářivý tok přes oblast jako měřicí rovnice

Dána oblast S (podmnožina povrchu scény a příslušných směrů)

Pro We definované je výsledkem měřicí rovnice zářivý tok Φ(S).

PG III (NPGR010) - J. Křivánek 2013 31

HMS ×⊂

=jinak0

),(pro1),(

SxxWe

ωω

Page 32: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Měřicí rovnice jako skalární součin funkcí

Definujeme skalární součin funkcí f a g:

Měřicí rovnice

PG III (NPGR010) - J. Křivánek 2013 32

AgfgfM H

ddcos),(),(,)(

∫ ∫ ⋅⋅=x

xx ωθωω

ie , LWI =

Page 33: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Propagace radiance a důležitosti

PG III (NPGR010) - J. Křivánek 2013 33

L (radiance) W (důležitost)

Page 34: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Důležitost (importance)

We popisuje, jak důležitá je příchozí radiance pro odezvu senzoru

1 krok do scény: Příchozí radiance na senzoru = odchozí radiance z bodů scény

2, 3, … kroky do scény: …

We interpretujeme jako veličinu emitovanou ze senzorů (stejně jako je radiance Le emitovaná ze zdrojů světla)

Takto interpretovanou veličinu We nazýváme

emitovanou funkcí důležitosti (emitted importance function, emitted potential function)

PG III (NPGR010) - J. Křivánek 2013 34

Page 35: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Přenos důležitosti

Funkce důležitosti se přenáší podobně jako radiance a dosahuje ustáleného stavu popsaného ustálenou funkcí důležitosti W:

PG III (NPGR010) - J. Křivánek 2013 35

∫ ⋅→⋅−+

=

)(iiioii

oeo

dcos),()),,(r(

),(),(

x

xx

xx

HrfW

WW

ωθωωωω

ωω

Jako zobrazovací rovnice, s tím rozdílem, že argumenty BRDF jsou přehozeny (pro odraz identické, nikoli však pro lom)

Page 36: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Dualita důležitosti a radiance

PG III (NPGR010) - J. Křivánek 2013 36

e

ie

,

,

LW

LWI

i=

=

emitovaná importance ustálená

příchozí radiance

ustálená příchozí importance

emitovaná radiance

Page 37: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Dualita důležitosti a radiance

V dané scéně je pouze jediná emitovaná a ustálená funkce radiance

Ale každý pixel má jinou emitovanou a ustálenou funkci důležitosti

PG III (NPGR010) - J. Křivánek 2013 37

Page 38: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Dualita v praxi: Sledování světla

Sledování cest (path tracing) Rekurzivně řeší zobrazovací rovnici

Sledování světla (light tracing)

Rekurzivně řeší rovnici přenosu důležitosti Cesty začínají na zdrojích světla Mohou náhodně zasáhnout senzor Nebo explicitní napojení na senzor (jako přímé osvětlení v

PT) Pozor: argumenty BRDF musí být obráceny (cestu

sledujeme z druhé strany, BRDF je pořád stejně oprientovaná)

PG III (NPGR010) - J. Křivánek 2013 38

Page 39: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Sledování světla (light tracing) v praxi

PG III (NPGR010) - J. Křivánek 2013 39

Imag

e: D

utre

et a

l. A

dvan

ced

Glo

bal I

llum

inat

ion

Page 40: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Sledování světla (light tracing) v praxi

Obvykle menší účinnost než PT (ale např. v opt. akt. médiu blízko světla mnohem lepší)

Mnohem účinnější pro některé světelné efekty (kaustiky)

Základ obousměrných metod: Obousměrné sledování cest (bidirectional path tracing, BPT) photon mapping, etc.

PG III (NPGR010) - J. Křivánek 2013 40

Page 41: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Porovnání algoritmů

PG III (NPGR010) - J. Křivánek 2013 41

© F. Suykens

Path tracing Light tracing Bidirectional path tracing

Kvíz: Proč je skleněná koule černá?

Page 42: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Pokročilé metody simulace transportu světla

Page 43: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Issues in light transport simulation

Robustness

None of the existing algorithms works for all scenes

Robust estimation “An estimation technique which is insensitive to small

departures from the idealized assumptions which have been used to optimize the algorithm.”

43 PG III (NPGR010) - J. Křivánek 2013

Page 44: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Obousměrné sledování cest (BPT) vs. (Jednosměrné) sledování cest (PT)

BPT, 25 vzorků (cest) na pixel PT, 56 vzorků (cest) na pixel

Imag

e: E

ric

Vea

ch

PG III (NPGR010) - J. Křivánek 2013 44

Page 45: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Přenos světla jako integrál přes prostor cest

Page 46: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Light transport

Geometric optics

emit

travel

absorb scatter

46 PG III (NPGR010) - J. Křivánek 2013

Page 47: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Light transport

emit

travel

absorb scatter

light transport path

47 PG III (NPGR010) - J. Křivánek 2013

Page 48: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Light transport

Camera response all paths hitting

the sensor

48 PG III (NPGR010) - J. Křivánek 2013

Page 49: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Path integral formulation

49

[Veach and Guibas 1995] [Veach 1997]

PG III (NPGR010) - J. Křivánek 2013

Page 50: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Measurement contribution function

sensor sensitivity (“emitted importance”)

path throughput

emitted radiance

50 PG III (NPGR010) - J. Křivánek 2013

Page 51: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Geometry term

51 PG III (NPGR010) - J. Křivánek 2013

Page 52: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Path integral formulation

?

52 PG III (NPGR010) - J. Křivánek 2013

Page 53: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Path integral formulation

all path lengths

all possible vertex positions

53 PG III (NPGR010) - J. Křivánek 2013

Page 54: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Path integral

54 PG III (NPGR010) - J. Křivánek 2013

Page 55: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Rendering : Evaluating the path integral

Page 56: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Path integral

Monte Carlo integration

56 PG III (NPGR010) - J. Křivánek 2013

Page 57: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Monte Carlo integration

General approach to numerical evaluation of integrals

x1

f(x)

0 1

p(x)

x2 x3 x4 x5 x6

Integral:

Monte Carlo estimate of I:

Correct „on average“:

57 PG III (NPGR010) - J. Křivánek 2013

Page 58: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

MC evaluation of the path integral

Sample path from some distribution with PDF

Evaluate the probability density

Evaluate the integrand

? ?

Path integral MC estimator

58 PG III (NPGR010) - J. Křivánek 2013

Page 59: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Algorithms = different path sampling techniques

Path sampling

59 PG III (NPGR010) - J. Křivánek 2013

Page 60: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Algorithms = different path sampling techniques

Path tracing

Path sampling

60 PG III (NPGR010) - J. Křivánek 2013

Page 61: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Algorithms = different path sampling techniques

Light tracing

Path sampling

61 PG III (NPGR010) - J. Křivánek 2013

Page 62: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Algorithms = different path sampling techniques

Same general form of estimator

No importance transport, no adjoint equations!!!

Path sampling

63 PG III (NPGR010) - J. Křivánek 2013

Page 63: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Path sampling & Path PDF

Page 64: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Local path sampling

Sample one path vertex at a time 1. From an a priori distribution

lights, camera sensors

2. Sample direction from an existing vertex

3. Connect sub-paths test visibility between vertices

PG III (NPGR010) - J. Křivánek 2013 65

Page 65: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Example – Path tracing

1. A priori distrib. 2. Direction sampling 3. Connect vertices

1.

2.

1.

3. 2.

2.

66 PG III (NPGR010) - J. Křivánek 2013

Page 66: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Use of local path sampling

Path tracing Light tracing Bidirectional path tracing

67 PG III (NPGR010) - J. Křivánek 2013

Page 67: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Probability density function (PDF)

path PDF

joint PDF of path vertices

68 PG III (NPGR010) - J. Křivánek 2013

Page 68: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Probability density function (PDF)

path PDF

joint PDF of path vertices

69 PG III (NPGR010) - J. Křivánek 2013

Page 69: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Probability density function (PDF)

path PDF

joint PDF of path vertices product of (conditional) vertex PDFs

Path tracing example:

70 PG III (NPGR010) - J. Křivánek 2013

Page 70: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Probability density function (PDF)

path PDF

joint PDF of path vertices product of (conditional) vertex PDFs

Path tracing example:

71 PG III (NPGR010) - J. Křivánek 2013

Page 71: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Vertex sampling

Importance sampling principle 1. Sample from an a priori distrib.

2. Sample direction from an existing vertex

3. Connect sub-paths

BRDF lobe sampling

emission sampling

high thruput connections

PG III (NPGR010) - J. Křivánek 2013 72

Page 72: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

BRDF lobe sampling

Vertex sampling

Sample direction from an existing vertex

73 PG III (NPGR010) - J. Křivánek 2013

Page 73: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Measure conversion BRDF lobe sampling

Sample direction from an existing vertex

74 PG III (NPGR010) - J. Křivánek 2013

Page 74: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Summary

Path integral MC estimator

75 PG III (NPGR010) - J. Křivánek 2013

Page 75: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Summary

Algorithms

different path sampling techniques

different path PDF

76 PG III (NPGR010) - J. Křivánek 2013

Page 76: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Odvození integrálu přes prostor cest ze zobrazovací a měřicí rovnice

Page 77: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Eliminace směrů (pouze body na ploše)

Tříbodová formulace přenosu světla

i'θ

),()( ωxxx LL ≡′→

),()( oi ωω →′≡′′→′→ xxxx rr ffPG III (NPGR010) - J. Křivánek 2013 78

Page 78: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Zobrazovací rovnice v 3b formulaci

∫ ′↔⋅′′→′→⋅′→+

+′′→′=′′→′

M r dAGfL

LL

xxxxxxxx

xxxx

)()()(

)()( e

2

coscos)()(

xxxxxx

′−

′′↔=′↔ ioVG

θθ

i'θ

PG III (NPGR010) - J. Křivánek 2013 79

Page 79: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Měřicí rovnice v 3b formulaci

Důležitost emitovaná z x’ do x (Značení: šipka = směr šíření světla, nikoli důležitosti)

x’ ... na senzoru x … na ploše scnény

∫ × ′′↔⋅′→⋅′→=MMj AAGLWI xxxxxxxx dd)()()((j)

e

PG III (NPGR010) - J. Křivánek 2013 80

Page 80: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Odvození integrálu přes prostor cest

Do měřicí rovnice v 3b formulaci se dosadí Neumannova expanze ZR v 3b formulaci, vypadne suma integrálů.

Integrand je funkcí příspěvku (contribution function).

PG III (NPGR010) - J. Křivánek 2013 81

Page 81: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

“Path integral” – A historical remark

This course [Veach and Guibas 1995], [Veach 1997]

Easily derived form the rendering equation [Veach 1997]

Feynman path integral formulation of quantum

mechanics [Feynman and Hibbs 65]

Homogeneous materials [Tessendorf 89, 91, 92]

Rendering [Premože et al. 03, 04]

82

Course: Recent Advances in Light Transport

Simulation Jaroslav Křivánek – Bidirectional Path Sampling

Techniques

Page 82: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Obousměrné sledování cest (Bidirectional path tracing)

Page 83: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Bidirectional path sampling

Algorithms = different path sampling techniques

Path tracing Light tracing Bidirectional path tracing

84 PG III (NPGR010) - J. Křivánek 2013

Page 84: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

One bidirectional path sampling technique

sample light sub-path sample camera sub-path sub-path connection

85 PG III (NPGR010) - J. Křivánek 2013

Page 85: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

One bidirectional path sampling technique

The usual path integral estimator

connection terms 86 PG III (NPGR010) - J. Křivánek 2013

Page 86: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Digression

Sample direction from an existing vertex

87 PG III (NPGR010) - J. Křivánek 2013

Page 87: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

One bidirectional path sampling technique

The usual estimator

Connection term

88 PG III (NPGR010) - J. Křivánek 2013

Page 88: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

All possible bidirectional techniques vertex on a light sub-path vertex on en eye subpath

89

path tracing

light tracing

VPLs

PG III (NPGR010) - J. Křivánek 2013

Page 89: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

All possible bidirectional techniques vertex on a light sub-path vertex on en eye subpath

90

path tracing

light tracing

VPLs

no single technique importance samples all the terms

PG III (NPGR010) - J. Křivánek 2013

Page 90: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Multiple Importance Sampling (MIS)

f(x)

pa(x) pb(x)

[Veach & Guibas, 95]

91

Combined estimator:

xa PG III (NPGR010) - J. Křivánek 2013

Page 91: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Multiple Importance Sampling (MIS)

High MIS weight Low MIS weight

Singularity cancelled

92 PG III (NPGR010) - J. Křivánek 2013

Page 92: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Bidirectional path tracing

Use all of the above sampling techniques

Combine using Multiple Importance Sampling

93 PG III (NPGR010) - J. Křivánek 2013

Page 93: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Vzorkovací strategie

PG III (NPGR010) - J. Křivánek 2013 94

Imag

e: D

utre

et a

l. A

dvan

ced

Glo

bal I

llum

inat

ion

Page 94: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Obousměrné sledování cest

Zobecnění kombinované strategie pro výpočet přímého osvětlení v path traceru

Přímé osvětlení Různé strategie nalezení vzorkování bodu na zdroji světla

BPT Různé strategie generovaní celých světelných cest

PG III (NPGR010) - J. Křivánek 2013 95

Page 95: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Obousměrné sledování cest

Pro danou světelnou cestu:

Funkce příspěvku fj() nezávisí na způsobu vzorkování

Hustota pravděpodobnosti závisí na způsobu vzorkování

PG III (NPGR010) - J. Křivánek 2013 96

Page 96: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Vzorkovací techniky v BPT

Příklad: Čtyři vzorkovací techniky pro k = 2

Imag

e: E

ric

Vea

ch

PG III (NPGR010) - J. Křivánek 2013 97

Page 97: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Vzorkovací techniky v BPT

Podcesta o t vrcholech vzorkovaná z kamery Podcesta o s vrcholech vzorkovaná ze světla Spojovací segment délky 1 Celková délka cesty: k = s + t – 1 (segmentů)

k+2 možností pro generování cesty délky k

PG III (NPGR010) - J. Křivánek 2013 98

Page 98: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Vzorkovací techniky v BPT

Každá technika má jinou hustotu ps,t

Každá je účinná při vzorkování jiných světelných efektů

Všechny techniky odhadují stejný integrál

PG III (NPGR010) - J. Křivánek 2013 99

Page 99: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Kombinace vzorkovacích technik

Kombinovaný estimátor (MIS)

kombinační strategie (např. vyvážená heuristika)

PG III (NPGR010) - J. Křivánek 2013 100

Page 100: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

BPT Implementation

101 PG III (NPGR010) - J. Křivánek 2013

Page 101: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Implementace: Generování cest po skupinách

Generuj podcestu náhodné délky od světla Generuj podcestu náhodné délky od kamery

Spoj každý prefix cesty od světla s každým sufixem

cesty od kamery

(cesta = vzorek z hustoty ps,t)

PG III (NPGR010) - J. Křivánek 2013 102

Page 102: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Generování cest po skupinách

PG III (NPGR010) - J. Křivánek 2013 103

Imag

e: D

utre

et a

l. A

dvan

ced

Glo

bal I

llum

inat

ion

Page 103: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Results

BPT, 25 samples per pixel PT, 56 samples per pixel

Imag

es: E

ric

Vea

ch

104 PG III (NPGR010) - J. Křivánek 2013

Page 104: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

k = 2 (2x)

k = 3 (4x)

k = 4 (8x)

k = 5 (16x)

s = 1 s = 2 ... t = 1 t = 2 s / t = počet vrcholů na podcestě od světla / kamery 105

Page 105: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Porovnání algoritmů

PG III (NPGR010) - J. Křivánek 2013 106

© F. Suykens

Path tracing Light tracing Bidirectional path tracing

Kvíz: Proč je skleněná koule černá?

Page 106: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

LIMITATIONS OF LOCAL PATH SAMPLING

Page 107: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Insufficient path sampling techniques

Reference solution Bidirectional path tracing 108

Page 108: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Insufficient path sampling techniques

Some paths sampled with zero (or very small) probability

109

Course: Recent Advances in Light Transport Simulation

Jaroslav Křivánek – Bidirectional Path Sampling Techniques

diffuse – D

specular – S

Page 109: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Alternatives to local path sampling

Global path sampling – Metropolis light transport

Initial proposal still relies on local sampling

Leave path integral framework Density estimation – photon mapping

Unify path integral framework and density estimation

Vertex Connection & Merging

110

Course: Recent Advances in Light Transport Simulation

Jaroslav Křivánek – Bidirectional Path Sampling Techniques

Page 110: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

NEARLY THERE…

Page 111: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

“Path integral” – A historical remark

This course [Veach and Guibas 1995], [Veach 1997]

Easily derived form the rendering equation [Veach 1997]

Feynman path integral formulation of quantum

mechanics [Feynman and Hibbs 65]

Homogeneous materials [Tessendorf 89, 91, 92]

Rendering [Premože et al. 03, 04]

112

Course: Recent Advances in Light Transport Simulation

Jaroslav Křivánek – Bidirectional Path Sampling Techniques

Page 112: Počítačová grafika III - Univerzita Karlovajaroslav/teaching/2013... · 2006, Monster House ... BRDF lobe . sampling . emission sampling high thruput . connections . PG III (NPGR010)

Konec

E. Veach: Robust Monte Carlo methods for light transport simulation, PhD thesis, Stanford University, 1997, pp. 219-230, 297-317 http://www.graphics.stanford.edu/papers/veach_thesis/

PG III (NPGR010) - J. Křivánek 2013 113