Créer une présentation
Télécharger la présentation

Télécharger la présentation
## Local Illumination

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Local Illumination**CS 319 Advanced Topics in Computer Graphics John C. Hart**Local Illumination**• Study of how different materials reflect light • Optics • Geometric (yes) • Wave (not in this class) • Definition of radiance, the fundamental unit of light transfer in computer graphics • How the BRDF fr encapsulates the reflectance properties of a material • Global illumination, handled later, describes how light gets from one local illumination context to another**Radiometric Terms**• Photon (g) • Quantum of EM radiation • Color given by frequency (n) [1/s] • Radiant Energy (Q) • Measured in Joules (J) • Energy carried by a photon Q = hn [J] • Flux (F) • Light energy passing through a region per unit time • Measured in Watts (Joules/sec) F = dQ/ds [W=J/s] Planck’s constanth = 6.6262 10-34J s 60W light bulb meansthat 60J of energy passing through the glass each second.**Flux Density**• Measures distribution of flux (power) across surface area • Irradiance (E) – Incoming flux density E = dF/dA [W/m2] • How many photons reach a given surface area in a given amount of time E = dQ/dAds [W/m2] • Radiosity (B) – Outgoing flux density B = dF/dA [W/m2] • a.k.a. exitance**Hemispherical Projection**dw r • Use a hemisphereW over surface to measure incoming/outgoing flux • Replace incoming light with its image on hemisphere • Projected area forms a solid angle dw • Solid angle measured by steradian (sr) which corresponds to an area of r2 on sphere of radius r • Area of sphere = 4pr2 • 4p steradians in a sphere • 2p in a hemisphere • Hemispherical projection of source a distance d away is proportional to 1/d2 A d ~A/d2 A A 1**Intensity**• Intensity (I) – Power (flux) per unit solid angle (W/sr) I = dF/dw • Flux is the intensity distributed over a solid angle dF = Idw • The power of a point light source is its intensity integrated across the sphere • For an isotropic point light source I = F/4p Can increase the intensity of a lightbulb by covering some of it with a mirrored paint, forcing more photons (some of them reflected) through a smaller solid angle. 4p sr FW**dq1=dq2 but dA1dA2**Foreshortening Equal Intensities dq1 • Angled light spreads wider across a surface than perpendicular light dA1 = dA2 cosq2 • Foreshortening scales the flux density measured on the hemisphere to the flux density on the surface • E.g. irradiance is the foreshortened (cosqi) incident flux (Iidwi) Ei = Iidwi cosqi • Hemispherical projection automatically foreshortens source (but not destination) dq2 dA1 dA2 Unequal irradiances A q (A/d2) cos q d 1 Source foreshortening**Radiance**• Radiance (L) – Power per unit solid angle per unit area (W/(srm2)), foreshortened • Radiance allows flux to be integrated across surface area and solid angle • Integration across all four degrees of freedom for a line • Two DOF for its position • Two DOF for its orientation w dw L(x,w) x dA**Radiance Derivation I**dS F • Consider the flux from source dS to receiver dR, and assume receiver is perpendicular to centerline between dS and dR • Radiance L(x,w) is the power received at point x from direction w • Flux from dS to dR is the power received by each point in each direction L(x,w) times the total number of points dR times the directions dw dF = L(x,w) dR dw • Unforshortened, the radiance is L(x,w) = dF/(dR dw) dw x dR dS dR**Radiance Derivation II**dS • Now consider different receiver dR’ • No longer perpendicular to centerline • Flux between dS and dR’ identical to flux between dS and dR • But area of dR’ is larger than dR dR = dR’ cos q • General flux equation is thus dF = L(x,w) dR dw = L(x,w) dR’cos qdw • Solve for the radiance L(x,w) = dF/(dR’cos qdw) dw x dR’**Radiance v. X**• Intensity is radiance across solid angle dI = L cos qdA • Irradiance is radiance across an area dE = L cos qdw 1/cosqforeshortening dF/dwFlux densitywrtspherical angle(Intensity) dF/dAFlux density wrt area(Irradiance)**The BRDF**wr wi dwr • Bidirectional Reflectance Distribution Function fr(wi, wr) • Measures the portion of incident irradiance (Ei) from wi that is reflected as radiance (Lr) toward wr fr(wi, wr) = dLr(wr)/dEi(wi) • Or the ratio between incident radiance and reflected radiance fr(wi, wr) = dLr(wr)/(Li(wi) cosqi dw) • BRDF can range from 0 to , especially when light comes in at grazing angles (cosqi 0) dwi wr wi Incident irradiance Ei is the surface power density of light incoming from direction wi**Illumination via the BRDF**• The Reflectance Equation • The reflected radiance is • the sum of the incident radiance over the entire hemisphere • foreshortened • scaled by the BRDF wr Incident irradiance Ei is the surface power density of light incoming from entire hemisphere W**6-D BRDF fr(wi, wr, x)**Incident direction L Reflected direction V Surface position x Textured reflection (BTDF) 4-D BRDF fr(wi, wr) Homogeneous material Anisotropic, depends on incoming azimuth e.g. hair, brushed metal, ornaments 3-D BRDF fr(qi, qr, fi – fr) Isotropic, independent of incoming azimuth e.g. Phong highlight 1-D BRDF fr(qi) Perfectly diffuse e.g. Lambertian Parameterizations**BRDF Attributes**• Helmholtz Reciprocity fr(wi, wr) = fr(wr, wi) • Materials are not a one-way street • Incoming to outgoing pathway same as outgoing to incoming pathway • Conservation of Energy • When integrated, must add to less than one • Materials must not add energy (except for lights) • Materials must absorb some amount of energy**Diffuse Reflection**• Uniform • Reflects power equally in all dirs. Lr(w1) = Lr(w2) • BRDF constant • Perfect • all incoming light is reflected Br = Ei q Why 1/p ? Because the incident light from a single direction is distributed as reflected light across all directions of the hemisphere, which leaves only a 1/p portion for each direction**Modeling BRDF’s**• Mathematical derivation • Use laws of physics, geometry • Statistical model of idealized material • Simulation • Model material directly • Render light reflected onto hemisphere • Measurement • Reflect real light off of real material • Gonioreflectometer**Dirac d Function** d(x) x • Defined by its behavior when integrated • Zero almost everywhere • Except at zero, where its infinite • Used to represent the illumination from a point light source S Li(wi) = LSd(wi – wS) • So… 0 S wr wS Reflected radiance Lr is just the incident radiance LS from the point source S foreshortened and scaled by the BRDF fr**The Reflectivity**Dwr Dwi • Reflected flux across a solid angle as a ratio of the incident flux received across a solid angle r(Dwi,Dwr) = dFr(Dwr)/dFi(Dwi) • Ratio of reflected intensity to incident intensity • Incident flux across a solid angle is the sum of differential**Illumination via Reflectivity**Ir = kara Ia (NL) +S (kdrd Id +ksrs Is) (NL) dw • Constants kd + ks = 1 • Intensities • Ia = average color of reflected light in scene • Id = color of material • Is = color of light source • Reflectivities • Ambient: ra(V,L) = 1/ (NL) – constant color regardless of surface orientation • Lambertian: rd(V,L) = 1 – reflects light uniformly in all directions • (Phong) Specular: rs(V,L) = (VR)n/ (NL) – focuses light in reflected direction