Illumination Models & Shading
Shading Models Simulate hysical henomena Real illumination simulation is comlicated & exensive Use aroximation and heuristics with little hysical basis that looks surrisingly good: Lighting - Center for Grahics and Geometric Comuting, Technion 2
Local vs. Global Illumination Models Local model direct and local interaction of each object location with the light. Global model: interactions and exchange of light energy between different objects. Lighting - Center for Grahics and Geometric Comuting, Technion 3
Light Sources Point source (A): All light originates at a oint Rays hit a lanar surface at different incidence angles Parallel source (B): All light rays are arallel Rays hit a lanar surface at identical incidence angles May be modeled as a oint source at infinity Also denoted Directional light source Area source (C): Light originates at finite area in sace. An object of finite area that emits light Also denoted Distributed source Question: One of these lights Sources is far more difficult to Handle. Which one and why? Lighting - Center for Grahics and Geometric Comuting, Technion 4 A B C
Assume non-directional light in the environment Object illuminated with same light everywhere Looks like silhouette Ambient Light The Illumination equation I = I a k a I a - ambient light intensity k a - fraction of ambient light reflected from surface As a vector, also defines object color Lighting - Center for Grahics and Geometric Comuting, Technion 5
Diffuse Light Dull surfaces such as solid matte lastic reflects incoming light uniformly in all directions This is called diffuse or Lambertian reflection For light source in a normalized direction L and a surface with normal N, the illumination of the surface is roortional to <N, L> L θ N Lighting - Center for Grahics and Geometric Comuting, Technion 6
Diffuse Reflection Illumination equation is now: I = I k + I k N + a a, L = Iaka I kd I - oint light source s intensity k d - surface diffuse reflection coefficient d cosθ Question: Can we locate the light source from the shading? Lighting - Center for Grahics and Geometric Comuting, Technion 7
Secular Reflection Shiny objects (e.g. metallic) reflect light in a referred direction R determined by the surface normal N. L N θ θ α R V Most objects are not ideal mirrors also reflect in the immediate vicinity of R Phong Model aroximate attenuation by the form of cos n α (no real hysical basis) Question: What is the color of the reflected comonent? Lighting - Center for Grahics and Geometric Comuting, Technion 8
Secular Reflection (Phong Model) Illumination equation: k s n a a ( n k ( N L) + k( R V ) I = I k + I ) d - Secular reflection coefficient - Secularity exonent s Lighting - Center for Grahics and Geometric Comuting, Technion 9
Secular Reflection (cont d) Exonent n of cosine controls the decay factor the of attenuation function: Again, no hysical basis but it does look good: Lighting - Center for Grahics and Geometric Comuting, Technion 10
More on Illumination Equation For multile light sources: shadingmodel I = I aka+ I ( n k ( N L ) + k ( R V) ) d s I of all light sources are added together Precautions should be taken from overflows Question: How can we achieve atmosheric attenuation effects? Lighting - Center for Grahics and Geometric Comuting, Technion 11
Even More on Illumination Equation For distance/atmosheric attenuation sources: I = I aka+ I d ( n k ( N L ) + k ( R V) ) d d - distance between surface and light source and/or distance between surface and viewer (Heuristic atmosheric attenuation) s Question: why an attenuation of 1/d and not the hysically correct decay (which is!?) Lighting - Center for Grahics and Geometric Comuting, Technion 12
Alied to iecewise linear olygonal models Simle surface lighting aroximated over olygons Illumination value deends only on olygon normal each olygon is colored with a uniform intensity Looks non-smooth (worsened by Mach bands effects) Flat Shading Lighting - Center for Grahics and Geometric Comuting, Technion 13
Flat Shading Lighting - Center for Grahics and Geometric Comuting, Technion 14
Gouraud Shading If a olyhedron is an aroximation of smooth surface: assign to each vertex the normal of original surface at that oint If surface is not available use estimated normal (how?) Comute illumination intensity at vertices using those normals Question: And then what? Lighting - Center for Grahics and Geometric Comuting, Technion 15
Gouraud Shading Linearly interolate lighting intensities at the vertices over interior ixels of the olygon, in the image lane Question: Can Gouraud shading suort secular lighting? Lighting - Center for Grahics and Geometric Comuting, Technion 16
Gouraud Shading Lighting - Center for Grahics and Geometric Comuting, Technion 17
Phong Shading Interolate (at the vertices in image sace) normal vectors instead of illumination intensities Aly the illumination equation for each interior ixel with its own (interolated) normal Lighting - Center for Grahics and Geometric Comuting, Technion 18
Gouraud Shading a Triangle Lighting - Center for Grahics and Geometric Comuting, Technion 19
Comments on Shading Phong shading is clearly more exensive (why?) but well worth the effort (yet, with no Oen GL suort) Can achieve good looking secular highlight effects Both the Gouraud and Phong shading schemes are erformed in the image lane and fit well into our olygonal scan-conversion fill scheme Both the Gouraud and Phong are view deendent Can cause artifacts during animation as they are transformation deendent shadingalgo Lighting - Center for Grahics and Geometric Comuting, Technion 20
More Examles Flat Gouraud Phong Lighting - Center for Grahics and Geometric Comuting, Technion 21