Diffuse and Specular Reflection

Visualize the effects of Mathematica's default lighting on a color wheel of spheres with adjustable diffuse and specular reflectivity. By default all seven spheres have the same color specular reflectivity, which is controlled by the upper section’s color slider and indicated by the monochromatic wheel icon. The six perimeter spheres have red, yellow, green, cyan, blue, and magenta diffuse reflectivity and the central sphere is an achromatic diffuse reflector, which is indicated by the polychromatic wheel icon. The lower section’s lightness slider controls all seven spheres’ diffuse reflectivity. The bottom checkbox exchanges the roles of the diffuse and specular color controls so that all seven spheres have the same diffuse reflectivity, but the polychromatic wheel arrangement of specular reflectivities. Note that the specular exponent control moves between the upper and lower section so as to always accompany the specular color or lightness control.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


In the first three snapshots, the spheres vary in diffuse reflectivity.
Snapshot 1: no specular reflectivity
Snapshot 2: adds specular reflectivity at the same moderate exponent as in the main output graphic, but with both diffuse and specular reflectivity increased so that the total intensity of light reflected from polygons facing the light sources is generously larger than 1
Snapshot 3: a high specular exponent with the reflectivities decreased to keep all reflected light intensities less than 1
Snapshots 4-6: The spheres vary in specular rather than diffuse reflectivity. The diffuse reflectivity is absent or at a very low level so that the effect of varying the specular exponent is emphasized. Note that a specular exponent of 1 gives reflectivity somewhat similar to diffuse reflectivity, but not quite the same because the reflected intensity depends on the difference between the viewing angle and the specular reflection angle rather than the angle between the incident light and the surface normal.
The lightness control crudely approximates the Munsell color system’s vertical axis; see the Wikipedia articles on lightness and relative luminance. The RGB values are manipulated in a simple way (see the source code), so that the perimeter sphere’s colors are fully saturated at lightness 1/2, smoothly decrease to black at lightness 0, and increase to white at lightness 1.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.