Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Path Tracing and More Notation again • L(P, w): light leaving P in direction w • To estimate light arriving at the eye, we trace to a point P, and compute L(P, w), where w points from P to the eye. • Five terms: 1. 2. 3. 4. 5. Emitted light E(P,w) diffusely scattered direct light specularly scattered direct light diffusely scattered indirect light specularly scattered indirect light 1. diffusely scattered direct light: 1. 2. Single-sample estimate, samples taken over light sources include visibility term, squared distance, dot product with light-normal 2. specularly scattered direct light 1. Integral reduces to a sum over "impulse directions" 3. diffusely scattered indirect light 1. Single sample estimate 4. specularly scattered indirect light 1. Integral reduces to a sum over "impulse directions" • Can combine 2 and 4 to specular scattering of total light from specularreflection direction • Case 3 requires computing radiance leaving some point Q, but only scattered, not emitted. • Our "estimateL" procedure should take an extra parameter saying whether to include emitted radiance or not • Cases 3 and 4 involve recursion: control the probability of recurring (in 3) by the overall reflectance of the material at P or (in 4) by the "impulse factor". Classes of light paths (Heckbert, Shirley, ???) • L = light source (emitter) • S = specular • D = diffuse • E = eye • Regular-expression syntax • • • • *: zero or more ?: 0 or 1 +: 1 or more |: or • Read left-to-right Light path examples • • • • LE: a lamp in the scene that's visible to the eye. LDE: directly lit surface L(D|S)E: one bounce path from either a diffuse or specular surface Quiz: leaves light, then one or more diffuse bounces, then a specular bounce, then eye • Quiz 2: What light paths did your raytracer handle? • Note: 'light path' is a mistaken terminology • really describes a scattering sequence • LDE and LSE could both describe a path taken by a photon from a light point, to a surface point P, to the eye. • Note 2: sometimes extend notation to G (glossy) and T (transmission) Rendering algorithms and the paths they handle • Appel's ray-casting: L(D|G)E • Whitted ray-tracing: E [S*](D|G)L • Kajiya path-tracing: E [(D|G|S)+](D|G)]L • Radiosity: E D* L Transmitted light, reflected light, waves • The particle model isn't enough to explain the world • Week 1 phenomena: • • • • • • • • • • • • • • • double rainbows mirages crepuscular rays water vapor: why is water different colors in different phases? color when wet: wet dirt and wet wood both get darker shimmering oil on water hair color fuzzy things are lighter around edges Bokeh effect on cameras xmas light haloes/spikes nighttime red sky prisms and splitting into rainbow colors moon looks bigger near horizon transparent skim milk distant mountains look blue-grey Wave Theory of light explains many of these • Light is an electromagnetic wave • The electric field due to a beam of light is orthogonal to the direction of propagation; magnetic field orthogonal to both • Field is a planar wave: electric field is the same at all points of a plane perpendicular to direction of propagation. • Wave is sinusoidal • Moves with speed 𝑐 (speed of light) in empty space. • For a light-wave moving in the x direction, write 𝐸(𝑥, 𝑦, 𝑧, 𝑡) for electric field vector at point (𝑥, 𝑦, 𝑧) at time 𝑡. • Independent of 𝑦, 𝑧; so just write 𝐸 𝑥, 𝑡 • The vector points only in the 𝑦𝑧 plane, so 𝐸 𝑥, 𝑡 = 0, 𝐸𝑦 𝑥, 𝑡 , 𝐸𝑧 𝑥, 𝑡 Sinusoidal wave • 𝐸 𝑥, 𝑡 = 0, 𝐸𝑦 𝑥, 𝑡 , 𝐸𝑧 𝑥, 𝑡 • 𝐸𝑦 𝑥, 𝑡 = 𝑥 𝐴𝑦 sin(2𝜋 𝜆 − 2𝜋𝑓𝑡 + Δ𝑦 ) • 𝜆 = wavelength. Fix 𝑡, and this looks like a sine function that completes one period as 𝑥 ranges over a length 𝜆 • 𝑓= frequency. Fix 𝑥, and this looks like a sine function that varies up and down as 𝑡 1 ranges over a time period of length . 𝑓 • Δ𝑦 = phase offset: perhaps the sine wave isn't zero at 𝑥 = 𝑡 = 0, because the axes are shifted. • 𝐴𝑦 , 𝐴𝑧 are "amplitudes" that tell how bright the light is. • Total amplitude 𝐴 = 𝐴2𝑦 + 𝐴𝑧2 Sinusoidal wave • 𝐸 𝑥, 𝑡 = 0, 𝐸𝑦 𝑥, 𝑡 , 𝐸𝑧 𝑥, 𝑡 • 𝐸𝑦 𝑥, 𝑡 • 𝐸𝑧 𝑥, 𝑡 𝑥 = 𝐴𝑦 sin(2𝜋 𝜆 𝑥 = 𝐴𝑧 sin(2𝜋 𝜆 − 2𝜋𝑓𝑡 + Δ𝑧 ) 𝑥 = 𝐴𝑦 sin(2𝜋 𝜆 𝑥 = 𝐴𝑧 sin(2𝜋 𝜆 𝑐 − 2𝜋 𝑡 + Δ𝑦 ) 𝜆 𝑐 − 2𝜋 𝑡 + Δ𝑧 ) 𝜆 − 2𝜋𝑓𝑡 + Δ𝑦 ) • Because speed of light is 𝑐 (in empty space), this becomes • 𝐸𝑦 𝑥, 𝑡 • 𝐸𝑧 𝑥, 𝑡 i.e., 𝑓 = 𝑐 . 𝜆 Sinusoidal wave • 𝐸 𝑥, 𝑡 = 0, 𝐸𝑦 𝑥, 𝑡 , 𝐸𝑧 𝑥, 𝑡 • 𝐸𝑦 𝑥, 𝑡 • 𝐸𝑧 𝑥, 𝑡 𝑥 = 𝐴𝑦 sin(2𝜋 𝜆 𝑥 = 𝐴𝑧 sin(2𝜋 𝜆 𝑐 − 2𝜋 𝑡 + Δ𝑦 ) 𝜆 𝑐 − 2𝜋 𝑡 + Δ𝑧 ) 𝜆 • Relationship between 𝐴𝑦 and 𝐴𝑧 ? None. • Relationship between Δ𝑦 , Δ𝑧 ? None. • Difference Δ𝑦 − Δ𝑧 has interesting effect on shape of field. Δ𝑦 − Δ𝑧 = 0 • So Δ𝑦 = Δ𝑧 ; by adjusting position of axes, assume both are zero 𝑥 𝑐 𝐸𝑦 𝑥, 𝑡 = 𝐴𝑦 sin(2𝜋 − 2𝜋 𝑡) = 𝐴𝑦 sin 𝑄𝑥 + 𝑅𝑡 𝑥𝜆 𝑐𝜆 𝐸𝑧 𝑥, 𝑡 = 𝐴𝑧 sin(2𝜋 − 2𝜋 𝑡) = 𝐴𝑧 sin 𝑄𝑥 + 𝑅𝑡 𝜆 𝜆 • These are multiples of one another. • "Linearly polarized" • Sketch! 𝜋 Δ𝑦 − Δ𝑧 = 2 • So Δ𝑦 = Δ𝑧 ; by adjusting position of axes, assume are zero 𝑥 𝑐 𝐸𝑦 𝑥, 𝑡 = 𝐴𝑦 sin(2𝜋 − 2𝜋 𝑡) = 𝐴𝑦 sin 𝑄𝑥 + 𝑅𝑡 𝑥𝜆 𝑐𝜆 𝐸𝑧 𝑥, 𝑡 = 𝐴𝑧 sin(2𝜋 − 2𝜋 𝑡) = 𝐴𝑧 sin 𝑄𝑥 + 𝑅𝑡 𝜆 𝜆 • These are multiples of one another. • "Linearly polarized" • Sketch! 𝜋 Δ𝑦 − Δ𝑧 = 2 • So Δ𝑦 = Δ𝑧 + 𝜋 ; 2 by adjusting position of axes, assume Δ𝑧 = 0 𝑥 𝑐 𝜋 𝐸𝑦 𝑥, 𝑡 = 𝐴𝑦 sin(2𝜋 − 2𝜋 𝑡) = 𝐴𝑦 sin 𝑄𝑥 + 𝑅𝑡 + 𝜆𝑥 𝜆𝑐 2 𝐸𝑧 𝑥, 𝑡 = 𝐴𝑧 sin(2𝜋 − 2𝜋 𝑡) = 𝐴𝑧 sin 𝑄𝑥 + 𝑅𝑡 𝜆 𝜆 • Rewrite slightly 𝐸𝑦 𝑥, 𝑡 = 𝐴𝑦 cos 𝑄𝑥 + 𝑅𝑡 𝐸𝑧 𝑥, 𝑡 = 𝐴𝑧 sin 𝑄𝑥 + 𝑅𝑡 (where I've absorbed a sign-change into 𝐴𝑦 ) • "Circularly polarized" Other cases 𝜋 : 2 • 𝐴𝑦 and 𝐴𝑧 are different, or Δ𝑦 − Δ𝑧 isn't a multiple of elliptical polarization • Theorem: Every wave can be written as a sum of a linearly and a circularly polarized wave. • Corollary: Understanding these two cases lets you know the whole story. What happens when light is in a conductive or semi-conductive material? • Electric potential is constant along conductors • So electric field, in direction of conductors, is zero (or near zero, for slightly resistive conductors) • As light passes through a material with many embedded wires… • the electric field in the horizontal direction gets killed off • …and the wires heat up Wires in a transparent material??? • Yep! • You stretch plastic in one direction as it cools, aligning long, slightly conductive, molecule chains with the stretch-axis • Get "polarized plastic" • Make sunglasses from it and sell them for $$$ Polarization of everyday light • Total mix of polarizations and amplitudes • When such light passes through a linear polarizer, it's attenuated by about a factor of 0.7 ≈ 2 . 2 • But it comes out linearly polarized! Wave-like light at non-conducting interfaces (like water) • • • • • Sum of waves at the interface must be zero Light moves more slowly in the water Light has same frequency in the water, hence different wavelength 𝑐 𝜈 = . 𝜈 called "index of refraction". Often written 𝑛 instead of 𝜈. v Always at least 1. Continuity of electric field at interface • To make the arriving and refracted fields "line up", need this picture: 𝜃1 𝑛1 𝑛2 𝜃2 𝑛2 𝑛1 = sin 𝜃1 sin 𝜃2 in Refraction at interface • 𝑛2 𝑛1 = sin 𝜃1 sin 𝜃2 • "Snell's Law" (Willebrord Snellius, 1580 – 1626 CE) • Ibn Sahl (984 CE) At interface, energy changes • Energy is related to 𝐴𝑓 … but 𝐴 gets altered • For energy balance, and not just continuity, there must be a reflected wave as well • • • • Again, assumes no heating losses in material! Continuity says 𝜃r = 𝜃i 𝜃t determined by Snell/Sahl What about magnitudes? 𝜃𝑖 𝜃𝑟 𝑛1 𝑛2 𝜃𝑡 Reflected/transmitted magnitudes • For light whose electric field is in the plane of the scattering surface (p-polarized light) the fraction reflected 𝑅𝑝 given by 𝑛2 cos 𝜃𝑖 − 𝑛1 cos 𝜃𝑡 𝑟𝑝 = ; 𝑅𝑝 = 𝑟𝑝2 𝑛2 cos 𝜃𝑖 + 𝑛1 cos 𝜃𝑡 • Fraction transmitted 𝑇𝑝 = 1 − 𝑅𝑝 • For light whose electric field is in the plane determined by the normal and the propagation direction (s-polarized), 𝑛1 cos 𝜃𝑖 − 𝑛2 cos 𝜃𝑡 𝑟𝑠 = ; 𝑅𝑠 = 𝑟𝑠2 𝑛1 cos 𝜃𝑖 + 𝑛2 cos 𝜃𝑡 Consequences • Incoming equal mix of s- and p-polarized waves is reflected/transmitted as an unequal mix of s- and p-polarized waves • Common to assume arriving light is equal-mix polarized • In that case, reflected energy fraction is 1 𝑅𝐹 = (𝑅𝑠 + 𝑅𝑝 ) 2 • "F" is for Fresnel • Radiance changes at interfaces because of speed-of-light change, affecting wavelength. 𝐿 𝑃, 𝜔𝑟 = 𝑅𝐹 𝐿 𝑃, −𝜔𝑖 𝑛22 𝐿 𝑃, 𝜔𝑡 = (1 − 𝑅𝐹 ) 2 𝐿 𝑃, −𝜔𝑖 𝑛1 Getting Fresnel effects right • Surprisingly difficult • When we move from a dense medium (e.g., glass) to a less-dense one (e.g., air), with 𝑛1 > 𝑛2 , there's an angle at which 𝑅𝑠 = 𝑅𝑝 = 1, i.e., all light is reflected. Approx 41 degrees for glass in air. • Called "total internal reflection"; essential for some touch interfaces.