Legacy Documentation

Dynamic Visualizer (2008)

This is documentation for an obsolete product.
Current products and services

Documentation / DynamicVisualizer / Manipulating Objects / Manipulating Objects /

4.2.1 Surface Color

The surface appearance of an object is affected by the lighting, the render mode (point cloud, wireframe, or flat- or smooth-shaded solid), opacity and its color. To change its surface color, use the Color option.

Settings for the Color option.

For example, to view the sphere and torus separately, you can change their surface colors.

In[9]:=

Out[9]=

The standard color options, Hue, CMYKColor, GrayLevel, and RGBColor may be used. Loading the color packages also permits the use of sensible option names such as Red and Blue.

In[10]:=

To set the front and back colors independently, specify a list of two colors. The first color is used for the front, the second is used for the back. The front surface is defined by the counterclockwise ordering of the polygon vertices. Note: Many Mathematica packages do not accurately define the correct ordering of these coordinates and may have the front/back surfaces swapped for some or all of the polygons. This is the case for our sphere and torus, both of which have their front surfaces inside. This problem is noticeable only when the front and back surfaces have different colors. It can be fixed by reversing the coordinate list using Reverse and MapAt, or more easily by simply swapping the order of the two colors you apply.

Here you color the outer surface of the partial torus yellow and the inner surface blue. You may need to rotate the model to see both surfaces.

In[11]:=

Out[11]=

Changing the foreground and background colors of the torus.

For each surface, you can also supply a list of colors, which are applied in a cyclic fashion to each polygon in turn. This can be used to good effect to create a checkered surface. To make a checkered surface using Plot3D graphics, you should specify an even number for PlotPoints, otherwise a striped pattern, rather than a checkered one is generated. One or two color lists may be supplied. If only one color is given, it is used on both front and back surfaces.

In[12]:=

Out[12]=

Applying a color list to the sphere creates a checkerboard effect.