This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Lighting

Updated In 6 Graphic
Lighting
is an option for Graphics3D and related functions that specifies what simulated lighting to use in coloring 3D surfaces.
  • The following settings can be given:
Automaticdefault lighting schemes
Noneno lighting
{s1,s2,...}light sources s1, s2, ...
"name"named lighting configuration
  • Each light source can be of the following forms:
{"Ambient",col}uniform ambient light of color col
{"Directional",col,{pt1,pt2}}directional light along the vector from pt1 to pt2
{"Point",col,pt}spherical point light source at position pt
{"Point",col,pt,att}point light with geometric attenuation att
{"Spot",col,{pt,tar},}spotlight at pt aimed at tar with half-angle
{"Spot",col,{pt,tar},{,s},att}spotlight with spot exponent s and attenuation att
  • Light source positions and aiming points can be specified as follows:
{x,y,z}explicit coordinates that move with the graphic
Scaled[{x,y,z}]scaled coordinates that move with the graphic
ImageScaled[{x,y,z}]coordinates fixed relative to the final displayed image
  • In ImageScaled[{x, y, z}], the x and y run from 0 to 1 across the width and height of the bounding box of the final displayed image. The z coordinate runs orthogonal to the plane of the display, and is 0 at the back of the 3D region, and 1 at the front.
  • Lighting->Automatic uses ambient light together with four light sources fixed relative to the final displayed image. With the typical default setting ColorFunction->Automatic, colored light sources are used; if an explicit setting for ColorFunction is given, the light sources are taken to be white.  »
  • Lighting->"Neutral" always uses white light sources in the default positions.  »
  • Lighting can be specified separately for particular objects in Graphics3D by giving a style option Style[obj, Lighting->spec].  »
  • In a list of graphics primitives and directives, the alternative form {..., g, Lighting->spec, g, ...} defines lighting for objects that follow the lighting specification in the list.  »
  • The final colors of 3D surfaces are determined by linearly adding RGB colors from three sources:
diffuse reflection defined by RGBColor, etc. directives
specular reflection defined by Specularity directives
glow defined by Glow directives
  • The setting for Lighting affects only colors associated with diffuse and specular reflection.
  • Diffuse reflection is taken to follow Lambert's law, with light effectively scattered equally in all directions from a surface.
  • Specular reflection effectively takes light to be scattered only close to the mirror-reflection direction, as specified in the notes for Specularity.
  • Colors of light sources can be defined by RGBColor, Hue or any other color specification.
  • Light sources with color specifications of the form {dcol, Specularity[scol]} are effectively taken to have colors dcol for purposes of diffuse reflection, and scol for purposes of specular reflection.  »
  • Directional light sources specified by {"Directional", col, {pt1, pt2}} are taken to yield parallel simulated light rays, so only the direction vector defined by {pt1, pt2} is relevant, not its magnitude.  »
  • Point light sources specified by {"Point", col, pt} effectively yield light that emanates from the point pt, but does not attenuate with distance.  »
  • {"Point", col, pt, {a, b, c}} yields light that attenuates like 1/c r^2+b r+a with distance r.  »
  • {"Spot", col, {pt, tar}, } yields the same light distribution as a point light source, except that it is restricted to a cone with direction from pt to tar, and with half-angle alpha in radians.  »
  • {"Spot", col, {pt, tar}, {, s}} gives cos^stheta fall-off away from the center of the cone.  »
  • {"Spot", col, {pt, tar}, {, s}, {a, b, c}} gives 1/c r^2+b r+a attenuation with distance r.  »
Default lighting on gray specular sphere:
In[1]:=
Click for copyable input
Out[1]=
 
Neutral lighting on gray specular sphere:
In[1]:=
Click for copyable input
Out[1]=
 
Directional light from the top of the specular surface:
In[1]:=
Click for copyable input
Out[1]=
 
Specify lighting for each object:
In[1]:=
Click for copyable input
Out[1]=
New in 1 | Last modified in 6