How to | Color a 3D Surface without Lighting

Mathematica lets you determine the final rendered color of a 3D surface using simulated lighting, reflection, and glow. With the Glow option, you can color a 3D surface independently of simulated lighting and reflection by effectively causing the surface to emit light in the specified color.

First, create a 3D cylinder. By default, the intrinsic surface color of 3D objects in Mathematica is white. The color you see comes from the simulated lighting that Mathematica uses by default:

In[13]:=
Click for copyable input
Out[13]=

Set Lighting to None to prevent any light from being projected onto the cylinder. The cylinder now appears black:

In[14]:=
Click for copyable input
Out[14]=

With Lighting still set to None, use Glow to color the cylinder purple:

In[5]:=
Click for copyable input
Out[5]=

Now return to using Mathematica's default Lighting with the purple Glow still active:

In[6]:=
Click for copyable input
Out[6]=

As you can see from the last two graphics, Lighting interacts strongly with Glow, which effectively causes a 3D surface to emit its own light in the color that you specify.

In the Manipulate here, the sliders are used to set the Glow color. In other words, the sliders control the color of light that is emitted by the cylinder. Lighting can be set to None or Automatic. Automatic is the explicit setting for the default Lighting scheme in Mathematica. The Inset 2D rectangle at the top right shows the raw color used for the Glow setting in the absence of Lighting; it does not vary with the setting for Lighting in the Manipulate.

To see how Lighting interacts with Glow to determine the final rendered color of the 3D surface, click any color in the slider and switch the setting for Lighting:

You can gain even further control over the final color of a 3D surface by explicitly giving it an intrinsic surface color. This affects the color of light that the surface reflects. For more information, see How to: Control the Response of a 3D Surface to Lighting.

New to Mathematica? Find your learning path »
Have a question? Ask support »