CS447/647: Image Synthesis University of Virginia Lecture #16 Thursday, 20 March 2003 Reflection Models I Lecture #16: Lecturer: Scribe: Reviewer: 1 Thursday, 20 March 2003 Greg Humphreys Rui Wang Nolan Goodnight Introduction Topics (to be covered in this lecture): • Types of reflection models; • the BRDF and reflectance; • The reflection function; • Ideal reflection and refraction; • The Fresnel effect; • Ideal diffuse. Definition⇒Reflection: The process of which light incident on a surface interacts with the surface such that it leaves on the incident side without change in frequency. Properties: • Spectra/Color: The color of materials (copper, gold, etc.) depends on atomic structures, surface properties, etc. This is not trivial. Parry Moon, in the 1940s, collected hundreds of spectra, noted that most of them were fairly smooth and classifited them into 6 types. • Polarization: This is mostly ignored by renderers. • Directional Distribution: Light strikes on a surface and is scattered in various directions ⇒ ”Reflection Model”. 2 CS447/647: Lecture #16 Figure 1: Three reflection models 2 Types of Reflection Models 1. Ideal Specular: Reflection law: θ1 = θ2 (e.g. mirror). 2. Ideal Diffuse: Light scattered equally in all directions (e.g. matte) 3. Specular or Glossy: Distribution peaked towards mirror. Fig.1 illustrates the three models. Real-world materials are usually a combination of several types of reflection models. 3 3.1 The Reflection Equation and BRDF The Reflection Equation In reflection we have a transfer function that records for a given incoming direction, the amount of light that is reflected in a certain outgoing direction. The function is called ”BRDF” (bi-directional reflectance distribution function). It’s 4 dimensional function written as fr (x, ωi , ωr ) or fr (ωi → ωr ). Since dE(x, ω) = L(x, ω) cos θdω, we multiply the irradiance by the transfer function and get the amount of light, in radiance, going in the outgoing direction. In ray tracing, we fix the outgoing direction (e.g. toward the eye) which is ωo , then integrate over all possible incoming direction ωi to get the reflected radiance: Z Lr (x, ωo ) = fr (x, ωi → ωr )Li (x, ωi ) cos θi dωi (1) H2 Eq. 1 is the reflection equation. If there are a number of point light sources, we can do a sum: X Lr (x, ωo ) = fr (x, ωi → ωr )Li (x, ωi ) cos θi (2) Lights This is the OpenGL rendering equation. Notation Lr instead of Lo is used to denote the outgoing direction in case of reflectance, because later we will include emitted, transmitted, etc. lights also in outgoing direction. Similar to BRDF, if we integrate over the hemisphere on the other side of the incoming ray direction, we can get the amount of transmitted light. Accordingly, the transfer function is named ”BTDF” (bi-directional transmission distribution function) ft . CS447/647: Lecture #16 3.2 3 BRDF The BRDF is the quantity that usually characterizes a certain material. We can think of it as a probability distribution function, that for a given incoming direction, the function tells the ’probability ’ of light going in some outgoing direction. The integration of BRDF over the hemisphere is no more than 1, because some light energy may be absorbed by R the material. So H 2 fr (ωi → ωr )dωi ≤ 1 and fr ≥ 0 are always true. The BRDF measures the amount of Radiance in the direction of ωr for some irradiance from direction ωi : dL(ωi → ωr ) . (3) fr (ωi → ωr ) = dE(ωi ) It’s a 4-dimensional function and the unit of it is s1r . In case it varies across the object surface (spatially varying BRDF), it will be a 6D function fr (x, ωi → ωr ). Typically this will be simplified into a separable product, such as modulating a 4D BRDF with a texture map. Note that other factors such as wavelength or even time (corrosion, etc.) can also be included in the BRDF. The BRDF is usually defined in local coordinate system while the incoming light is defined in global (world) coordinate. In lrt the incoming light will be transformed ~ , S, ~ T~ vectors in the DifferentialGeometry into local coordinate system defined by the N structure. 3.3 BSSRDF The BSSRDF (bi-directional surface scattering reflectance distribution function) is a generalization of the BRDF. This is taking into account the fact that light that hits a surface can exit at a different place on the surface (subsurface scattering). This is important for modelling translucency, e.g. materials such as marble. Fig.3 shows the rendering of a statue made of marble with and without simulating subsurface scattering. Now we have: dL(xi , ωi → xr , ωr ) (4) S(xi , ωi → xr , ωr ) = dΦi This is an 8D quantity! It can usually be simplified by making assumptions: −−→ 1. it only depends on the vector − x− r − xi 2. it’s radially symmetric: only depends on the distance between xi and xr . dL and S = dL . This is because the Notice the definition of BRDF and BSSRDF: fr = d E dΦ BRDF is integrated over solid angle while BSSRDF is integrated over angle+area. BRDF can be measure by using Gonioreflectometer : it has a gantry with 4 degrees of freedom, with a ’point’ light source and a camera. Fig.4 shows an example of the device. 4 CS447/647: Lecture #16 Figure 2: Subsurface Scattering Figure 3: A model made of marble rendered with and without considering subsurface scattering 3.4 Properties of BRDF 1. Reflection is linear The reflected light due to N light sources together is the same with computing the reflected light due to them individually and add them up. This is best shown by considering this: turn off all lights but one, take a picture, repeat. Then turn on all lights and take a picture. Add the single-light pictures together, they should appear the same as the all-light picture. (Not considering the non-linear response of the film). There are exceptions to the linear property of reflection: certain high-intensity laser, when passes through certain crystals, will double in frequency; also, if the incident light is so intense that the surface begins to glow (burn), this will be non-linear. 2. Reciprocity CS447/647: Lecture #16 5 Figure 4: Gonioreflectometer fr (ωr → ωi ) = fr (ωi → ωr ). If a photon arrives along ωi and is reflected along ωr , the probability of a photon being reflected from ωr to ωi must be the same. Note: transmission is not reciprocal. 3.Isotropy/Anisotropy BRDF is the same (isotropic) if the surface is rotated about the normal. This means the BRDF only depends on the difference between the two azimuthal angles: fr (θi , φi , θr , φr ) = fr (θi , θr , |φr − φr |) (5) Surfaces that look the same as they are rotated around the normal are called isotropic. Surfaces with directional features such as grooves, scratches or fibers are anisotropic. Examples of anisotropic materials include cloth, hair, brushed aluminium. Most materials are isotropic. 4.Energy Conservation The amount of light scattered from a surface has less energy than the light introduced. This property leads to the definition of another quantity called the reflectance. 4 Reflectance Definition⇒Reflectance(ρ): The ratio of reflected light power to incident light power: Φr ρ(Ωi → Ωr ) = d dΦi . Apparently 0 ≤ ρ ≤ 1 by conservation of energy, the part that is gone is due to absorbtion. 6 CS447/647: Lecture #16 Recall that for a differential solid angle, the radiance is the power per solid angle per projected unit area: dΦ L(dωi ) = (6) dωi dA cos θ Therefore, over some finite solid angle Γi , Γr , we have: Z Φi (Γi ) = Li (dωi ) cos θi dAdωi Γi = dA Z (7) Li (dωi ) cos θi dωi (8) Lr (dωr ) cos θr dωr (9) fr (dωi → dωr )Li cos θi dωi (10) Γi Similarly for reflected direction: Φr (Γr ) = dA We know Lr is: Lr = Z Γi Z Γr so, ρ= dA R R Γr Γi fr (dωi → dωr )Li (dωi ) cos θi cos θr dωi dωr R dA Γi Li (ωi ) cos θi dωi (11) Here dA is cancelled. Also, notice the ρ is a surface property that is not dependent on incoming ray, so we assume Li is constant and work out: ρ= 1 Z Z fr (dωi → dωr ) cos θi cos θr dωi dωr Ψi Γi Γr (12) R where Ψi is a geometric term: Ψi = Γi cos θi dωi . If Γi is the hemisphere, Ψi is exactly the projected solid angle of a hemisphere, which is π. Both Γi and Γr can be chosen from differential solid angle, finite solid angle and hemisphere (dω, Ω, H 2 ). Most common one is ρdH , or the directional-hemispherical reflectance (differential-hemispherical). 5 5.1 Examples Ideal Diffuse Reflection In ideal diffuse reflection, light is equally likely to be reflected in any output direction, independent of the incoming direction. Here the BRDF is constant. By definition: Lr (ωr ) = Z fr (ωi → ωr )Li (ωi ) cos θi dωi H 2Z = frd H2 = frd E Li cos θi dωi (13) (14) (15) CS447/647: Lecture #16 7 So the reflected light is proportional to the irradiance. If irradiance is due to a single point light source, it goes as cos θi , leading to Lr ∝ cos θi but fr is still constant, not dependent on cos θi . Now the radiosity (radiant exitance) is: B = Z H2 = Lr Lr (ωr ) cos θr dωr Z H2 cos θr dωr = πLr So the reflectance: ρHH = πLr B = = πfr E E (16) (17) (18) (19) Also fr = πρ . 5.2 Perfect Specular Reflection Consider a mirror with perfect specular reflection, (Fig.5), according to physics law, we have θi = θr and φr = φi ± π. Figure 5: Perfect Specular Reflection In the following, R, I, N are the reflected, incoming ray direction and surface normal, respectively. We know R + (−I) = 2 cos θN = −2(I • N )N , hence R = I − 2(I • N where • means dot product. Because it’s perfect specular, Lr (θr , φr ) = Li (θr , φr ± π). The BRDF is apparently zero everywhere EXCEPT the outgoing direction. So we guess 0 frm (θi , φi , θr , φr ) = δ(cos θi − cos θr )δ(φi − φr ± π) (20) However, there is a constant term that this initial guess is missing. We can recompute the radiance and find out the constant term: Lr (θr , φr ) = Z H2 δ(cos θi − cos θr )δ(φi − φr ± π)Li (θi , φi ) cos θi dωi = Li (θr , φr ± π) cos θi (21) (22) 8 CS447/647: Lecture #16 So we add the cos θi term to the initial guess and obtain: frm = 5.3 δ(cos θi − cos θr )δ(φi − φr ± π) cos θi (23) Perfect Specular Refraction Refer to Fig.6, according to Snell’s Law, ni sin θi = nt sin θt . Or it’s written as ni N × I = nt N × T since the norm of the cross product × is equal to the sine of the angle. To compute T from I: N ×T = nnti N ×I, if we denote µ = nnti , we have N ×(T −µI) = 0. This means T −µI is co-linear with N so T −µI = γN , but T is a unit vector: T •T = 1. Hence (µI + γN ) • (µI + γN ) = 1. Solving the quadratic equation, we have γ = µ cos θi − cos θt . Figure 6: Perfect Specular Refraction Note that for the solutions of the quadratic equation to stand, it must satisfy that 1 − µ2 sin2 θi < 0; when this is not satisfied, we say the total reflection happens. If 1 − µ2 sin2 θi = 0, we have θ = arcsin( nnti ) and this is called the critical angle. Fig.7 shows the phenomenon. This is also the reason why wet materials look darker: because some of the light shooting in the material is reflected off and never refracted back. This essentially means radiance increases when a ray crosses the interface. Consider an infinitesimal beam striking a surface patch dA, the incident beam has power dΦi = Li dAdωi cos θi , and the transmitted beam has power dΦt = Lt dAdωt cos θt , by conservation of energy: Li dAdωi cos θi = Lt dAdωi cos θt dωi cos θi Lt = L i dωt cos θt (24) (25) now using the differential solid angle: Lt = Li cos θi sin θi dθi dφi cos θt sin θt dθt dφt (26) CS447/647: Lecture #16 9 According to Snell’s Law ni sin θi = nt sin θt , differentiate it will get to: ni cos θi dθi = nt cos θt dθt . Also since φt = φi ± π, we have dφt = dφi . Substitute all these terms in two Eq.26, we get: nt (27) Lt = Li ( )2 ni Figure 7: Total Reflection 5.4 Fresnel Reflectance Reflectance is actually a function of the angle of incidence. Fig.8 shows the reflectance as a function of viewing angle. This effect is different for metals and for dielectrics. The formula are derived from Maxwell’s equations at a surface boundary, enforcing energy conservation and continuity. Although compared with metals, dielectrics are very nonreflective at normal, it becomes perfectly reflective when the viewing angle becomes bigger. Christopher Schlick found a nice approximation of the formula given F (θ) = F (0) + (1 − F (0))(1 − cos θ)5 (28) Fig.9 shows an example of reflection off a glossy (varnished) floor. Notice more reflection happens at large gazing angle. This is an important effect. 10 CS447/647: Lecture #16 Figure 8: Fresnel Reflectance Figure 9: Reflection of a book on a glossy floor