Lambert's Cosine
Total Page:16
File Type:pdf, Size:1020Kb
CSE 681 Illumination and Phong Shading What is Light? Physics tells us … “We don’t see objects, we see light reflected off of objects” “Light is a particle and a wave” The frequency of light What is Color? Our visual system perceives the visible spectrum as color Primary Colors A color is a summation of primary colors C(λ) = r(λ) + g(λ)G + b(λ)B g(λ) r(λ) b(λ) Definitions Illumination Transport of luminous flux One or more light sources where light hits a surface either directly or indirectly Shading The process of assigning a color to a pixel Illumination Models Approximations to light transport Goal: Physically correct models Illumination Light Sources (Emitters) Positional, directional, area Surfaces (Reflectors) Light source energy is cumulative (additive) Absorb and emit light Position and orientation Smooth vs. Micro –structure (roughness) General Problem Robert Cook (Siggraph 1984) “The intensity of reflected light at a point on a surface is an integral over the hemisphere above the surface of an illumination function L and a reflecance function f.” Analytically Local vs. Global Illumination Global Illuminate a point on a surface taking into account other surfaces Shadows, reflection, refraction, radiosity Local Illuminate a point on a surface assuming it is the only point in the scene Phong Illumination Model Ambient Gross (very cheap) approximation to indirect light hitting a surface after reflecting off of other surfaces Absorbs this light and reflects surface color Diffuse Light reflected off a surface equally in all directions after being absorbed by the surface (subsurface scattering) and then re-emitted Reflects surface color Specular Light reflected immediately off the surface Light is not absorbed Reflects light color The Phong Illumination Model Sum these three components: Illumination = ambient + diffuse reflection + specular reflection Surface Ambient (Global Illumination) Radiosity Calculate the propagation of light through the scene as it reflects off all surfaces We see the reflection of all this indirect illumination Computationally intensive to do correctly Ambient A gross approximation to radiosity Use a constant to represent the amount of indirect light Yeah, it’s a hack! But global illumination is tough! = Iambient kaIa Lambert’s Cosine Law Diffuse reflection is proportional to the amount of light that hits the surface per unit area Lambert’s Cosine Law Projected Area = cos(θ) = (N· L) Use max((N· L), 0) * colorobject N θ L Surface dA Specular (Local Illumination) Light reflected at a mirror reflection angle n θ θ r l Surface Specular Reflection The reflection of the light source on the object Shiny/Glossy surfaces Not a perfect mirror Show up as Specular Highlights, i.e., bright spots Specular Cosine falloff about mirror reflection vector View-dependent Reflectance Ray N (L·N) N S S = (L·N)N - L R L · N L R = (L·N)N + (L·N)N - L Surface R = 2 ( N.L ) N − L Cosine Falloff The angle between the ideal reflection direction R and the view direction V is α cos(α) = V· R = L· VR N R θ θ eye α L V Surface Material Property (Cos(α))q = (V· R)q, Power q = size of the lobe = how fast the specular component falls = glossiness of the surface r Specular Reflection Coefficient Alternative Specular Calculation Half-way vector H bisects the angle between V and L Compare H to N Cheaper to compute than R N H = (V + L)/|V + L| L α H q May use: (H · N) * Colorlight V Surface Blinn-Torrance Variation Use halfway vector H between V and L h n β Eye l v Surface A Comparison Is the variation a good approximation? Difficult to distinguish visually – used in OpenGL! Phong Blinn-Torrance Phone Illumination (Single Light) Terms Kd = diffuse coefficient, Ks = specular coefficient Let Ka = Kd, assume ambient term is diffusely reflected I = light intensity Compute for each wavelength (r, g, b) q C = (Kd Ia + N·L * Kd * Id) * colorobject+ (V· R) * Ks * Is * (1,1,1) white light source Multiple Light Sources Simply add together the contribution from each light source equally Add in the effects of a light source iff the “face is a FRONT FACE” with respect to the light The sign of N· L δi = 0 if light is behind face = 1 if light is in front of face q C = Σiδi [ Kd * Iai + (N·Li* Kd * Idi) * cobj + (V· R) * K s* Isi * ci] Ambient/Diffuse/Specular Just ambient light: Diffuse + Specular and change Ambient Left: Sphere with just diffuse reflection Right: Sphere with just specular reflection Ambient Only Cheap global illumination Ambient + Diffuse Ambient + Diffuse + Specular Phong Illumination.