Qui Discussion a Tracing Announcements: Final Projects Last Time? Everone should post one or more ideas for a final project on the discussion forum (it was our assignment over Spring Break) Connect with potential teammates (teams of 2 strongl recommended) Start reading background papers Proposal & summar of background research will be due in a couple weeks igid Bod Finite Element Method Toda Durer s a Casting Machine a Casting Albrecht Durer, 16th centur 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 1
a Casting A ote on Local Shading For ever piel Construct a ra from the ee For ever object in the scene Find intersection with the ra Keep if closest Finding the intersection and normal is the central part of ra casting Shade depending on light and normal vector Surface/Scene Characteristics: surface normal direction to light viewpoint Material Properties Diffuse (matte) Specular (shin) More later! L V Diffuse sphere Specular spheres a epresentation? Two vectors: Origin Direction (normalied is better) Parametric line (eplicit representation) P(t) = origin + t * direction P(t) direction origin 3D Plane epresentation? Plane defined b P o = (,,) n = (A,B,C) Implicit plane equation H(P) = A+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-plane Intersection 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 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 2
Additional Housekeeping 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 ormal For shading diffuse: dot product between light and normal ormal is constant normal P(t) 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 How Do We Compute α, β, γ? atio of opposite sub-triangle area to total area α = A a /A β = A b /A γ = A c /A Use signed areas for points outside the triangle c P A P A a d o a b a b Using Cramer s ule Used to solve for one variable at a time in sstem of equations β = o o o A d d d γ = A o o o d d d Sphere epresentation? Implicit sphere equation Assume centered at origin (eas to translate) H(P) = P P - r 2 = 0 t = A o o o denotes the determinant Can be copied mechanicall into code d o 3
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 a-sphere Intersection Quadratic: at 2 + bt + c = 0 a = 1 (remember, d = 1) b = 2 d o c = o o r 2 with discriminant and solutions d o What does it mean if there are no solutions, 1 solution, or 2 solutions? Questions? Toda a Casting a Tracing Shadows eflection efraction ecursive a Tracing Distribution a Tracing depth normals local shading How Can We Add 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 Add contribution from light Mirror eflection Cast ra smmetric with respect to the normal Multipl b reflection coefficient (color) 4
eflection eflection angle = view angle = V 2 (V ) Transparenc Cast ra in refracted direction Multipl b transparenc coefficient (color) V θ V θ V V V Qualitative efraction efraction M sin Ө i I = cos Ө i M sin Ө i M = ( cos Ө i I) / sin Ө i From Color and Light in ature b Lnch and Livingston η i η T 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! efraction & the Sidedness of Objects Make sure ou know whether ou re entering or leaving the transmissive material: Total Internal eflection I η i =1 η T = material inde T η T = 1 I η i = material inde T What about intersecting transparent objects? From Color and Light in ature b Lnch and Livingston 5
Questions? eadings for Toda: (read both) "An improved illumination model for shaded displa" Turner Whitted, 1980. "Distributed a Tracing", Cook, Porter, & Carpenter, SIGGAPH 1984. Toda a Casting a Tracing ecursive a Tracing Distribution a Tracing a Tracing 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 The a Tree a Debugging Ee Visualie the ra tree for single image piel T 3 2 2 T 1 1 3 3 L 1 L 2 1 T 1 1 L 3 L 1 L 2 L 3 i surface normal Ee 2 3 T 3 i reflected ra L i shadow ra T i transmitted (refracted) ra Compleit? incoming reflected ra shadow ra transmitted (refracted) ra 6
Toda a Casting a Tracing ecursive a Tracing Distribution a Tracing Soft shadows Antialiasing (getting rid of jaggies) Gloss reflection Motion blur Depth of field (focus) Shadows one shadow ra per intersection per point light source no shadow ras one shadow ra Shadows & Light Sources Soft Shadows multiple shadow ras to sample area light source one shadow ra http://www.davidfa.com/inde.php 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 lots of shadow ras Antialiasing Supersampling eflection multiple ras per piel jaggies w/ antialiasing one reflection ra per intersection point light area light θ θ perfect mirror 7
Gloss eflection multiple reflection ras Motion Blur Sample objects temporall Justin Legakis θ θ polished surface ob Cook Depth of Field a Tracing Algorithm Analsis film multiple ras per piel focal length Justin Legakis a casting Lots of primitives ecursive Distributed a Tracing Effects Soft shadows Anti-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 eading for Frida 3/19: Goral, Torrance, Greenberg & Battaile Modeling the Interaction of Light Between Diffuse Surfaces, SIGGAPH '84 Post a comment or question on the LMS discussion b 10am on Frida 2/29 8