CS 450 Computer Graphics Light Matter Reflection Models


























- Slides: 26
CS 450: Computer Graphics Light, Matter, Reflection Models
Light The surface of an object may: • emit light • reflect light • refract light The color that we see when we look at a point on the surface of an object is the sum of all light which reaches that point on the surface and is reflected toward the viewer.
Light The color of each point on a surface can be described with a three component intensity or luminance function. The value for each color component is a complex integral Ir equation based on intensities, wavelengths, surface properties, distances, I = Ig angular separations, orientations, attenuation by atmosphere, water, smoke. . . and many Ib other properties. Because the equation is not solvable in any practical sense, we use an approximation which yields a reasonably good visual result.
Light The approximation of the luminance function is based upon a lighting model. Two parts to problem. . 1 - modeling the light sources 2 - modeling the interaction between light and surface (reflection)
Light Sources Light sources emit different • amounts of light • frequencies of light • and have different directional properties Examples of different types of Light Sources: Ambient light source Point Source Spotlight Distant Light Sources
Light Sources Ambient Light Source - provides uniform illumination - large source with diffusers to scatter light in all directions - approximated by specifying an ambient intensity which is identical at every point in the scene Iar Ia = Iab Iag
Light Sources Point Source - emits light equally in all directions - the intensity of illumination received from a point source is proportional to the inverse square of the distance between the source and the surface The intensity of light from source p 0 received at point p on the surface is I(p, p 0 ) = 1 | p - p 0 | 2 I (p 0 )
Light Sources Spotlight - characterized by the narrow range of angles through which light is emitted (or can be seen) - intensity is a function of the angle between the direction of the source and a vector to a point on the surface - realistically modeled with concentration of light at center Ps 0 o Is e cos o, e is an exponent that determines how rapidly intensity drops off
Light Sources Distant Light Source - direction with which light strikes any surface is approximately the same for each point on a surface - modeled by direction not location of light source
Phong Reflection Model Supports three types of light-surface interactions - ambient - diffuse - specular Each source (i) has an ambient, a diffuse and a specular component for each of the three primary colors Li = Lira Liga Liba Lird Ligd Libd Lirs Ligs Libs
Phong Reflection Model Supports three types of light-surface interactions - ambient - diffuse - specular The amount of light reflected at each surface point has an ambient, a diffuse and a specular component for each of the three primary colors Ri = Rira Riga Riba Rird Rigd Ribd Rirs Rigs Ribs
Phong Reflection Model We compute the contribution for each color source by adding the ambient, diffuse and specular components Iir = Rira Lira + Rird Lird + Rirs Lirs Perceived red component of intensity from light source i Diffuse reflection of red from light source i = Iira + Iird + Iirs Diffuse red component term from light source i We obtain the total intensity by adding the contributions of all sources and possibly a global ambient term Ir ( Iira = i The sum over all of the light sources + Iird + Iirs ) + Iar
Phong Reflection Model n v l Uses four vectors to calculate a color for an arbitrary point on a surface. r n – normal to the surface at p v – vector to the viewer or COP p l – direction of a line from p to a point on the light source r – direction that a perfectly reflected ray would take
Ambient Reflection The same at every point on surface. Ra = ka where 0 <= ka <= 1 ka indicates the percentage of ambient light reflected Ia = ka. La pov: ambient 1. 0
Diffuse Reflection Diffuse reflections occur from rough surfaces that scatter light in many directions. Also called Lambertian surfaces. The amount of diffuse light reflected from a point on a surface, Rd, can be approximated using cos q (where q is the angle between normal, n, at point of interest an , l, the direction of the light source n Id = kd(cos q)Ld , where kd is the diffuse reflectivity coefficient Id = kd(l. n)Ld , (assuming l & n are unit vectors) l v q r p
Diffuse Reflection The amount of diffuse light reflected from a point on a surface, Rd, can be approximated using cos q (where q is the angle between normal, n, at point of interest an , l, the direction of the light source Id = kd(cos q)Ld , where kd is the diffuse reflectivity coefficient Id = kd(l. n)L. d , (assuming l & n are unit vectors) We can add attenuation as a function of distance d kd Id = --------(l a + bd + cd 2 . n)Ld pov: diffuse 1. 0 . Special case: (l n)Ld is negative if light source below the horizon
Specular Reflection Most reflected rays are close to the ideal reflection direction so a highlight (bright spot) appears on the surface. This occurs because the surfaces are smooth. The amount of light seen depends on the angle f between r and v a Is = ks. Ls cos (f) , where a represents how tight the highlight is Is = and 0 <= ks <= 1 is a shininess coefficient a ks. Ls(r v) , (assuming r & n are unit vectors) . pov: specular 1. 0
Phong Reflection Model So finally the PHONG MODEL (for EACH COLOR and EACH LIGHT SOURCE) is. . 1 Id = --------(kd. Ld(l. n) + Ks. Ls(r. v) a ) + ka. La a + bd + cd 2 + Diffuse = Specular
Phong Reflection Model So finally the PHONG MODEL (for EACH COLOR and EACH LIGHT SOURCE) is. . 1 Id = --------(kd. Ld(l. n) + Ks. Ls(r. v) a ) + ka. La a + bd + cd 2 + Diffuse + Specular = Ambient
Polygonal Shading To give a more realistic shading across the face of a flat polygon, possibly with differently calculated normals at each vertex, we want to vary the shading so the surface appears to curve properly between the vertices. Imagine a polygon on a sphere surface with vertex normals perpendicular to the sphere not to each polygon. We want it to look like a sphere.
Polygonal Shading • Flat Shading • Interpolative (Gouraud shading) • Phong Shading
Polygonal Shading • FLAT SHADING -- one normal n for the polygon, one calculation of the polygon color for the whole polygon
Polygonal Shading • FLAT SHADING -- one normal n for the polygon, one calculation of the polygon color for the whole polygon
Polygonal Shading • GOURAUD (INTERPOLATIVE) SHADING -also called SMOOTH shading, vertex normals are calculated as a normalized average of all of the polygon normals sharing that vertex, then the color at polygon point is an interpolation of the polygon vertex colors.
Polygonal Shading • GOURAUD (INTERPOLATIVE) SHADING -also called SMOOTH shading, vertex normals are calculated as a normalized average of all of the polygon normals sharing that vertex, then the color at polygon point is an interpolation of the polygon vertex colors.
Polygonal Shading • PHONG SHADING -- instead of interpolating vertex intensities, we interpolate normals across each polygon Same calculation of vertex normals as Gouraud shading, but a new surface normal is calculated for every interior point by first interpolating normals along each polygon edge, and then interpolating interior normals from pairs of edge normals. Traditionally an OFFLINE process, but now is possible real-time. Produces smoother renderings but much more computationally intensive.