Reflection and Refraction Lecture #21 Tuesday, ovember 18, 2014 How about Interreflections! ote reflections! Granite tabletop! Visible on base! Also on handle This is a featured picture on the English language ikipedia (Featured pictures) and is considered one of the finest images. (October 2012) Attribution: Greg L at en.wikipedia [CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0) or GFDL (http://www.gnu.org/copyleft/fdl.html)], via ikimedia Commons 12/2/14 Bruce Draper & J. Ross Beveridge 2013 2
Rationale for Interreflections! ot all the light striking a surface comes directly from a light source.! Some reflects off one surface onto another.! Diffuse often ignores reflected light:! Because its small, and we can get away with it! Because it is very expensive to compute! Specular reflection much more sensitive! Just consider reflections in previous image. 12/2/14 Bruce Draper & J. Ross Beveridge 2013 3 Interreflections v L In the case of mirrors or shiny objects, this can have a major impact 12/2/14 Bruce Draper & J. Ross Beveridge 2013 4
Recursive Ray Tracing! To add interreflections to the specular reflection term, we need to know the light hitting the surface in reflection direction.! Cast a ray in reflection direction! See what surface it hits! Calculate the light of that surface point! this is what we did for the viewing ray! 12/2/14 Bruce Draper & J. Ross Beveridge 2013 5 Reflection and Refraction! P is the point on surface A! is the surface normal of A at P! L is a vector from P to a light source! signed oposite of ray being traced L H R! H is the reflection of -L hitting A at P! R is the reflection of - hitting A at P! T is the refraction for - hitting A at P A P θ t T Add the result of ray tracing with R to the ambient, diffuse and specular components at P. If semi-transparent, also add ray tracing with T. 12/2/14 Bruce Draper & J. Ross Beveridge 2013 6
Translucence! Some light passes through the material.! Typically, passed through light gets the diffuse reflection properties of the surface, unless object is 100% translucent (i.e. transparent)! Speed of light is a function of the medium! This causes light to bend at boundaries! example: looking at the bottom of a pool 12/2/14 Bruce Draper & J. Ross Beveridge 2013 7 Refraction - ith Trigonomety! Key is Snell s law angle of incidence θ r angle of refraction sin( θ t )= η i sin η t η i index of refraction material #1 η t index of refraction material #2 ( ) R The refraction ray is: " T = η i $ cos # η t ( ) cos( θ t ) % ' η i & η t θ t T 12/2/14 Bruce Draper & J. Ross Beveridge 2013 8
Practical Refraction: Solids! hen light enters a solid glass object? η air = 1.0 η glass = 1.5 Theta i Sin mu Theta r 0 0.00 0.67 0.00 10 0.17 0.67 6.67 20 0.34 0.67 13.33 30 0.50 0.67 20.00 40 0.64 0.67 26.67 50 0.77 0.67 33.33 60 0.87 0.67 40.00 70 0.94 0.67 46.67 80 0.98 0.67 53.33 90 1.00 0.67 60.00 " θ r = sin 1 η i % $ sin( )' = sin 1 # η r & ( 0.67 sin( )) 12/2/14 Bruce Draper & J. Ross Beveridge 2013 9 More Recursion! This changes ray tracing from tail-recursion to double-recursion light1 light2 camera This is the recursive Refraction ray light3 12/2/14 Bruce Draper & J. Ross Beveridge 2013 10
Practical Refraction: Surfaces! hat happens as it passes through a solid or surface? sinθ 1 = η i η r sin sin = η r η i sinθ 2 sinθ 1 = η i η r η r η i sinθ 2 = sinθ 2 " Overall effect: displacement of the incident vector ote: this assumes the two surfaces of the solid are coplanar! 12/2/14 Bruce Draper & J. Ross Beveridge 2013 11 Refraction - o Trigonometry. First Constraint: Snells Law T = α + β sin( ) 2 µ 2 = sin( θ t ) 2 µ = µ i µ t R ( 1 cos( ) 2 ) µ 2 =1 cos( θ t ) 2 1 ( ) 2 ( ) 2 ( ) µ 2 =1 T ( 1 ( ) 2 ) µ 2 =1 α + β ( ( )) 2 - θ t T This approach based on notes by Drew Kessler and Larry Hodges at Georgia Tech. 12/2/14 Bruce Draper & J. Ross Beveridge 2013 12
Refraction - o Trigonometry Second Constraint: Refraction ray is unit length. T T = ( α + β) α + β = α 2 + 2αβ ( ) =1 ( ) + β 2 =1 Two quadratic equations in two unknowns. Solving is a bit involved, next slide & writeup. Here is the answer. α = µ β = µ ( ) 1 µ 2 + µ 2 ( ) 2 12/2/14 Bruce Draper & J. Ross Beveridge 2013 13 hat if in other Direction? T = α + β sin( ) 2 µ 2 = sin( θ t ) 2 µ = µ i µ t ( 1 cos( ) 2 ) µ 2 =1 cos( θ t ) 2 1 ( ) 2 ( ) 2 ( ) µ 2 =1 T ( 1 ( ) 2 ) µ 2 =1 α + β ( ( )) 2 Squaring makes sign change irrelevant here. - θ t T R But! Choice between multiple quadratic solutions change. So α = µ β = µ ( ) 1 µ 2 + µ 2 ( ) 2 Here there was a sign error until 12/02/14 what you see now is fixed. 12/2/14 Bruce Draper & J. Ross Beveridge 2013 14
A onderful Real Example https://physicsb-2009-10.wikispaces.com Yes, refraction does make everthing upside down and backwards. 12/2/14 Bruce Draper & J. Ross Beveridge 2013 15 The Ugly Truth About Pixels! Ray tracing (as described so far) treats pixels as points on the image plane Simple Pixel Center eighted Area Sample Pixels actually sample light over some area 12/2/14 Bruce Draper & J. Ross Beveridge 2013 16
Two Approaches! Supersampling! Uses an even sampling across the pixel area.! For example, divide pixel into four, nine, sixteen, etc.! Adaptive Sampling! Divide pixel, compute values for each piece! If nearly equal, average! Otherwise, recurse 12/2/14 Bruce Draper & J. Ross Beveridge 2013 17 Uniform Adaptive Sampling! Sample pixel corners.! If pixel corners are near equal, then take average.! Else, subdivide into four sub pixels and repeat. 12/2/14 Bruce Draper & J. Ross Beveridge 2013 18
Stochastic Sampling! Stochastic sampling for distributing rays! One approach:! Divide the pixel into sixteen subpixels! Uniformly draw a point from within each! Average the result! Here is an example: 12/2/14 Bruce Draper & J. Ross Beveridge 2013 19 Uglier Truths - Digital Pixels! Gaps between columns (or rows) for wiring space! Leads to non-square pixels, dead zones! If pixel is overexposed, value is clipped to max, but excess current may bloom neighboring pixels 12/2/14 Bruce Draper & J. Ross Beveridge 2013 20
here a Ray Exits a Sphere! e sketched this approach in class.! Simplification of general fast method. 12/2/14 Bruce Draper & J. Ross Beveridge 2013 21