Realstc Image Synthess - Combned Samplng and Path Tracng - Phlpp Slusallek Karol Myszkowsk Vncent Pegoraro
Overvew: Today Combned Samplng (Multple Importance Samplng) Renderng and Measurng Equaton Random Walk Methods Dstrbuton Tracng Path Tracng Comng up Bdrectonal Path Tracng
COMBINED SAMPLING
Intellgent Monte Carlo Integraton Example: Dfferent Probabltes Samplng drectons x p(y )= cos x / x y Samplng the surface x p(y)= cos y /r xy 2 y
Intellgent Monte Carlo Integraton Multple Importance Samplng (MIS) Very Important Combnng multple mportance dstrbutons Idea: One functon p(x) s too nflexble Use multple functons n parallel A-pror weghted ntegraton Weght two estmators Weghts are determned analytcally ( manually ) or are estmated M Nm m m1 Nm 1 m( ) ( 1 = Approach wth two estmators and weghts ω ( ω I w f p ( ) Smlar results for multple estmators
Intellgent Monte Carlo Integraton A-posteror multple mportance samplng Choose samples Assgn weghts accordng to probabltes/varance of each estmator Balance Heurstcs w ( x) p ( x) p ( x) j n p ( x) w ( x) n p ( x) No other combnaton can be much better [Veach '97] Motvaton Samples wth low probablty boost the varance wth 1 p Assgn larger weghts to samples wth hgher probablty Must be able to evaluate probablty of sample accordng to other probabltes denstes j j
Intellgent Monte Carlo Integraton Other weghtng heurstcs Varance s addtve may have mpact on already good estmators Try to sharpen the weghtng, avod contrbuton wth low probablty Power Heurstc and Cutoff Heurstc p 0 f p p w w p p otherwse k k p max k k pk p Reduced weght for samples wth low probablty Maxmum Heurstc 1 f p s maxmum w 0 otherwse ( p(x Adaptvely parttons the ntegraton doman accordng to But too much samples are thrown away max
Comparson of Heurstcs Example Two orthogonal surfaces, one s a lght source (a) Samplng of lght source (3 samples per pxel) Most samples near lght wll have very shallow angle, cos near zero (b) Samplng of drectons (accordng to projected sold angle) Most samples far from lght wll not ht the lght source (c) MIS wth Power Heurstcs (d) Standard devaton plotted over average dstance to lght source
Combnaton of Estmators Samplng of Lght Sources (l) Small contrbuton for large lght sources and hghly specular surfaces Samplng of Drectons (r) No contrbuton f lght source s not ht (hghly dffuse, small LS) Ideal: Weghted combnaton (b) Combned advantages of both methods Prncple: Hgh weght, for hgh probablty Here: Power heurstcs
Comparson of Heurstcs Image of a lght source on surfaces wth dfferent roughness
PATH TRACING
Renderng Equaton Renderng Equaton n Operator Notaton Short form leavng out arguments To be appled to the entre doman T: Transport operator Inverson Cannot be done n closed form Infnte dmensonal ntegral Can be approxmated by mappng to fnte dmensonal space Results n a lnear system of equaton Fnte Element Methods, e.g. Radosty Methods (formally derved "soluton") ) (1 )cos ),, ( ( ),, ( ), )( ( wth )cos ),, ( ( 1 e r e r e L L d x y X x f x X X L L L d x y L f L L T T T T
Renderng Equaton Expanson of the Renderng Equaton (Neumann seres) L L L L e e TL f L( y( x, ), )cos d TL TTL Interpretaton =0: Drect emsson from lght sources =1: Lght reflected once =n: Lght reflected n tmes Path Tracng: General Monte Carlo Renderng Algorthm Select ponts and drectons and shoot ray At ht pont: Add emsson term Select new drecton and recursvely shoot rays Add contrbuton after attenuaton by BRDF But when do we stop? r L e e 0 T L e wth T 1
Russan Roulette Unbased Termnaton of Infnte Sequence Abort sequence wth a certan probablty Need to correct for the mssed ntegraton F n F E[ F] n n ( x) 0 (1 ) E0 else Fn (1 ) (1 ) E[ F In renderng, often choose (1 alpha) to be: Constant The albedo (avg. reflectvty): probablty that a photon s reflected at all Path throughput: Contrbuton to fnal pxel (possbly relatve contrbuton) Effcency-optmzed: threshold based on avg. varance & avg. ray count Adds varance/nose but s unavodable for an unbased soluton n ]
Russan Roulette Experments by Thago Ize, Unversty of Utah Effects of Russan Roulette 5000 rays per pxel; wth hghly occluded areas Four comparsons 1. Fxed max. depth for rays (bas depends on max. depth and scene) Strong bas n sgnfcantly occluded areas as rays are termnated before httng a lght source. Need very hgh max. depth, whch s costly 2. RR wth fxed kll probablty Introducton of speckle nose due to occasonal strong boostng of rays 10x bounce wth 50% chance: 2^10=1024x 3. RR wth kll probablty proportonal to mportance (throughput) of ray Pure mportance samplng, should gve good results 4. Effcency-optmzed RR [Veach PhD thess, Chapter10] Estmatng kll probablty based on statstcs of surroundng pxels Results Strategy (3) slghtly less effcent than (4), but easer to mplement
Russan Roulette
Russan Roulette Max depth = 100 53 mnutes
Russan Roulette Constant kll probablty = 0.3
Russan Roulette MIN(1, Throughput / 0.5) 27.8 mnutes
Russan Roulette MIN(1, Throughput / 0.1) 31.3 mnutes
Russan Roulette MIN(1, Throughput / 0.01) 32.6 mnutes
Russan Roulette Effcency optmzed 28.8 mnutes
Russan Roulette Fxed maxmum depth = 5 23.1 mnutes
Russan Roulette Constant kll probablty = 0.5 24.8 mnutes
Russan Roulette MIN(1, Throughput / (1/255)) 24.2 mnutes
Russan Roulette Effcency-optmzed 24.8 mnutes
Measurng Equaton Renderng equaton s a contnuous densty functon Provdes radance [Watt per area and sold angle] Sensors measure fnte values (energy or power) For pxels, patch radosty, Measure the contnuous functon over a fnte doman Measurng Equatons Wth sensor's senstvty functon M(...) Pxel values M shutter openng pxel lens aperture M ( x,, t) L( x,, t) d dxdt ML Patch flux/power M patch area M ( x,, t) L( x,, t) d dxdt ML
Random Walk Methods Shootng Soluton (Photon Tracng Methods) Start at the lghts, choose power per sample Propagate lght accordng to emsson functons and BRDFs Measure Only when photons ht the measurement devce By connectng from ht pont to measurement devce Only at end of path when photon s absorbed At every ht pont Gatherng Soluton (Ray Tracng, Path Tracng) Start at the measurng devce Propagate path accordng to measurement functon and BRDFs Measure Only at lght sources By connectng from ht ponts to lght sources Only at end of path At every ht pont
Dstrbuton Ray Tracng Extendng RT to hgher dmensons Was called Dstrbuted Ray-Tracng [Cook 84] Gatherng approach Integraton over pxel (ant-alasng) Measurng devce collects photons Here: Samplng wth many ray paths Real camera wth aperture (depth of feld) Sample over lens aperture and accordng to optcal propertes Fnte shutter openng (moton blur) Sample over openng tme, consder movng camera and objects Glossy reflectons (hghlghts) Sample glossy parts of the BRDF Real lght sources (area lghts) Sample lght sources
Depth of Feld Thn lens model Unque mappng of pont on mage plane to ponts on focal plane Samplng the lens aperture Choose pont P b on mage plane and P l on lens Compute pont P f by shootng ray through the lens center Sample scene wth ray from P l through P f P b P l P f Image plane Lens Focal plane
Depth of Feld
Moton Blur Models Fnte Exposure Tme Shutter openng tme (t 0 t t 1 ) Assumes nstantaneous openng and closng Can easly be generalzed by modelng the shape of the aperture at each tme nstance Algorthm Assgn ray a tme t between t 0 and t 1 Transform objects n the scene to the proper postons at t Alternately: nversely transform ray Compute ntersecton wth object
Moton Blur
Dstrbuton Ray Tracng Fundamental Prncple Monte Carlo Integraton But not formulated as such (yet) Only pont-wse evaluaton of all ntegrals BRDF, emsson, and reflected lght No use of mportance samplng or flterng (yet)
Glossy Reflecton
Path Tracng [Kajya 86] Problem of Dstrbuton Tracng Tracng of all rays recursvely Exploson of the ray tree slow Uses more and more rays for less and less contrbuton Path Tracng: Trace only a sngle ray per ht pont Randomly decde to absorb (Russan Roulette) Randomly decde whch reflecton term to sample Randomly sample ths term Would be very slow Very low probablty to ht the lght source Next Event Estmator (Lght Source Samplng) In addton randomly choose a lght source Randomly choose a poston on the lght source Trace a shadow ray at ths poston and add contrbuton
Comparson
Path Tracng Next Event Estmaton s Stratfcaton Splt scene nto separate strata Lght sources Non lght sources Use dfferent samplng strateges Lght sources: Drected samplng on lght's surfaces Select a lght source (e.g. mportance samplng based on ts total power) Select a sample pont on ts surface (e.g. unformly dstrbuted) Non lght sources: Drectonal samplng Chose (e.g. cosne or BRDF weghted) drecton Beware: What happens f a drectonal sample hts a lght source????
Path Tracng Next Event Estmaton s Stratfcaton Splt scene nto separate strata Lght sources Non lght sources Use dfferent samplng strateges Lght sources: Drected samplng on lght's surfaces Select a lght source (e.g. mportance samplng based on ts total power) Select a sample pont on ts surface (e.g. unformly dstrbuted) Non lght sources: Drectonal samplng Chose (e.g. cosne or BRDF weghted) drecton Beware: What happens f a drectonal sample hts a lght source???? IT MUST NOT BE COUNTED!!!! Otherwse, we would count lght sources twce (wth some probablty)