1 / 42

Computer Vision

Computer Vision. Chapter 6 Shading. Models of received radiation. Model of received radiation. Assuming one distant light source, the intensity that surface element j receives is: n j is the surface normal (a unit vector) s is the illumination direction

sirius
Download Presentation

Computer Vision

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Vision Chapter 6 Shading

  2. Models of received radiation

  3. 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

  4. 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?

  5. 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)

  6. Dot product Calculating the dot product: Converting the dot product to an angle:

  7. 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?

  8. Back to our model of received radiation

  9. 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

  10. DIFFUSE (lambertian) Reflection

  11. Diffuse reflection AKA Lambertian (after Johann Heinrich Lambert (August 26, 1728 – September 25, 1777), a Swiss mathematician, physicist, and astronomer.)

  12. 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.

  13. 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).

  14. Diffuse reflection • Typically for “rough” surfaces.

  15. 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.

  16. Diffuse reflection

  17. Specular reflection

  18. 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.

  19. Specular reflection • Defn. specular reflection = mirror-like reflection. • Wavelength of reflected light is similar to the source and is independent of surface color.

  20. Specular reflection • Defn., highlight = bright spot caused by the specular reflection of a light source. • Indicates that the object is wavy, metallic, or glassy.

  21. Specular reflection where R is the reflected ray, and V is the viewpoint

  22. Specular reflection where R is the reflected ray V is the viewpoint

  23. 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.)

  24. Specular vs. diffuse Specular • Wavelength of reflected light is similar to the source and is independent of surface color. • Viewpoint dependent.

  25. 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.

  26. Complications • Surface models of real objects typically have both specular and diffuse components. • An apple has both specular and diffuse reflective components.

  27. Complications • There are typically many light sources and many inter-surface reflections (referred to as ambient light).

  28. The phong shading model(from wikipedia)

  29. Phong shading model Three components: • ambient • diffuse • specular

  30. Phong shading model

  31. Flat vs. Phong Shading

  32. 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.

  33. Phong shading model • A single ia term controls the ambient lighting. • It is sometimes computed as a sum of contributions from the light sources.

  34. 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.

  35. 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

  36. Phong shading model kd: diffuse reflection constant, the ratio of reflection of the diffuse term of incoming light (Lambertian reflectance)

  37. 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.

  38. 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.

  39. 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.

More Related