SpotLight[col,pt,α]
is a three-dimensional graphics directive to use in coloring 3D surfaces that specifies the spotlight of color col at position pt aimed at the center with half-angle α.
SpotLight[col,{pt1,pt2},α]
uses the spotlight at position pt1 aimed at pt2 with half-angle α.
SpotLight[col,{pt,tar},{α,s},att]
uses the spotlight with spot exponent s and attenuation att.
SpotLight
SpotLight[col,pt,α]
is a three-dimensional graphics directive to use in coloring 3D surfaces that specifies the spotlight of color col at position pt aimed at the center with half-angle α.
SpotLight[col,{pt1,pt2},α]
uses the spotlight at position pt1 aimed at pt2 with half-angle α.
SpotLight[col,{pt,tar},{α,s},att]
uses the spotlight with spot exponent s and attenuation att.
Details
- SpotLight is also known as search light.
- SpotLight is typically used to create intense illumination of objects by casting light rays that spread outward in a cone.
- SpotLight[col,{pt1,pt2},α] yields a light that emanates from the point pt1 but is restricted to a cone with direction from pt1 to pt2, and with half-angle
in radians. - Colors of light sources col can be defined by RGBColor, Hue or any other color specification.
- The setting for SpotLight affects only colors associated with diffuse and specular reflection on a 3D surface.
- 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.
- 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.
- Light source positions and aiming points pti 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.
- SpotLight[col,{pt,tar},{α,s}] gives
fall-off away from the center of the cone. - SpotLight[col,{pt,tar},{α,s},{a,b,c}] gives
attenuation with distance
.
Examples
open all close allBasic Examples (3)
Graphics3D[{SpotLight[Green, {{0, 0, 1.5}, {0, 0, 0}}, Pi / 3], Sphere[], Cuboid[{1, 2, -1}, {2, 3, 1}], Cylinder[{{3, -1, 0}, {3, -1, 1}}]}, Lighting -> None]Plot3D[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, PlotStyle -> SpotLight[RGBColor[1, 0.7, 0.1], {{0, 0, 3}, {0, 0, 0}}, Pi / 3]]A spotlight from the top of the specular surface:
ListPlot3D[RandomReal[1, {9, 9}], InterpolationOrder -> 2, Mesh -> None, PlotStyle -> {Specularity[50], SpotLight[RGBColor[1, 0.7, 0.1], {{5, 5, 4}, {0, 0, 0}}, Pi / 3]}]Scope (7)
Lighting Specification (5)
Specify spotlight by position, target position and half-angle:
Graphics3D[{SpotLight[Green, {{0, 0, 1.5}, {0, 0, 0}}, Pi / 3], Sphere[]}, Lighting -> None]Spotlights with different colors:
Table[Graphics3D[{SpotLight[c, {{0, 0, 1.5}, {0, 0, 0}}, Pi / 6], White, Sphere[]}, Lighting -> None], {c, {Red, Yellow, Blue}}]Spotlights from different positions:
Table[Graphics3D[{SpotLight[Orange, {p, {0, 0, 0}}, π / 6], Sphere[]}, Lighting -> None], {p, {{2, 0, 2}, {0, -2, 0}, {2, -2, 0}, {0, 0, 2}}}]Spotlights with different half-angles:
Table[Graphics3D[{SpotLight[Orange, {{0, 0, 1.5}, {0, 0, 0}}, a], Sphere[]}, Lighting -> None], {a, {Pi / 12, Pi / 8, Pi / 6, Pi / 4}}]Spotlights on specular surfaces:
Table[Graphics3D[{SpotLight[Orange, {{0, 0, 1.5}, {0, 0, 0}}, a], Specularity[White, 50], Sphere[]}, Lighting -> None], {a, {Pi / 12, Pi / 8, Pi / 6, Pi / 4}}]Lighting Attenuation (2)
By default, spotlights fall off sharply outside the cone:
plane = DiscretizeRegion[InfinitePlane[{0, 0, 0}, {{1, 0, 0}, {0, 1, 0}}], {{-1, 1}, {-1, 1}, {0, 1}}, MaxCellMeasure -> {"Length" -> 0.01}, BaseStyle -> {EdgeForm[], White}];Show[plane, Lighting -> {SpotLight[White, {{0, 0, 1}, {0, 0, 0}}, Pi / 10]}]A spotlight with different spot exponent
has intensity
:
Table[Show[plane, Lighting -> {SpotLight[White, {{0, 0, 1}, {0, 0, 0}}, {Pi / 2, s}]}], {s, {1, 5, 10, 30}}]Spotlight without attenuation:
obj = Table[Sphere[{3i, 0, 0}], {i, 0, 4}];Graphics3D[{SpotLight[White, {{25, 0, 0}, {0, 0, 0}}, Pi / 4], obj}, Boxed -> False, Background -> Gray, ViewPoint -> {1.5, -1, 0}, Lighting -> None]Spotlight with linear attenuation:
Graphics3D[{SpotLight[White, {{25, 0, 0}, {0, 0, 0}}, Pi / 4, {0, 1, 0}], obj}, Boxed -> False, Background -> Gray, ViewPoint -> {1.5, -1, 0}, Lighting -> None]Spotlight with quadratic attenuation:
Graphics3D[{obj, SpotLight[White, {{25, 0, 0}, {0, 0, 0}}, Pi / 4, {0, 0, 1}]}, Boxed -> False, Background -> Gray, ViewPoint -> {1.5, -1, 0}, Lighting -> "Accent"]Spotlight with intensity
and
attenuation:
Graphics3D[{SpotLight[White, {{25, 0, 0}, {0, 0, 0}}, {Pi / 4, 3000}, {0.3, 0.2, 0.1}], obj}, Boxed -> False, Background -> Gray, ViewPoint -> {1.5, -1, 0}, Lighting -> None]Generalizations & Extensions (2)
Specify lighting for each object:
o1 = Style[{PointLight[Red, {0, 0, 2}], Sphere[]}];
o2 = Style[{SpotLight[Yellow, {{3, 0, 2}, {3, 0, 0}}, Pi / 8], Sphere[{3, 0, 0}]}];
o3 = Style[{DirectionalLight[Blue, {{0, 3, 2}, {0, 3, 0}}], Sphere[{0, 3, 0}]}];
o4 = Style[{PointLight[White, {3, 3, 2}], Sphere[{3, 3, 0}]}];Graphics3D[{o1, o2, o3, o4}, Lighting -> None]Specify lighting within the graphics:
Graphics3D[{{PointLight[Red, {0, 0, 2}], Sphere[]}, {SpotLight[Yellow, {{3, 0, 2}, {3, 0, 0}}, Pi / 8], Sphere[{3, 0, 0}]}, {DirectionalLight[Blue, {{0, 3, 2}, {0, 3, 0}}], Sphere[{0, 3, 0}]}, {PointLight[White, {3, 3, 2}], Sphere[{3, 3, 0}]}}, Lighting -> None]Applications (3)
Set up four white spheres on a plane:
obj = Graphics3D[{Specularity[White, 50], Sphere[], Sphere[{4, 0, 0}], Sphere[{0, 4, 0}], Sphere[{4, 4, 0}]}];
plane = ParametricPlot3D[{u, v, -1}, {u, -2, 6}, {v, -2, 6}, PlotPoints -> 40, MaxRecursion -> 0, Mesh -> None, PlotRange -> 1, Axes -> False];cone = ParametricPlot3D[{d / Tan[Pi / 3]Cos[t] + 2, d / Tan[Pi / 3]Sin[t] + 2, 6 - d}, {t, 0, 2Pi}, {d, 0, 7}, PlotStyle -> Directive[Glow[Yellow], Opacity[.3]], Mesh -> None, PlotRange -> 1, Axes -> False];
light = Graphics3D[{SpotLight[Yellow, {{2, 2, 6}, {2, 2, 0}}, Pi / 6], Red, PointSize -> 0.05, Point[{2, 2, 6}]}];Show[light, cone, obj, plane, Boxed -> False]Different light instruments at the corner points:
lights = {PointSize[Large], Yellow, Point[Tuples[{-1, 1}, 3]]};Graphics3D[{SpotLight[Hue[RandomReal[]], #, {Pi / 3, 8}]& /@ Tuples[{-1, 1}, 3], lights, Sphere[]}]Build a scene with multiple objects and light sources:
col = {Red, Green, Blue};
objs = Graphics3D[{Specularity[White, 2], EdgeForm[], Cylinder[{{2, 2, 0}, {2, 2, 4}}], Cylinder[{{6, 2, 0}, {6, 2, 4}}], Cylinder[{{10, 2, 0}, {10, 2, 4}}]}];
walls = ParametricPlot3D[{{u, v - 2, 0}, {u, 4, 2v}}, {u, -2, 14}, {v, 0, 6}, PlotPoints -> 15, MaxRecursion -> 0, PlotStyle -> Specularity[White, 2], Mesh -> None, Axes -> False];
srcs[pos_] := Graphics3D[MapThread[{DirectionalLight[#1, {{0, -1, 0}, {0, 0, 0}}], Sphere[{#2, 0, 8}, .3]}&, {col, pos}]];
lights[pos_] := Join[{AmbientLight[GrayLevel[.1]]}, Sequence@@MapThread[{SpotLight[#1, {{#2, 0, 8}, {#2, 3, 0}}, {Pi / 2, 20}], {PointLight[#1, {#2, 0, 8}, {0, 8, 0}]}}&, {col, pos}]];Animate[With[{rx = -6Cos[t] + 6, gx = 6Sin[t] + 6, bx = 6Cos[t] + 6}, Show[objs, walls, srcs[{rx, gx, bx}], Lighting -> lights[{rx, gx, bx}], Background -> Black, Boxed -> False, ImageSize -> 300]], {t, 0, 2Pi}, SaveDefinitions -> True, AnimationRunning -> False]Properties & Relations (1)
Possible Issues (2)
The default light scheme uses several colored light sources:
Graphics3D[{SpotLight[Orange, {{0, 0, 1.5}, {0, 0, 0}}, Pi / 3], Sphere[]}]Set Lighting to None to turn off the default lights:
Graphics3D[{SpotLight[Orange, {{0, 0, 1.5}, {0, 0, 0}}, Pi / 3], Sphere[]}, Lighting -> None]A spotlight on a sphere may display a jagged boundary:
Graphics3D[{SpotLight[LightYellow, {{1.5, 1.5, 5}, {1.5, 1.5, 0}}, Pi / 8], Specularity[White, 50], Sphere[], Sphere[{3, 0, 0}], Sphere[{0, 3, 0}], Sphere[{3, 3, 0}]}, Lighting -> None]Increasing the spot exponent may reduce the effect:
Graphics3D[{SpotLight[LightYellow, {{1.5, 1.5, 5}, {1.5, 1.5, 0}}, {Pi / 8, 5}], Specularity[White, 50], Sphere[], Sphere[{3, 0, 0}], Sphere[{0, 3, 0}], Sphere[{3, 3, 0}]}, Lighting -> None]Neat Examples (1)
Random light setups for ring models:
obj = RevolutionPlot3D[{8 + Cos[t], 2Sin[t]}, {t, 0, 2Pi}, Mesh -> None, PlotStyle -> Directive[White, Specularity[White, 50]], Axes -> False, Boxed -> False];Grid[Table[obj /. Rule[Lighting, spec_] :> Rule[Lighting, (SpotLight[ColorData["SouthwestColors"][RandomReal[]], Scaled[#], {Pi / 4, 100}]&) /@ RandomReal[{-4, 4}, {5, 3}]], {3}, {3}]]Related Guides
History
Text
Wolfram Research (2021), SpotLight, Wolfram Language function, https://reference.wolfram.com/language/ref/SpotLight.html.
CMS
Wolfram Language. 2021. "SpotLight." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SpotLight.html.
APA
Wolfram Language. (2021). SpotLight. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SpotLight.html
BibTeX
@misc{reference.wolfram_2026_spotlight, author="Wolfram Research", title="{SpotLight}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/SpotLight.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_spotlight, organization={Wolfram Research}, title={SpotLight}, year={2021}, url={https://reference.wolfram.com/language/ref/SpotLight.html}, note=[Accessed: 13-June-2026]}