Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Visualization and Graphics > Graphics Options & Styling > 3D Graphics Options > Lighting >

Lighting

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 , , ...
  • Each light source can be of the following forms:
{"Ambient",col}uniform ambient light of color col
{"Directional",col,pt}directional light from pt to the center of the bounding box
{"Directional",col,{pt1,pt2}}directional light along the vector from to
{"Point",col,pt}spherical point light source at position pt
{"Point",col,pt,att}point light with geometric attenuation att
{"Spot",col,pt,}spotlight at pt aimed at the center with half-angle
{"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, the and run from 0 to 1 across the width and height of the bounding box of the final displayed image. The 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 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. »
  • In a list of graphics primitives and directives, the alternative form 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 are taken to yield parallel simulated light rays, so only the direction vector defined by is relevant, not its magnitude. »
  • Point light sources specified by effectively yield light that emanates from the point pt but does not attenuate with distance. »
  • yields light that attenuates like with distance . »
  • 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 in radians. »
  • gives fall-off away from the center of the cone. »
  • gives attenuation with distance . »
Default lighting on gray specular sphere:
Neutral lighting on gray specular sphere:
Directional light from the top of the specular surface:
Specify lighting for each object:
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]=
Default lighting:
Default lighting when ColorFunction is specified:
No lighting means diffuse or specular colors will not be visible:
Using Glow specifies pure color without interaction with lights:
Ambient light is uniformly applied to all the surfaces in the scene:
Ambient light gives overall lighting on the scene:
Directional light is specified by a color and a vector defined by two points:
Directional lights with different colors:
Directional lights with different directions:
Directional lights on a specular surface:
Specify a spherical point light source by a color and a position:
Point lights with different colors:
Point lights at various positions:
Point lights on specular surfaces:
Specify spotlight by position, target position, and half-angle:
Spotlights with different colors:
Spotlights from different positions:
Spotlights with different half-angles:
Spotlights on specular surfaces:
Specify the light source position in the graphics coordinate system by default:
The light source moves with the graphic when the view point changes:
Specify the light position by a fraction of the graphics coordinates using Scaled:
The light source moves with the graphic when the view point changes:
Specify the light position in the view coordinate system using ImageScaled:
The light source position is always fixed relative to the view point:
By default, point lights are not affected by the distance from an object:
Specify a point light that attenuates with respect to the distance:
Specify a point light that attenuates by the square of the distance:
By default, spotlights fall off sharply outside the cone:
Spotlights with different spot exponent has intensity :
Spotlight without attenuation:
Spotlight with linear attenuation:
Spotlight with quadratic attenuation:
Predefined colored lighting:
Predefined neutral lighting:
Specify lighting for each object:
Specify lighting within the graphics:
If not specified, the target direction is given toward the center of the objects:
Specify diffuse and specular colors separately for both objects and lights:
Set up four white spheres on a plane:
Directional light:
Point light:
Spotlight:
Different light instruments at the corner points:
Build a scene with multiple objects and light sources:
Animate the spotlights:
Surface color and lighting interact with each other:
Diffuse object and lighting colors can be exchanged and produce the same effect:
Specular object and lighting colors can be exchanged and produce the same effect:
Specularity gives mirror-like reflection:
The final color is a linear combination of all the surface colors as well as lighting:
Lighting follows the additive color model:
Directional light yields rays parallel to the specified direction:
Point light yields rays toward all the directions from the position:
A spotlight emits conic rays toward the specified direction:
The default lighting may not be suitable for light surface colors:
Neutral lighting can be used to reflect surface colors more naturally:
If a color function is given to a plot, then neutral lighting is used automatically:
Restore the default colored lighting:
Flat surfaces may show little or no reflection:
Some surface colors do not reflect certain colored lights:
A spotlight on a sphere may display a jagged boundary:
Increasing the spot exponent may reduce the effect:
Random light setups for ring models:
A simple light show:
New in 1 | Last modified in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF