Lighting and ShadingOverviewThose Were the DaysLighting vs. ShadingSlide 5Lighting ModelsLambert Lighting ModelLambert’s Cosine LawSlide 9Phong Lighting ModelSlide 11Blinn-Phong ModelSlide 13Blinn-Phong HighlightsSlide 15Torrance-Sparrow ModelSlide 17Slide 18D: Micro Facet DistributionDenominatorG: Geometrical Attenuation FactorF: Fresnel ReflectionShadingTypes of ShadingFlat ShadingGouraud ShadingSlide 27Linear Interpolation ConcernsPerspectively-correct InterpolationSlide 30Slide 31Gouraud ExampleMach BandsSlide 34ImprovementsPhong ShadingSlide 37Slide 38Other Types of Per-pixel ShadingOther Types of Per-pixel Shading.ReferencesSlide 42Lighting and ShadingComp 770 Lecture NotesSpring 2009OverviewLast time, we covered light-matter interaction.Now, apply it to rendering.Outline:Lighting and shading.Lighting models.Shading methods.Those Were the Days(Or: how not to motivate a 21st century computer graphics paper.)“In trying to improve the quality of the synthetic images, we do not expect to be able to display the object exactly as it would appear in reality, with texture, overcast shadows, etc. We hope only to display an image that approximates the real object closely enough to provide a certain degree of realism.”– Bui Tuong Phong, 1975Lighting vs. ShadingCommonly misused terms.What’s the difference?Lighting vs. ShadingCommonly misused terms.What’s the difference?Lighting designates the interaction between materials and light sources, as in last lecture ( i.e. Physics).Shading is the process of determining the color of a pixel (i.e. Computer Graphics).Usually determined by lighting.Could use other methods: random color, NPR, etc.Lighting ModelsWill discuss 3:Lambert.Purely diffuse surfaces.Phong.Adds perceptually-based specular term.Torrance-sparrow:Provides a physical approximation.Lambert Lighting ModelSometimes mistakenly attributed to Gouraud.Gouraud didn’t introduce a new lighting model, just a shading method. Used approximations from Warnock and Romney.Both based on Lambert’s cosine law.Lambert’s Cosine LawThe reflected luminous intensity in any direction from a perfectly diffusing surface varies as the cosine of the angle between the direction of incident light and the normal vector of the surface.Intuitively: cross-sectional area of the “beam” intersecting an elementof surface area is smaller for greater angles with the normal.Lambert’s Cosine LawIdeally diffuse surfaces obey cosine law.Often called Lambertian surfaces.Id = kd Iincident cos = kd Iincident (N·L).kd is the diffuse reflectanceof the material.Wavelength dependent, so usually specified as a color.INPhong Lighting ModelPhong adds specular highlights.His original formula for the specular term:W(i)[cos s ]n s is the angle between the view and specular reflection directions.“W(i) is a function which gives the ratio of the specular reflected light and the incident light as a function of the the incident angle i.”•Ranges from 10 to 80 percent.“n is a power which models the specular reflected light for each material.”•Ranges from 1 to 10.Phong Lighting ModelMore recent formulations are slightly different.Replace W(i) with a constant ks, independent of the incident direction.What do we lose when we do this?Is= ks Iincident cosn= ks Iincident (V·R)n.V is the view direction.R is the specular reflection direction.Blinn-Phong ModelPopular variation of Phong model.Uses the halfway vector, H.Is= ks Iincident (N·H)n.H = L+V / | L+V |What are the advantages?LNHVBlinn-Phong ModelPopular variation of Phong model.Uses the halfway vector, H.Is= ks Iincident (N·H)n.H = L+V / | L+V |Faster to compute than reflection vector.Still view-dependent since H depends on V.LNHVBlinn-Phong HighlightsDoes using N.H vs. R.V affect highlights?Yes, the highlights “spread”.Why?Is this bad?Blinn-Phong HighlightsDoes using N.H vs. R.V affect highlights?Yes, the highlights “spread”.Why?Is this bad?Not really, for two reasons.Can always just adjust the exponent.Phong and Blinn-Phong are not physically based, so it doesn’t really matter!Torrance-Sparrow ModelIntroduced by Torrance and Sparrow in 1967 as a theoretical model.Introduced to CG community by Blinn in 1977.same paper as “Halfway Vector” (Blinn-Phong).Attempts to provide a more physical model for specular reflections from real surfaces.Points out that intensity of specular highlights is dependent on the incident direction relative to normal.Phong attempted to model this with w(i) factor?Torrance-Sparrow ModelBack to micro facets. Assumptions:Diffuse component comes from multiple reflections between facets and from internal scattering.Specular component of surface comes from facets oriented in direction of H.Torrance-Sparrow ModelIs = DGF / (N·V)D is the distribution function of the micro facet directions on the surface.G is the amount that facets shadow and mask each other.F is the Fresnel reflection law.D: Micro Facet DistributionT-S used simple Gaussian distribution:D = e -()2 = deviation angle from halfway vector, H. = standard deviation.Large values = dull, small values = shinyDenominatorIntensity proportional to number of facets in H direction.So, must account for fact that observer sees more surface area when surface is tilted.Change in area proportional to cosine of tilt angle.Hence, N·V in denominator.G: Geometrical Attenuation FactorRemember micro facet shadowing and masking?Blinn derives this factor for symmetrical v-shaped groove facets. (See paper).shadowshadowMasked LightF: Fresnel ReflectionFraction of light incident on a facet that is actually reflected rather than absorbed.Function of angle of incidence and index of refraction.F(, ).For metals (large ), F(, ) nearly constant at 1.For non-metals (small ), F(, ) has exponential appearance. Near zero for = 0, to 1 at = / 2.ShadingHave seen some methods for computing lighting.Given normal, light direction, material properties.Non-diffuse models need view direction.Now explore methods of applying that lighting (or other color) to pixels of rasterized surface.Types of ShadingIn polygonal rendering,
View Full Document