BUILT-IN MATHEMATICA SYMBOL

# Lighting

Lighting
is an option for Graphics3D and related functions that specifies what simulated lighting to use in coloring 3D surfaces.

## DetailsDetails

• The following settings can be given:
•  Automatic default lighting schemes None no 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[{x, y, z}], 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.
• Coordinates specified in Scaled and ImageScaled will often not be between 0 and 1.
• uses ambient light together with four light sources fixed relative to the final displayed image. With the typical default setting , 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 globally for a 3D graphic by giving a Lighting option for Plot3D, Graphics3D, etc.
• 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 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 . »

## ExamplesExamplesopen allclose all

### Basic Examples (4)Basic Examples (4)

Default lighting on gray specular sphere:

 Out[1]=

Neutral lighting on gray specular sphere:

 Out[1]=

Directional light from the top of the specular surface:

 Out[1]=

Specify lighting for each object:

 Out[1]=