430 likes | 571 Vues
This chapter delves into the key concepts of shading models in computer vision, focusing on the principles of received radiation. It explains how light intensity is calculated when received by surface elements, detailing both diffuse (Lambertian) and specular reflection types. The discussion includes the importance of surface normals and angles in determining the reflection behavior of surfaces and introduces the Phong shading model that combines ambient, diffuse, and specular reflections. This comprehensive overview highlights the impact of surface characteristics on light behavior, crucial for realistic rendering in graphics.
E N D
Computer Vision Chapter 6 Shading
Model of received radiation • Assuming one distant light source, the intensity that surface element j receives is: nj is the surface normal (a unit vector) s is the illumination direction nj s is the cos of the angle between nj and s (dot product) when nj and s are unit vectors
Model of received radiation • Assuming one distant light source, the intensity that surface element j receives is: nj is the surface normal (a unit vector) s is the illumination direction nj s is the cos of the angle between nj and s (dot product) when nj and s are unit vectors Why the restriction (nj o s) > 0?
Dot product • a and b are two vectors. • It is useful to be able to calculate the angle between a and b. • That’s where the dot product comes in. • The length of a vector: (unit vectors have a length=1)
Dot product Calculating the dot product: Converting the dot product to an angle:
Dot product • Calculating the dot product: • What is the value of cos 90 degrees? • What 2 systems are used to represent angles? • Degrees and …? • What representation is used in Java? C/C++? Calculator?
Extending our model • Let’s extend our model to include the viewpoint. • Type of surfaces/surface reflection: • Diffuse (AKA Lambertian) – relatively viewpoint independent • Specular – very viewpoint dependent
Diffuse reflection AKA Lambertian (after Johann Heinrich Lambert (August 26, 1728 – September 25, 1777), a Swiss mathematician, physicist, and astronomer.)
Diffuse reflection • independent of viewpoint, V • Light reaching a surface element is reflected evenly in all directions of the hemisphere centered at that surface element.
Diffuse reflection • Albedo • amount that is diffusely reflected • Ratio (fraction) of total reflected light to total received light (by a surface element). • Low for dark surfaces (0.04 for charcoal); high for light surfaces (0.9 for fresh snow).
Diffuse reflection • Typically for “rough” surfaces.
Diffuse reflection where • j is the particular surface element, • kj is the surface albedo, • nj is the surface normal (a unit vector), and • v is the viewpoint.
Specular reflection • Mirror-like / smooth / polished surfaces. • Distributes energy in a narrow cone about the ray of reflection. • Surfaces have a “shininess” associated with them. • Values of 100 or more for shiny surfaces.
Specular reflection • Defn. specular reflection = mirror-like reflection. • Wavelength of reflected light is similar to the source and is independent of surface color.
Specular reflection • Defn., highlight = bright spot caused by the specular reflection of a light source. • Indicates that the object is wavy, metallic, or glassy.
Specular reflection where R is the reflected ray, and V is the viewpoint
Specular reflection where R is the reflected ray V is the viewpoint
Specular reflection where R is the reflected ray V is the viewpoint N is the surface normal S is the ray of received illumination (See http://mathworld.wolfram.com/Reflection.html for derivation of vector R.)
Specular vs. diffuse Specular • Wavelength of reflected light is similar to the source and is independent of surface color. • Viewpoint dependent.
Darkening with distance • The intensity of light energy reaching a surface decreases with the distance of that surface from the light source. • Mercury receives more light from the sun than the earth.
Complications • Surface models of real objects typically have both specular and diffuse components. • An apple has both specular and diffuse reflective components.
Complications • There are typically many light sources and many inter-surface reflections (referred to as ambient light).
Phong shading model Three components: • ambient • diffuse • specular
Phong shading model • For each light source (there may be many), m: • the components im,s and im,d, are the intensities (often as RGB values) of the specular and diffuse components of the light sources, respectively.
Phong shading model • A single ia term controls the ambient lighting. • It is sometimes computed as a sum of contributions from the light sources.
Phong shading model For each light source, m, • Lm is the direction vector from the point on the surface toward each light source, • N is the normal at this point of the surface, • Rm is the direction that a perfectly reflected ray of light (represented as a vector) would take from this point of the surface, and • V is the direction towards the viewer.
Phong shading model Then the shade value for each surface point Ip is calculated using this equation, which is the Phong reflection model: ka: ambient reflection constant, the ratio of reflection of the ambient term present in all points in the scene rendered
Phong shading model kd: diffuse reflection constant, the ratio of reflection of the diffuse term of incoming light (Lambertian reflectance)
Phong shading model ks: specular reflection constant, the ratio of reflection of the specular term of incoming light : is a shininess constant for this material, which decides how "evenly" light is reflected from a shiny spot, and is very large for most surfaces, on the order of 50, getting larger the more mirror-like they are.
Phong shading model • One last feature of the Phong shading model (for smooth shading): • Vectors are assigned at each polygonal vertex, and shading is interpolated across the surface of the polygon.
Summary • Shading is complicated! • We can model surfaces of objects as (coplanar) polygonal patches. • Normal vector is very important. • Each has its own color, specular, and diffuse (Lambertian) characteristics. • We can have multiple light sources in a scene. • Each may have its own: intensity, location, color, and direction. • The Phong model includes 3 components: specular, diffuse, and ambient.