nnouncements: Qui a Tracing On Frida (3/4), in class One 8.511 sheet of notes allowed Sample qui (from last ear) is posted online Focus on reading comprehension and material for Homeworks 0, 1, & 2 Last Time? Toda igid Bod Finite Element Method a Casting Stress/Strain Fracture Deformation Level of Detail Haptics a-plane Intersection a-sphere Intersection Point in Polgon a Tracing ecursive a Tracing Distribution a Tracing Durer s a Casting Machine a Casting lbrecht Durer, 16th centur For ever piel Construct a ra from the ee For ever object in the scene Finding the intersection and normal is the central part of ra casting Find intersection with the ra Keep if closest Shade depending on light and normal vector 1
ote on Local Shading a epresentation? Surface/Scene Characteristics: surface normal direction to light viewpoint Material Properties Diffuse (matte) Specular (shin) More later! L V Two vectors: Origin Direction (normalied is better) Parametric line (eplicit representation) P(t) = origin + t * direction P(t) direction origin Diffuse sphere Specular spheres 3D Plane epresentation? Plane defined b P o = (,,) n = (,B,C) Implicit plane equation H(P) = +B+C+D = 0 = n P + D = 0 Point-Plane distance? If n is normalied, distance to plane, d = H(P) d is the signed distance! H(p) = d > 0 P normal P o H P' H(p) = d < 0 Eplicit vs. Implicit? a equation is eplicit P(t) = o + t * d Parametric Generates points Harder to verif that a point is on the ra Plane equation is implicit H(P) = n P + D = 0 Solution of an equation Does not generate points Verifies that a point is on the plane a-plane Intersection dditional Housekeeping Intersection means both are satisfied So, insert eplicit equation of ra into implicit equation of plane & solve for t P(t) P(t) = o + t * d H(P) = n P + D = 0 n ( o + t * d ) + D = 0 t = -(D + n o ) / n d Verif that intersection is closer than previous P(t) < t current Verif that it is not out of range (behind ee) P(t) > t min P(t) 2
ormal eeded for shading diffuse: dot product between light and normal ormal of a plane is constant! normal a-triangle Intersection Use barcentric coordinates: P(α, β, γ) = αa + βb + γc with α + β + γ =1 If 0 < α < 1 & 0 < β < 1 & 0 < γ < 1 then the point is inside the triangle! c P d o a b How Do We Compute α, β, γ? atio of opposite sub-triangle area to total area α = a / β = b / γ = c / Use signed areas for points outside the triangle a P α > 0 c a b a But how do I know if the point is outside the triangle? That s what I was tring to determine! P α < 0 c b a Using Cramer s ule Used to solve for one variable at a time in sstem of equations β = t = o o o d d d γ = o o o o o o denotes the determinant Can be copied mechanicall into code d d d Sphere epresentation? Implicit sphere equation ssume centered at origin (eas to translate) H(P) = P P - r 2 = 0 a-sphere Intersection Insert eplicit equation of ra into implicit equation of sphere & solve for t P(t) = o + t* d H(P) = P P - r 2 = 0 ( o + t d ) ( o + t d ) - r 2 = 0 d d t 2 + 2 d o t + o o - r 2 = 0 d o d o 3
a-sphere Intersection Quadratic: at 2 + bt + c = 0 a = 1 (remember, d = 1) b = 2 d o c = o o r 2 Questions? with discriminant and solutions What does it mean if there are no solutions, 1 solution, or 2 solutions? depth normals local shading Toda a Casting a Tracing Shadows eflection efraction ecursive a Tracing Distribution a Tracing How Can We dd Shadows? Find the point to be shaded For ever light, Construct ra from point to light For ever object find intersection of ra with object If no objects between point and light dd contribution from light Mirror eflection eflection Cast ra smmetric with respect to the normal Multipl b reflection coefficient (color) eflection angle = view angle = V 2 (V ) V θ V θ V V V 4
Transparenc Qualitative efraction Cast ra in refracted direction Multipl b transparenc coefficient (color) From Color and Light in ature b Lnch and Livingston efraction efraction & the Sidedness of Objects η i η T I = cos Ө i M sin Ө i Make sure ou know whether ou re entering or leaving M sin Ө M = ( cos Ө i I) / sin Ө i i I Ө i - cos Ө i Ө T T Snell-Descartes Law: η i sin Ө i = η T sin Ө T sin Ө T η = i = ηr sin Ө i η T M T = cos Ө T + M sin Ө T = cos Ө T + ( cos Ө i I) sin Ө T / sin Ө i = cos Ө T + ( cos Ө i I) η r = [ η r cos Ө i cos Ө T ] η r I = [ η r cos Ө i 1 sin 2 Ө T ] η r I = [ η r cos Ө i 1 η r 2 sin 2 Ө i ] η r I = [ η r cos Ө i 1 η r 2 (1 cos 2 Ө i ) ] η r I = [ η r ( I) 1 η r 2 (1 ( I) 2 ) ] η r I Total internal reflection when the square root is imaginar Don t forget to normalie! the transmissive material: I η i =1 η T = material inde T η i = material inde η T = 1 What about intersecting transparent objects? I T Total Internal eflection Questions? From Color and Light in ature b Lnch and Livingston 5
eadings for Toda: (read both) Toda "n improved illumination model for shaded displa" Turner Whitted, 1980. "Distributed a Tracing", Cook, Porter, & Carpenter, SIGGPH 1984. a Casting a Tracing ecursive a Tracing Distribution a Tracing a Tracing The a Tree trace ra Intersect all objects color = ambient term For ever light cast shadow ra color += local shading term If mirror color += color refl * trace reflected ra If transparent color += color trans * trace transmitted ra Does it ever end? Stopping criteria: ecursion depth Stop after a number of bounces a contribution Stop if reflected / transmitted contribution becomes too small T 3 2 2 T 1 3 1 3 L 2 1 L 3 L 1 i surface normal i reflected ra L i shadow ra Ee T i transmitted (refracted) ra 2 Ee L 1 1 T 1 L 2 3 Compleit? T 3 L 3 a Debugging Toda Visualie the ra tree for single image piel incoming reflected ra shadow ra transmitted (refracted) ra a Casting a Tracing ecursive a Tracing Distribution a Tracing Soft shadows ntialiasing (getting rid of jaggies) Gloss reflection Motion blur Depth of field (focus) 6
Shadows Shadows & Light Sources one shadow ra per intersection per point light source no shadow ras http://www.davidfa.com/inde.php one shadow ra http://3media.initialied.org/photos/2000-10-18/inde_gall.htm clear bulb frosted bulb http://www.pa.uk.edu/~sciworks/light/preview/bulb2.htm Soft Shadows ntialiasing Supersampling multiple shadow ras to sample area light source multiple ras per piel jaggies w/ antialiasing one shadow ra point light lots of shadow ras area light eflection one reflection ra per intersection Gloss eflection multiple reflection ras Justin Legakis θ θ perfect mirror θ θ polished surface 7
Motion Blur Sample objects temporall Depth of Field multiple ras per piel ob Cook film focal length Justin Legakis a Tracing lgorithm nalsis eading for Tuesda 3/8: a casting Lots of primitives ecursive Distributed a Tracing Effects Soft shadows nti-aliasing Gloss reflection Motion blur Depth of field cost height * width * num primitives * intersection cost * sie of recursive ra tree * num shadow ras * num supersamples * num gloss ras * num temporal samples * num focal samples *... can we reduce this? these can serve double dut Goral, Torrance, Greenberg & Battaile Modeling the Interaction of Light Between Diffuse Surfaces, SIGGPH '84 Post a comment or question on the LMS discussion b 10am on Frida 2/29 8