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.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2017 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+