This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
 MATHEMATICA HOW TO Tutorials »| See Also »| More About »
How to | Control the Response of a 3D Surface to Lighting
To control how a 3D surface responds to simulated light, set its reflection properties. Mathematica lets you control the diffuse reflection of light on a matte surface and the specular reflection of light on a mirror-like surface. Combining them gives you extensive control over the final appearance and color of a 3D surface.
Intrinsic surface color corresponds directly to diffuse reflection, where light is scattered equally in all directions from the surface. For example, sheets of uncoated paper are matte ("dull") and thus show diffuse reflection.
By default, the intrinsic surface color of 3D objects in Mathematica is white. Here, the color on the 3D cylinder comes from the Lighting Mathematica uses by default:
 Out[19]=
Create a 3D cylinder where the intrinsic surface color is red. This specifies the diffuse reflection of red light by the cylinder:
 Out[16]=
More detailed control over the specific color of 3D surfaces can be gained with RGBColor, which lets you set explicit values ranging from 0 to 1 for red, green, and blue:
 Out[10]=
In fact, you can use many methods for setting the intrinsic surface color of 3D objects in Mathematica. Here, CMYKColor is used:
 Out[20]=
This Manipulate uses RGBColor to set the intrinsic surface color of the 3D cylinder. For reference, the Inset 2D square at the top right shows the raw RGBColor setting in the absence of Lighting.
When the sliders are set all the way to the left, the surface color is black. When the sliders are set all the way to the right, the surface color is white, which causes the cylinder to appear in the default color scheme:
 Out[43]= Play Animation ▪

Another property of reflection that you can control is specular, or mirror-like reflection. This type of reflection occurs on "glossy" or "shiny" surfaces, such as a piece of laminated paper.
First, create a 3D sphere that uses the default settings:
 Out[52]=
The fraction of light that is specularly reflected can range from 0 to 1. For example, use Specularity to specularly reflect 30% of the light that falls on the sphere:
 Out[51]=
To see what the range of values for Specularity looks like, use this Manipulate to dynamically adjust the fraction of light that is specularly reflected:
 Out[50]= Play Animation ▪
You can also specularly reflect specific colors:
 Out[49]=
Many different colors in Mathematica can be specularly reflected. For example, the sliders in the Manipulate here are used with RGBColor to dynamically set the color reflected by Specularity. As before, the Inset 2D square at the top right shows the raw RGBColor setting:
 Out[47]= Play Animation ▪
Specularity also lets you control exactly the width of the specular reflection of light by setting a specular exponent. The specular exponent is specified as the second argument to Specularity. If you do not explicitly set a specular exponent, Mathematica uses the default value of 1.5.
Create a 3D sphere where 50% of the light is specularly reflected, and the specular exponent is 1:
 Out[48]=
The higher the specular exponent, the more sharply defined the specular reflection is.
For example, use the slider in this Manipulate to dynamically adjust the specular exponent from 1 to 100. At a value of 100, the specularly reflected light is restricted to a small area:
 Out[53]= Play Animation ▪

In practice, the diffuse and specular components of reflection are often combined to control the final color and appearance of 3D surfaces.
PlotStyle is used here to color the surface of this plot Orange and specularly reflect White light with a specular exponent of 20:
 Out[49]=
ContourStyle is used similarly here:
 Out[74]=
As you might expect, Lighting has a profound effect on reflection. Use diffuse and specular reflection together with Lighting:
 Out[2]=