Topc 3: Raometry The bg pcture Measurng lght comng from a lght source Measurng lght fallng onto a patch: Irraance Measurng lght leavng a patch: Raance The Lght Transport Cycle The BrecAonal Reflectance DstrbuAon FuncAon The Basc Lght Transport Path
Lght Transport Between Patches The General Lght Transport Cycle 2
One Step Along Path: DrecAonal IntegraAon One Step Along Path: DrecAonal IntegraAon 3
Topc 3: Raometry The bg pcture Measurng lght comng from a lght source Measurng lght fallng onto a patch: Irraance Measurng lght leavng a patch: Raance The Lght Transport Cycle The BrecAonal Reflectance DstrbuAon FuncAon General Lght Transport Cycle: Closng the Loop 4
DefnAon: The BRDF of a Pont DefnAon: The BRDF of a Pont 5
DefnAon: The BRDF of a Pont Raance Due to a Pont Lght Source 6
Raance Due to an Extene Source Raance Due to an Extene Source 7
The BRDF of a Dffuse Pont The BRDF of a Dffuse Pont 8
The BRDF of a Dffuse Pont Raance of a Dffuse Pont Due to Extene Src 9
Raance of a Dffuse Pont Due to Extene Src Raance of Dffuse Pont ue to Pont Lght Src 0
Raance of Dffuse Pont ue to Pont Lght Src Raometrcally- Correct Ray Tracng
Dstrbuton Ray Tracng n In Whtte Ray Tracng we compute lghtng very cruely q Phong + specular global lghtng n In Dstrbute Ray Tracng we want to compute the lghtng as accurately as possble q Use the formalsm of Raometry q q Compute rraance at each pxel by ntegratng all the ncomng lght Snce ntegrals are can not be one analytcally we wll employ numerc approxmatons Benefts of Dstrbuton Ray Tracng n Better global ffuse lghtng q q Color bleeng Bouncng hghlghts n Extene lght sources n Ant-alasng n Moton blur n Depth of fel n Subsurface scatterng
2 Raance at a Pont n Recall that raance shang at a surface pont s gven by n If we parameterze rectons n sphercal coornates an assume small fferental sol angle we get ρ ω n p L p L e e = Ω φ φ φ φ ρ π φ π n L p p L e e = ] 02 [ ] [02 sn Raance at a Pont n Recall that raance shang at a surface pont s gven by n If we parameterze rectons n sphercal coornates an assume small fferental sol angle we get ρ ω n p L p L e e = Ω φ φ φ φ ρ π φ π n L p p L e e = ] 02 [ ] [02 sn Integral s over all ncomng recton hemsphere
Irraance at a Pxel n To compute the color of the pxel we nee to compute total lght energy flux passng through the pxel rectangle.e. we nee to compute the total rraance at a pxel Φ j = αmn α αmax βmn β βmax H α β αβ Integrals s over the extent of the pxel Numercal Integraton D Case n Remember: ntegral s an area uner the curve n We can approxmate any ntegral numercally as follows y x f x D x N = f x N D 0 f x x 3
Numercal Integraton D Case n Remember: ntegral s an area uner the curve n We can approxmate any ntegral numercally as follows y x D = N f x D x D N f x x 0 = D f x N Numercal Integraton D Case n Problem: what f we are really unlucy an our sgnal has the same structure as samplng? y x f x D x D N f x x 0 = D f x N 4
Monte Carlo Integraton n Iea: ranomze ponts x to avo structure nose e.g. ue to peroc texture y x f x D x n Draw N ranom samples x nepenently from unform strbuton Qx=U[0D].e. Qx = /D s the unform probablty ensty functon n Then approxmaton to the ntegral becomes w f x f x x for w = N Q x n We can also use other Q s for effcency!!! a..a. mportance samplng Monte Carlo Integraton y x f x D x n Then approxmaton to the ntegral becomes w f x f x x for w = N Q x n We can also use other Q s for effcency!!! a..a. mportance samplng 5
Stratfe Samplng n Iea: combnaton of unform samplng plus ranom jtter n Brea oman nto T ntervals of wths t an N t samples n nterval t y t f x n Integral approxmate usng the followng: T Nt tf xt j N t= t j= D x Stratfe Samplng n If ntervals are unform t = D/T an there are same number of samples n each nterval N t = N/T then ths T Nt approxmaton reuces to: D f xt j N t= j= n The nterval sze an the # of samples can vary!!! y t f x n Integral approxmate usng the followng: T Nt tf xt j N t= t j= D x 6
7 Bac to Dstrbuton Ray Tracng n Base on one of the approxmate ntegraton approaches we nee to compute q Let s try unform samplng φ φ φ φ ρ π φ π n p L p L e e = ] 02 [ ] 2 / [0 sn φ φ φ φ ρ Δ Δ = = sn M m N n n m n m n m e n L p N M π φ π 2 2 / = Δ = Δ φ φ Δ = Δ = 2 2 m n m n where mpont of the nterval sample pont Interval wth Importance Samplng n Dstrbuton Ray Tracng n Problem: Unform samplng s too expensve e.g. 00 samples/hemsphere wth epth of ray recurson of 4 => 00 4 =0 8 samples per pxel wth 0 5 pxels =>0 5 samples n Soluton: Sample more ensely usng mportance samplng where we now that effects wll be most sgnfcant q Drecton towar pont or extene lght source are sgnfcant q Specular an off-axs specular are sgnfcant q Texture/lghtness graents are sgnfcant q Sample less wth greater epth of recurson
Importance Samplng n Iea: ranomze ponts x to avo structure nose e.g. ue to peroc texture y x f x N w f x f x x for w = Q x Benefts of Dstrbuton Ray Tracng n Better global ffuse lghtng q q Color bleeng Bouncng hghlghts n Extene lght sources n Ant-alasng n Moton blur n Depth of fel n Subsurface scatterng 8
Shaows n Ray Tracng n Recall we shoot a ray towars a lght source an see f t s ntercepte c = j n p l no shaow rays Images from the sles by Duran an Cutler one shaow ray n Ant-alasng n Dstrbuton Ray Tracer Lets shoot multple rays from the same pont an attenuate the color base on how many rays are ntercepte Same wors for p ant-alasng of Textures!!! c = j n l one shaow ray Images from the sles by Duran an Cutler w/ ant-alasng 9
Ant-alasng by Determnstc Integraton n Iea: Use multple rays for every pxel n Algorthm q Subve pxel j nto squares q Cast ray through square centers q Average the obtane lght n Susceptble to structure nose repeatng textures Ant-alasng by Monte Carlo Integraton n Iea: Use multple rays for every pxel n Algorthm q Ranomly sample pont nse the pxel j q Cast ray through pont q Average the obtane lght n Does not suffer from structure nose repeatng textures 0
How many rays o you nee? ray/lght 0 ray/lght 20 ray/lght 50 ray/lght Images taen from http://web.cs.wp.eu/~matt/courses/cs563/tals/st_ray/st.html n Soft Shaows wth Dstrbuton Ray Tracng Lets shoot multple rays from the same pont an attenuate the color base on how many rays are ntercepte c = j p n one shaow ray Images from the sles by Duran an Cutler lots of shaow rays
Antalasng Supersamplng jagges w/ antalasng pont lght area lght Images from the sles by Duran an Cutler Specular Reflectons n Recall we ha to shoot a ray n a perfect specular reflecton recton wth respect to the camera an get the raance at the resultng ht pont r c = j = 2 s n n p n s s m s = 2 c n n c 2
Specular Reflectons wth DRT n Same but shoot multple rays r c = j = 2 s n n p n s s Sprea s ctate by BRDF Perfect Reflectons Metal Perfect Reflectons glossy polshe surface Justn Legas Depth of Fel n So far wth our Ray Tracers we only consere pnhole camera moel no lens q or alternatvely lens but tny aperture Image Plane Lens optcal axs 3
Depth of Fel n So far wth our Ray Tracers we only consere pnhole camera moel no lens q or alternatvely lens but tny aperture n What happens f we put a lens nto our camera q or ncrease the aperture n Remember the thn lens equaton? Image Plane Lens = f z 0 + z optcal axs z 0 z Depth of Fel n So far wth our Ray Tracers we only consere pnhole camera moel no lens q or alternatvely lens but tny aperture n What happens f we put a lens nto our camera q or ncrease the aperture n Remember the thn lens equaton? Image Plane Lens = f z 0 + z optcal axs z 0 z 4
Changng the focal-length n DRT ncreasng focal length optcal axs 220x400 pxels 44 samples per pxel ~4.5 mnutes to rener z z 0 Changng the aperture n DRT ecreasng aperture optcal axs 220x400 pxels 44 samples per pxel ~4.5 mnutes to rener z z 0 5
Depth of Fel Depth of Fel 6
Depth of Fel Depth of Fel 7
Depth of Fel Camera Shutter n We gnore the fact that t taes tme to form the mage q We gnore ths for raometry n Durng that tme the shutter s open an lght s collecte q We nee to ntegrate temporally not only spatally t α β H α β t αβt 8
Moton Blur Moton Blur 9
Moton Blur long exposures Moton Blur short exposures 20
Sub-surface Scatterng Sub-surface Scatterng Brectonal Surface Scatterng Reflectance Dstrbuton Functon 2
Brectonal Surface Scatterng Reflectance Dstrbuton Functon [Images taen from Wpea] Sem-Transparences Image form http://www.graphcs.cornell.eu/onlne/tutoral/raytrace/ 22
Texture-mappng an Bump-mappng n Ray Tracer Image form http://www.graphcs.cornell.eu/onlne/tutoral/raytrace/ Caustcs n Har to o n Dstrbuton Ray Tracng q Why? 23
Caustcs n Har to o n Dstrbuton Ray Tracng q Why? Har to come up wth a goo mportance functon for samplng Hence VERY VERY slow Caustcs n Often one usng b-rectonal ray tracng a..a. photon mappng q Shoot lght rays from lght sources q Accumulate the amount of lght raance at each surface q Shoot rays through mage plane pxels to loo-up the raance an ntegrate rraance over the area of the pxel 24
Photon Mappng n Smulates nvual photons q In DRT we were smulatng raance flux n Photons are emtte from lght sources n Photons bounce off of specular surfaces n Photons are eposte on ffuse surfaces q Hel n a 3-D spatal ata structure q Surfaces nee not be parameterze n Photons collecte by ray tracng from eye Photons n A photon s a partcle of lght that carres flux whch s encoe as follows q magntue n Watts an color of the flux t carres store as an RGB trple q locaton of the photon on a ffuse surface q the ncent recton use to compute rraance n Example pont lght source photons emtte unformly q Power of source n Watts strbute evenly among photons q Flux of each photon equal to source power ve by total # of photons q 60W lght bulb woul senng 00 photons wll result n 0.6 W per photon 25
How oes ths actually wor? Specal ata structures are requre to o fast loo-up KD-trees Photon Mappng Results Raance estmate usng 50 photons Raance estmate usng 500 photons 26