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




- The following settings can be given:
-
Automatic default lighting schemes None no lighting {s1,s2,…} light sources s1, s2, … "Standard" colored light sources in default positions "Neutral" white light sources in default positions "Accent" a directional white light in default direction - 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 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,α} 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.
- 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->"Standard" always uses colored light sources in the default positions. »
- 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 {…,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. directivesspecular reflection defined by Specularity directivesglow 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
with distance
. »
- {"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
in radians. »
- {"Spot",col,{pt,tar},{α,s}} gives
fall-off away from the center of the cone. »
- {"Spot",col,{pt,tar},{α,s},{a,b,c}} gives
attenuation with distance
. »
Examples
open allclose allBasic Examples (4)
Scope (24)
Lighting Specification (18)
Default lighting on a white surface:
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:
Lighting Positions (3)
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:
Lighting Attenuation (3)
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:
Generalizations & Extensions (6)
Applications (3)
Properties & Relations (9)
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:
Possible Issues (5)
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:
Text
Wolfram Research (1988), Lighting, Wolfram Language function, https://reference.wolfram.com/language/ref/Lighting.html (updated 2020).
BibTeX
BibLaTeX
CMS
Wolfram Language. 1988. "Lighting." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/Lighting.html.
APA
Wolfram Language. (1988). Lighting. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Lighting.html