Reflection and Transmission Ed Angel Professor Emeritus of Computer Science University of New Mexico E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012
Introduction Interactions between light and materials Blinn-Phong model Absorption Diffuse and specular reflections Purely local Reflection: Translucent surfaces Refraction Frensel effect Chromatic dispersion E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012
Global vs Local Most of these effects can only be computed in a global renderer such as a ray tracer E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012
Ray Tracing Ray tracers can make use of all these effects in a global calculation by tracing rays N R L T -N E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012
Environmental Map Can use all these effects Implement in Cg with vertex and fragment programs E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012
Refraction With pure refraction, all the light is transmitted but the angle of refraction is determined by Snell’s law ήl sin θl = ήt sin θt where ήl and ήt are the speed of light relative to the speed of light in a vacuum Let ή = ήl / ήt E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012
Computing T ή2 sin2θl = ή2 (1- cos2θl )= sin2θt = 1-cos2θt Solving for cos θt Assuming normalized vectors cos θt = T·N = (1- ή2 (1-cos2θl ))1/2 where cos θl = T·N T, N, and L must be coplanar T = a L + b N and T·T = 1 Solving T = -1/ ή L – (cos θt - 1/ ή cos θl ) N E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012
Notes Critical angle: total internal reflection 1= ή2 (1-cos2θl ) Snell’s law is a statement that light takes the shortest path (in time) Can apply to reflection maps (see Cg Tutorial) via vertex program E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012
Fresnel Effect Some light is reflected and some transmitted at surface between two materials Amount of light reflected is greatest at shallow angle Approximation: use affine combination of refracted and reflected colors where a = max (0, min(1, bias + scale (1 + L·N)power)) E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012
Chromatic Dispersion The refraction coefficient is actually a function of wavelength h = h(l) N L -N Tr Tg Tb E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012
Chromatic Dispersion with Shaders Easy to do with reflection maps Use three values of h Make use of vector operations E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012