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 = 1 A p d QB P raytrace(e, Q E) d A Q E Q P A_p : camera origin; : point on image plane; : pixel of area 3
antialiasing by deterministic int. subdivide the pixel in squares cast rays through square centers average result [Shirley] 4
deterministic antialias pseudocode [Shirley] //antialiasingpixel(i,j)-deterministic c=0 forsx=0tons forsy=0tons u=(i+(sx+0.5)/ns)/width v=(j+(sy+0.5)/ns)/height Q=imagePlanePoint(u,v) c+=raytrace(e,q-e) c/=ns*ns 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] //antialiasingpixel(i,j)-montecarlo c=0 fors=0tons*ns (rx,ry)=random2d() u=(i+rx)/width v=(i+ry)/height Q=imagePoint(u,v) c+=raytrace(e,q-e) c/=ns*ns 7
monte carlo antialiasing pseudocode [Shirley] //antialiasingpixel(i,j)-stratifiedmontecarlo c=0 forsx=0tons forsy=0tons (rx,ry)=random2d() u=(i+(sx+rx)/ns)/width v=(j+(sy+ry)/ns)/height Q=imagePoint(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 = V(P, S) shading(p, S) C l area light C l C = V(P, S) shading(p, S) d A L d SB L A S P S V : point on the surface; : point on the light; : visibility L A L C l function (0 or 1); : light of area ; : 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 S i = S c + (0.5 r i,1 )lu + (0.5 r i,2 )lv C l Ë CÌ = V(P, ) shading(p, ) N K N i S i S i S c u, v l : light source center; : light source tangent vectors; : light source size; r i : 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 = raytrace(p, R) k r blurry reflection k r C = raytrace(p, R) d A d RB A R P R : point on the surface; : reflected direction; : solid angle where object is reflecting; k r : reflection coefficient 20
blurred reflection by monte carlo est. compute reflected direction pick random direction R around compute reflected color along R average results R R [Shirley] 21
blurred reflection by monte carlo est. for quads R+(0.5 r )lu+(0.5 )lv R i = i,1 r i,2 k r R i Ë CÌ = raytrace(p, ) N K N i R i R u, v R l : reflected direction; : vectors orthogonal to ; : blur size; r i : 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 dof 1 C = raytrace(e, Q E) d A P d QB P A Q 1 C = d rt(f, Q F) d d A P A L QB d P FB A L F A Q E Q F plane around E; P : pixel of area A P ; L : lens of area A L : camera origin; : point on image plane; : point on "lens" 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 u, v F i = E + (0.5 s i,1 ) l a u + (0.5 s i,2 ) l a v Q i = E + (x + 0.5 r i,1 ) l p u + (y + 0.5 r i,2 ) l p v nz Ë CÌ = 1 raytrace(, ) N K N i F i Q i F i l p, l a n r i, s i [0, 1] 2 N : vectors parallel to image plane; : pixel / aperture size; : distance to image plane; : uniformly sampled random 2d vectors in ; : 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, ) S t motion blur C(t, š t) = 1 raytrace(e, d, ) d š t d sb [t,t+š t] S s l s E d S t t t : any ray origin; : any ray direction; : scene at time ; : time when shutter opens; š t = t k+1 š t : time that shutter stays open; t k : 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 1 Ë CÌ = raytrace(e, Q E, ) N K N i S ti E Q t i [0, 1] N : camera origin; : point on image plane; : uniformly sampled random variable in ; : total number of samples 30
combining estimations e.g. compute soft shadows and antialias the pixel C C = l V(P(Q), S) sh(p(q), S) da d A P A S A Q L Q S Q B A P, S B A L [Bala] 31
combining estimations: path tracing idea: randomize the whole path compute all the integrals at once! [Bala] 32