1mjb – January 29, 2013Spectral Effects:Chromatic Refraction and Wavelength InterferenceMike [email protected] State Universitymjb – January 29, 2013~ 41 °RainbowsColor λ η Θ cosΘ ΘΘRed ≈ 650 nm 1.510 42° 0.743 50.0°Green ≈ 500 nm 1.519 41° 0.755 51.5°Blue ≈ 400 nm 1.528 40° 0.766 53.0°PrimaryRainbowSecondaryRainbow2mjb – January 29, 2013Rainbow Strategy1. Draw one big quadrilateral across the scene2. Anywhere that .7400 ≤ cos(Θ) ≤ .7700, paint a color3. Otherwise, discard.Or anything else, really. You just need a large “fragment-generator”.mjb – January 29, 2013Spectral Colorsλ450525600RB G YC1.0490 565floatPulse( float min, float max, float tol, float t ){float a = min - tol;float b = min + tol;float c = max - tol;float d = max + tol;return smoothstep(a,b,t) - smoothstep(c,d,t);}vec3 SunDirection = vec3( 0., SunY, 10. );vec3 PtToSun = normalize( SunDirection );vec3 PtToEye = normalize( vec3(0.,0.,0.) - ECposition );float costheta = dot( PtToEye, PtToSun );float R = Pulse( .7400, .7490, Tol, costheta );float G = Pulse( .7490, .7605, Tol, costheta );float B = Pulse( .7605, .7700, Tol, costheta );6504003mjb – January 29, 2013Spectral Colorsλ600 nmRB G YC1.0float t = ( λ – 400. ) / ( 600. – 400. );vec3 rgb = Rainbow( t );400 nm0.0mjb – January 29, 2013OilAirWaterdOil Slicksλ450 525600RB G YC1.0Phase changeNo phase changeλn= λ/ηReinforces when 2d = λn · (m+½)λCancels when 2d = λn · (m)η ≈ 1.421*2+=mdηλ4mjb – January 29, 2013dφiφrABOn the way in, A travels dcos(φi) less than B. On the way out, A travels dcos(φr) more than B.So, wavelengths reinforce when abs[ dcos(φi) - dcos(φr) ] is a multiple of the wavelength = mλλ* = d x | cos(φi) - cos(φr) | / mddΘrφiFor a CD, d = 1600 nmFor a DVD, d = 740 nmDiffraction Gratingsmjb – January 29, 2013dABiΦcosidΦdrΦcosrdΦAB5mjb – January 29, 2013dφiφrABThen, cos(φi) is ToLight•TangentAnd, cos(φr) is ToEye•(-Tangent)So that cos(φi) - cos(φr) is: Tangent•(ToLight + ToEye)Diffraction Gratingsλ* = d x | cos(φi) - cos(φr) | / mddΘrφiCall the unit vector from the point to the light ToLight.Call the unit vector from the point to the eye ToEye.Call the transformed tangential unit vector
View Full Document