LightSources

The lighting model in Mathematica allows you to simulate lighting from one or more light sources when the setting (Lighting:->True) is used. Each light source has a certain positioon and color. Cartesian coordinates relative to the display are used to specify the position of light sources. The axes are oriented with the positive right of the display, the positive above the display, and the positive in front of the display. Some examples are given below to demonstrate.

First we have an example where

{{0,1,0},RGBColor[1,0,0]} is a red light source from above, and

{{1,0,0},RGBColor[0,1,0]} is a green light source from the right.

In the next cell we have an example where

{{0,-1,0},RGBColor[1,0,0]}is a red light source from below,and

{{-1,0,0},RGBColor[0,1,0]}is a green light source from the left.

In the next cell we have an example where

{{0,0,1},RGBColor[1,0,0]}is a red light source from directly infront of the display and

{{1,0,0},RGBColor[0,1,0]}is a green light source from the right.

In the examples above the cubes were oriented so that two surfaces were nearly normal to the incident light rays. Hence reflected light was nearly identical to the incident light. In the next example the default ViewPoint is used, and each of three sides are iluminated by more than one light source.

The Mathematica lighting model doesn't account for shadows. This is normally preffered for scientific illustrations, but not for life like 3D graphics. The fact that Mathematica doesn't account for shadows is demonstrated with the code in the next cell in which the top of all cubes are red, and the right side of all cubes are green.

For the next example we need to load a graphics package.

Keep in mind the coordinate system used for LightSources has nothing to do with the axes of the Graphics3D object. For evidence of this consider the next cell which make an annimation of a rotating sphere with only one light source from the right and a little ambient light. If you click on one of the graphic cells you can see the box spining around, but the sphere always looks the same.

The next cell makes an annimation showing a torus lit with a moving light source. The only thing that changes in the annimation is the direction of the light source. The virtural location of the light moves in a counter clockwise circle around the viewing surface.

Created by Mathematica (May 16, 2004)