Contnts Stochastc Ray Tacng Kad Bouatouch IRISA Emal: kad@sa.f Mont Calo Intgaton Applcaton to dct lghtng by aa lght soucs Solvng th adanc quaton wth th Mont Calo Mthod Dstbutd Ray Tacng Path Taycng 2 Classcal Ray Tacng Wth Aa ght Soucs On shadow ay by ntscton pont Only pont lght soucs Had shadows: umba 3 Soft shadows Aa lght soucs! pont lght soucs 4
Mo Sampl Ponts on th ght Souc Soluton to th Rndng Equaton V,y V,y Θ θ θ Θ ψ ψ y y θ y θ y y y Analytcal soluton: too much dffcult Us th Mont Calo mthod Appomat th souc by a st of ponts Alasng along th shadows bods 5 y Θ f, Θ Ψ y Ψ V, y dy 2 y A 6 Dct ghtng Dct ghtng V,y Θ θ θ Θ Θ ω ψ ψθ y ψ y y ω θ y Random pont samplng of th aa lght soucs Us ths ponts to valuat th ntgal D y Θ D y dy Θ p y A y y y y Θ f, Θ Ψ y Ψ V, y dy 2 y A 7 shadow ay 9 shadow ays p y AS Θ y As f, Θ Ψ y Ψ Vs, y 2 y 8
Dct ghtng Statfd Samplng Θ 36 shadow ays shadow ays y As f, Θ Ψ y Ψ Vs, y 2 y 9 shadow ays wthout statfcaton 9 shadow ays wth statfcaton 9 Statfd Samplng Statfd Samplng 36 shadow ays no statfcaton 36 shadow ays wth statfcaton shadow ays no statfcaton shadow ays wth statfcaton 2
Multpl ght Soucs Multpl ght Soucs Th ntgal dos not chang : ath than ntgatng ov on lght souc, ntgat ov all th sufacs of th lght soucs y Θ f, Θ Ψ y Ψ V, y dy 2 y Th pdf fo slctng ponts s modfd : fst slct a lght souc S usng pdf ps, thn a pont y on S wth py S p S Φ Φ S T A p ys p y p S p ys As 36 shadow ays p pl n th 2 mags but wth dffnt pdf 3 4 Applcaton to pls: ovsamplng Comput adanc at th cnt of a pl alasng Ovsampl a pl and comput adanc fo sub-pls Us a flt f d Pl valuatd by th Mont Calo mthod. 5 Applcaton to pls: ovsamplng Any samplng mthod f p 6
Applcaton to pls: ovsamplng Implmntaton Compason : ay / pl ays / pl ays / pl 7 cntd ay p pl andom shadow ays p ntscton cntd ays p pl andom shadow ays p ntscton 8 Th Rndng Equaton Evaluaton of th ndng quaton How to wt th ndng quaton and how to valuat t usng Mont Calo ntgaton Whch pdf to us fo th ndng quaton Algothms and sults Th Rndng Equaton Θ Θ + Ψ f, Ψ Θ Ψcos Ψ, n dωψ Θ Θ 9 2
Th Rndng Equaton Θ Θ + f, Ψ Θ Ψcos Ψ, n dωψ Computng Radanc How to valuat Fnd Θ + f cos f Add:, Ψ Θ Ψ cos Ψ, n dω Ψ 2 22 Computng Radanc Computng Radanc How to valuat Mont Calo Intgaton Gnat andom dctons on, usng th pobablty dnsty functon pψ Θ Θ f, Ψ Θ Ψcos Ψ, n dωψ p Ψ f, Ψ Θ Ψ cos Ψ, n Hmsph Samplng π / θn 2 2π ϕn p Θ cos θ cos ξ ϕ 2πξ2 π θ a t Θ θ, ϕ dωθ snθ dθ dϕ p Θ n+ cos 2 2 2 cosnθ θ a ξ n + tϕ πξ π θ n dω Θn ϕ n 23 24
Computng Radanc Gnat a andom dcton Ψ f K Ψ cos K p Ψ Evaluat th BRDF Evaluat th cos Evaluat Ψ Computng Radanc Evaluaton of Ψ Radanc s constant along th popagaton dcton. c, Ψ fst vsbl pont. Ψ c, Ψ Ψ 25 26 Computng Radanc Rcusv Evaluaton Stoppng Rcuson Whn cuson s stoppd Each bounc adds a lvl of ndct lghtng. Th contbutons of hgh od flctons a nglgbl. If w gno thm, th stmats a basd! 27 28
Tmnatng th Rcuson Whn/how do w stop th cuson Whn th ay dosn t ht any objct Can b vy had/mpossbl fo dns scns Whn a mamum dpth s achd Ths s hghly scn dpndnt Pmaly spcula scns qus fa mo bouncs than dffus scns Havng a fd path lngth sults n a basd stmat Whn th contbuton of th ay falls blow a ctan thshold Mo ffcnt than a fd ma dpth, but stll gvs a basd sult Intgal I f d Estmato < Ioultt Russan Roultt > Us Russan oultt to dcd ay s absobd wth pobablty -α sults n unbasd stmato α α f / α α f / α d f < α f > α f α 29 3 Russan Roultt A smpl and unbasd tmnaton cta s Russan oultt: Gvn a unfom andom numb ξ, tmnat th ay f ξ α, othws scal th contbuton of th ay by /α H α є [,] s th absopton pobablty Rcuson stops wth a pobablty of p - α By scalng th contbuton of ays that contnu by / α, th sult mans unbasd Russan oultt s not pactcally usful untl w add dct lght to ou ay tac!! Russan Roultt Eampl p.9, thn α - p. On chanc n that ay s flctd. Th adanc du to on flctd ay s multpld by. nstad of shootng ays, w shoot only, but count th contbuton of ths on tms 3 32
Russan Roultt Cas of n ncdnt ays Θ f, Ψ Θ Ψ cos Ψ, n p Ψ Cas of on ncdnt ay f, D Θ D cos D, n Θ p D R, D. D 33 Russan Roultt Wth Russan oultt th psudo cod now looks lk ths: RGB adancray f hts at fξ < α Gnat nw dcton, D, fom p Ψ and th sufac nomal at Ray ay, D tun + R,D*adancay / α ls tun ls tun backgound 34 Russan Roultt on basd Estmat Th pctd valu s coct Bgg vaanc Algothm Tac ays p pl At ach ntscton pont, tac ay o mo andomly chosn on th hmsph to valuat th ndng quaton End cuson usng th Russan oultt But mo ffcnt 35 36
computimag { fo ach pl,j { stmatdradanc[,j] fo s to #sampls-n-pl { gnat Q n pl,j thta Q E/ Q-E // E s th Ey tace,thta stmatdradanc [,j] + computradanc,-thta stmatdradanc [,j] / # sampls-n-pl computradanc, thta { stmatdradanc bascpt, thta tun stmatdradanc 37 bascpt, thta { stmatdradanc, thta fnot absobd { // ussan oultt fo s to #adancsampls { // ay dctons ps gnat andom dcton on hmsph y tac, ps stmatdradanc + bascpty,-ps * BRDF,ps,thta* cos,ps / pdfps stmatdradanc / #adancsampls tun stmatdradanc/absopton 38 39 4
ay/pl 6 ays/pl 256 ays/pl Vy nosy : null contbuton as long as th path dos not ach a lght souc!! 4 42 n 43 44
n 45 46 n 47 48
.234 49 5 Impov th algothm by dvdng th ntgal nto two pats: dct and ndct Θ + f, Ψ Θ Ψcos Ψ, n dωψ f, Ψ Θ Ψcos Ψ, n dωψ Θ Θ + Θ 5 52
53 Evaluat dffntly th dct and th ndct componnts + Souc f f cos cos 54 Dct Illumnaton, cos cos cos cos 2 y V da y f d y f d f souc Aa y y dct Ψ Θ Ψ Ψ K K K K K K K ω ω da y dω Θ Θ d da y y ω θ Θ cos 2 55 Indct Illumnaton Ψ Ψ Ψ Ψ Θ Θ d n f ω, cos, 56 Indct Illumnaton Ψ Ψ Ψ Ψ Θ Θ d n f ω, cos,
Θ Θ f, Ψ Θ Ψcos Ψ, n dωψ p Ψ f, Ψ Θ Ψ cos Ψ, n Dpnds on how to sampl th hmsph Unfom dstbuton Impotanc samplng : pck p to match ntgal Cosn dstbuton BRDF dstbuton BRDF*cosn dstbuton Θ Unfom dstbuton 2π p Ψ f, Ψ Θ Ψ cos Ψ, n 2π 57 58 Cosn dstbuton Θ p Ψ cos π π f, Ψ θψ Θ Ψ BRDF dstbuton p Ψ f... Θ Ψ cos Ψ, n 59 6
BRDF*cosn dstbuton p Ψ f...ψ Θ Ψ 6 : pl samplng computimag { fo ach pl,j { stmatdradanc[,j] fo s to #sampls-n-pl { gnat Q n pl,j thta Q E/ Q-E tace,thta stmatdradanc [,j] + computradanc,-thta stmatdradanc [,j] / #sampls-n-pl 62 : adanc stmaton computradanc,thta { stmatdradanc,thta stmatdradanc + dctillumnaton, thta stmatdradanc + ndctillumnaton, thta tun stmatdradanc 63 : dct llumnaton dctillumnaton,thta { stmatdradanc fo s to #shadowrays { k pck andom lght y gnat andom pont on lght k ps -y / -y stmatdradanc + _ky,-ps * BRDF,ps,ttha *G,y * V,y /pk*py k stmatradanc / #shadowrays tun stmatdradanc 64
: dct llumnaton dctillumnaton,thta { stmatdradanc fo k to #lghts { fo s to #shadowrays { y gnat andom pont on lght k ps -y / -y stmatdradanc + _ky,-ps * BRDF,ps,ttha *G,y * V,y /py stmatradanc / #shadowrays tun stmatdradanc 65 : ndct llumnaton ndctillumnaton,thta { stmatdradanc f not absobd { // ussan oultt fo s to #ndctdctonsampls { ps gnat andom dcton on hmsph y tac, ps stmatdradanc + computradancy,-ps * BRDF,ps,thta *cos,ps / pdfps stmatdradanc / #ndctdctonsampls tun stmatdradanc /absopton 66 To sum up Fo pmay ays : us many ay sampls at th ntscton pont Us unfom o cosn pdf to sampl th hmsph Fo shadow ays : Us unfom aa-basd pdf to sampl th lght soucs Us many sampls Fo sconday ays Us on o mo sampls Us BRDF basd pdf Tacng ambtan Matals W v alady sn that fo ambtan matals, R s just a constant btwn and To gnat a andom ay dcton, w us th cosn dnsty p θ, φ and two unfom π andom numbs ξ and ξ 2 Usng th tchnqus psntd bfo, w fnd that ξ φ 2πξ 2 67 68
Impfct Spcula Rflctons Pfctly flctng matals a a Usually, th flcton s slghtly blud To achv an mpfct spcula flcton, w can choos th flcton dcton fom a phong dnsty: m+ m ξ p k k 2π φ 2πξ Wh s th mo flcton dcton and θ s th angl btwn and k 2 m+ 69 Tanspant Matals Whn a ay hts a tanspant matal, t s th flctd o tansmttd Whn a ay s tansmttd fom a mdum wth factv nd n to a mdum wth factv nd n t, t s bnd accodng to Snll s law: n snθn t snφ Fo an ncdnt angl of θ, th facton of ncdnt ays that a flctd s Rθ. -Rθ s th facton of tansmttd ays 7 Path tacng At ach ntscton pont on can mak a choc Rflcton o facton If flcton : dffus o spcula 7 Rflcton o Tansmsson Whn stkng a tanspant sufac, w nd to mak a choc: Should th nw ay b a flctd o tansmttd ay W can st a tansmsson pobablty P, and thn pck a andom numb ξ. If ξ<p, th ay s tansmttd, and th contbuton s scald by /P Els, th ay s flctd, and th contbuton s scald by /-P 72
B s aw Whn lght tavls though an mpu mdum, t s adanc s attnuatd accodng to B s law: ln a s I s I H Is s th adanc of a ay at a dstanc s fom th ntfac and a s th RGB attnuaton constant 73 Spcula-Dffus Sufacs Most sufacs flcts lght s som combnaton of spcula and dffus flctons Whn th angl btwn th vw vcto and th nomal ncass, th spcula flcton ncass and th dffus dcass W modl such matals by lnaly combnng a spcula and a dffus matal 74 Spcula-Dffus Sufacs Rsults W can choos th spcula ay wth pobablty P and th dffus ay wth pobablty -P fξ < P tun R,D*adancspcula ay/p ls tun R*adancdffus ay/-p 75 76
77 Rsults 78 Rsults d d 79 Rsults 2.345 d 2.345 d 8 Rsults
Rsults Compason Wthout computng dct lghtng 6 ays/pl Wth dct lghtng computaton 8 82 Compason ay/ pl 4 ays/ pl 6 ays/ pl 256 ays/ pl 83