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, … - 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 all close allBasic Examples (4)
Scope (24)
Generalizations & Extensions (6)
Applications (3)
Properties & Relations (9)
Possible Issues (5)
Neat Examples (2)
Introduced in 1988
Updated in 2014
(1.0)
|
(10.0)