llumination Models and Shading Fole & Van Dam, Chapter 6 llumination Models and Shading ight Source Models Ambient llumination Polgon Rendering Methods Flat Shading Gouraud Shading Phong Shading llumination Models Motivation: n order to produce realistic images, we must simulate the appearance of surfaces under various lighting conditions llumination Model: Given the illumination incident at a point on a surface, quantifies the reflected light llumination Model Parameters ighting effects are described with models that consider the interaction of light sources with object surfaces The factors determining the lighting effects are: The light source parameters: Positions Electromagnetic Spectrum Shape The surface parameters Position Reflectance properties Position of nearb surfaces The ee (camera) parameters Position Sensor spectrum sensitivities llumination Models and Rendering An illumination model is used to calculate the intensit of the light that is reflected at a given point on a surface A rendering method uses intensit calculations from the illumination model to determine the light intensit at all piels in the image ight Source Models Point Source (a): All light ras originate at a point and radiall diverge. A reasonable approimation for sources whose dimensions are small compared to the object size Parallel source (b): ight ras are all parallel. Ma be modeled as a point source at infinite distance (the sun) Distributed source (c): All light ras originate at a finite area in space. t models a nearb source, such as a fluorescent light c b a
llumination Models Simplified and fast methods for calculating surfaces intensities, mostl empirical Calculations are based on optical properties of surfaces and the lighting conditions (no reflected sources nor shadows) ight sources are considered to be point sources Reasonabl good approimation for most scenes Ambient llumination Assume there is some non-directional light in the environment (bacground light) The amount of ambient light incident on each object is constant for all surfaces and over all directions Ver simple model, not ver realistic OpenG default Ambient llumination The reflected intensit amb of an point on the surface is: Ambient llumination amb = K a a a - ambient light intensit K a [0,] - surface ambient reflectivit n principle a and K a are functions of color, so we have R amb, G amb and B amb Diffuse (ambertian) surfaces are rough or grain, lie cla, soil, fabric The surface appears equall bright from all viewing directions Brightness is proportional to cos() because a surface (a) perpendicular to the light direction is more illuminated than a surface (b) at an oblique angle a b The brightness at each point is proportional to cos()
The reflected intensit diff of a point on the surface is: diff = K d p cos() = K d p () p - the point light intensit. Ma appear as attenuated source f att (r) P K d [0,] - the surface diffuse reflectivit - the surface normal - the light direction OTE: f and have unitar length: cos() = diffuse reflection from different light directions Commonl, there are two tpes of light sources: A bacground ambient light A point light source The equation that combines the two models is: = diff + amb = K d p + K a a ote this is the model for one color and it should be replicated for each channel: R, G and B 0 0. 0.6 0. 0. 0.7 K a K d Models shin and gloss surfaces (lie metal, plastic, etc..) with highlights Reflectance intensit changes with reflected angle An ideal specular surface (mirror) reflects light eclusivel in one direction: R Gloss objects are not ideal mirrors and reflect in the immediate vicinit of R R deal specular surface R V on-ideal specular surface
The Phong Model: reflected specular intensit falls off as some power of cos (): The Phong Model: plots of cos n () for three values of the specular parameter n spec = K s p cos n () = K s p (RV) n K s - the surface specular reflectivit n specular reflection parameter, determining the deviation from ideal specular surface (for a perfect mirror n=) R V 0.8 0.6 0. 0. n= n=8 n=6 0 - -. - -0. 0 0.. R Specular surface V Specular surface The illumination equation combined with diffuse reflection is: = amb + diff + spec = K a a + p (K d + K s (RV) n ) f light sources are present in the scene: = amb + ( diff+ spec) 0 0. 0.7 0. 0. 0.8 K s K d effects of the specular parameter n Ambient llumination n=0 Ambient + Diffuse n=0 n= Ambient + Diffuse + Specular
Composing ight Sources Polgon Rendering Methods A freeform surface can be approimated b polhedra Rendering: calculate the illumination at each surface point Appling the illumination model at each surface point is computationall epensive Flat Shading A single intensit is calculated for each surface polgon Fast and simple method Gives reasonable result onl if all of the following assumptions are valid: The object is a polhedron ight source is far awa from the surface so that is constant over each polgon Viewing position is far awa from the surface so that V R is constant over each polgon Gouraud Shading Renders the polgon surface b linearl interpolating intensit values across the surface Gouraud Shading Algorithm:. Determine the normal at each polgon verte. Appl an illumination model to each verte to calculate the verte intensit. inearl interpolate the verte intensities over the surface polgon Gouraud Shading The normal v of a verte is an average of all neighboring normals: V Gouraud Shading nterpolation of the verte intensities P scan line p p p
Gouraud Shading Gouraud shading of a sphere Phong Shading A more accurate method for rendering a polgon surface is to interpolate normal vectors, and then appl the illumination model to each surface point Phong Shading Algorithm:. Determine the normal at each polgon verte. inearl interpolate the verte normals over the surface polgon. Appl the illumination model along each scan line to calculate intensit of each surface point Phong Shading Phong shading of a sphere Polgon Rendering Methods Flat Gouraud Phong Polgon Rendering Methods Polgon Rendering Methods Flat Gouraud Flat Gouraud Phong Phong