distribution ray-tracing 1 distribution ray-tracing use many rays to compute average values over pixel areas, time, area lights, reflected directions, ... 2 antialiasing origin compute average color subtended by a pixel pixel center C = raytrace(E, Q − E) pixel average C = E 1 Ap d Q BP raytrace(E, Q − E) ˝d A Q : camera origin; Q : point on image plane; P : pixel of area A_p 3 antialiasing by deterministic int. subdivide the pixel in squares cast rays through square centers average result [Shirley] 4 deterministic antialias pseudocode [Shirley] //antial iasingpixel(i,j)-deterministic c=0 fo rsx=0tons fors y=0tons u=(i+(sx+ 0.5)/ns)/width v=(j+(sy+ 0.5)/ns)/height Q=imagePlan ePoint(u,v) c+=raytrace (E,Q-E) c/ =ns*n s 5 antialiasing by monte carlo estimation pick random points in pixel area cast rays trough them average result [Shirley] 6 monte carlo antialiasing pseudocode [Shirley] //antial iasingpixel(i,j)-montecarlo c=0 fo rs=0tons*ns (rx,r y)=random2 d() u=( i+rx)/wi dth v=( i+ry)/he ight Q=i magePoint(u, v) c+=raytrace(E,Q -E) c/ =ns*n s 7 monte carlo antialiasing pseudocode [Shirley] //antial iasingpixel(i,j)-stratifiedmontecarlo c=0 fo rsx=0tons fors y=0tons ( rx,ry)=ran dom2d() u=(i+(sx+ rx)/ns)/width v=(j+(sy+ ry)/ns)/height Q=imagePoin t(u,v) c+=raytrace (E,Q-E)/ns*ns 8 raytraced images are too "clean" soft shadows come from area light raytracing only supports point ligts [Jason Waltman / jasonwaltman.com] 9 raytraced images are too "clean" blurry reflections come from rough materials raytracing only supports perfectly sharp mirror [Jensen] 10 raytraced images are too "clean" depth of field come from lens system raytracing only support pinhole camera [Jason Waltman / jasonwaltman.com] 11 raytraced images are too "clean" motion blur come from shutter speed raytracing only support infinitely fast shutter speed [Jason Waltman / jasonwaltman.com] 12 soft shadows origin area ligts create penumbras light is only partially visible from a given point want to compute how much light hits the point [Shirley] 13 approximate soft shadows principle point light C = Cl ˝V (P, S) ˝shading(P, S) area light C = P Cl AL ˝d B S L V (P, S) ˝shading(P, S) ˝dA S : point on the surface; S : point on the light; V : visibility function (0 or 1); L : light of area AL ; Cl : total light intensity 14 soft shadows by deterministic int. approximate area light as a set of point lights equivalent to quadrature rule for each point, compute shadows and lighting average results [Shirley] 15 soft shadows by monte carlo est. use Monte Carlo integration pick random points on the light easy for quad lights, hard (but possible) for others compute shadows and lighting average results [Shirley] 16 soft shadows by monte carlo est. for quads Si = Sc + (0.5 − ri,1 )lu + (0.5 − ri,2 )lv Ë Ì C Sc = Cl N ˝K N i V (P, Si ) ˝shading(P, S ) i : light source center; u, v : light source tangent vectors; l : light source size; ri : uniformly sampled random 2d vector in [0, 1] 2 ; N : total number of samples 17 how many samples? 1 sample 9 samples 36 samples [Bala] 100 samples 18 blurry reflections origin real materials often have blurred reflections light is scattered around a set of directions want to compute how much light reaches the surface along these directions [Shirley] 19 approx. blurry reflections principle mirror reflection C = kr ˝raytrace(P, R) blurry reflection C = P kr A° ˝d B° R raytrace(P, R) ˝d A R : point on the surface; R : reflected direction; ° : solid angle where object is reflecting; kr : reflection coefficient 20 blurred reflection by monte carlo est. compute reflected direction R pick random direction R around R ′ compute reflected color along R ′ average results [Shirley] 21 blurred reflection by monte carlo est. for quads Ri = Ë Ì C R R+(0.5−ri,1 )lu+(0.5−ri,2 )lv = kr N ˝K | Ri | N i raytrace(P, Ri ) : reflected direction; u, v : vectors orthogonal to R; l : blur size; ri : uniformly sampled random 2d vector in [0, 1]2 ; N : total number of samples 22 depth-of-field origin images in eyes and cameras are formed by lenses not all rays converge to a point so only some object appear sharp (in focus) while all other objects do not (out of focus) [Shirley] 23 approximate depth-of-field principle pinhole C = 1 AP ˝d Q BP raytrace(E, Q − E) ˝d A Q dof C = E 1 AP AL ˝d Q BP dB F L rt(F, Q − F) ˝d A ˝d A F Q : camera origin; Q : point on image plane; F : point on "lens" plane around E; P : pixel of area AP ; L : lens of area AL 24 depth-of-field by monte carlo est. pick random points on film and image plane compute color from aperture point toward image average results [Shirley] 25 depth-of-field by monte carlo est. for quads Fi = E + (0.5 − si,1 )la u + (0.5 − si,2 )la v Qi = E + (x + 0.5 − ri,1 )lp u + (y + 0.5 − ri,2 )lp v − nz Ë Ì C u, v = 1 N ˝K N i raytrace(Fi , Qi − Fi ) : vectors parallel to image plane; lp , la : pixel / aperture size; n : distance to image plane; ri , si : uniformly sampled random 2d vectors in [0, 1]2 ; N : total number of samples 26 motion blur origin takes time for images to form on camera/eye during that time the camera/eye is open sensors take the "average" of what is happening but objects move around in that time 27 approximate motion blur principle no blur C(t) = raytrace(E, d, St ) motion blur C(t, E š t) = 1 št ˝d B s [t,t+š t] raytrace(E, d, S s ) ˝d l s : any ray origin; d : any ray direction; S t : scene at time t ; t : time when shutter opens; š t : time that shutter stays open; št = tk+1 − tk : for animation, time between frames 28 motion blur by monte carlo estimation for any ray (camera, shadow, reflection), pick random time in the shutter interval update object transformations for picked time compute intersection average results 29 motion blur by monte carlo estimation for aliased camera rays Ë Ì C E = 1 N ˝K N i raytrace(E, Q − E, S t ) i : camera origin; Q : point on image plane; ti : uniformly sampled random variable in [0, 1]; N : total number of samples 30 combining estimations e.g. compute soft shadows and antialias the pixel C = Cl AP AL ˝ ∫ Q ∫ V (P(Q), S) ˝sh(P(Q), S) ˝dA ˝dA S Q S Q B AP , S [Bala] B AL 31 combining estimations: path tracing idea: randomize the whole path compute all the integrals at once! [Bala] 32
© Copyright 2026 Paperzz