SpotLight
更多信息
- SpotLight 亦称为探照灯.
- SpotLight 通常用于将以锥形向外扩散的光线投射到物体上来创建强烈的照明.
- SpotLight[col,{pt1,pt2},α] 产生从点 pt1 发出,但被限制于锥形内的光线,方向从点 pt1 指向 pt2,半角为
,单位为弧度. - 光源 col 的颜色可以由 RGBColor、Hue 或任何其他颜色规范定义.
- SpotLight 的设置只影响与 3D 曲面上的漫反射和镜面反射相关的颜色.
- 颜色指定形式为 {dcol,Specularity[scol]} 的光源在漫反射情况下实际上被视为颜色是 dcol 的光源,而在镜面反射情况下则被视为颜色是 scol 的光源.
- 漫反射遵循朗伯定律,光实际上从曲面的各个方向均匀散射.
- 镜面反射实际上认为光只在接近镜面反射的方向上散射,如 Specularity 的注释中所述.
- 可用以下方式指定光源位置和瞄准点 pti:
-
{x,y,z} 随图形移动的显式坐标 Scaled[{x,y,z}] 随图形移动的缩放坐标 ImageScaled[{x,y,z}] 相对于最终显示的图像固定的坐标 - 在 ImageScaled[{x,y,z}] 中,在最终显示图像的边界框的宽度和高度上,
和
从 0 到 1.
坐标垂直于显示的平面,在 3D 区域的后面为 0,前面为 1. - Scaled 和 ImageScaled 中指定的坐标通常不在 0 和 1 之间.
- SpotLight[col,{pt,tar},{α,s}] 给出按
从锥体中心衰减的光. - SpotLight[col,{pt,tar},{α,s},{a,b,c}] 给出随距离
按
衰减的光.
范例
打开所有单元 关闭所有单元基本范例 (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]]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]}]范围 (7)
照明规范 (5)
Graphics3D[{SpotLight[Green, {{0, 0, 1.5}, {0, 0, 0}}, Pi / 3], Sphere[]}, Lighting -> None]Table[Graphics3D[{SpotLight[c, {{0, 0, 1.5}, {0, 0, 0}}, Pi / 6], White, Sphere[]}, Lighting -> None], {c, {Red, Yellow, Blue}}]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}}}]Table[Graphics3D[{SpotLight[Orange, {{0, 0, 1.5}, {0, 0, 0}}, a], Sphere[]}, Lighting -> None], {a, {Pi / 12, Pi / 8, Pi / 6, Pi / 4}}]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}}]光的衰减 (2)
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]}]Table[Show[plane, Lighting -> {SpotLight[White, {{0, 0, 1}, {0, 0, 0}}, {Pi / 2, s}]}], {s, {1, 5, 10, 30}}]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]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]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"]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]推广和延伸 (2)
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]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]应用 (3)
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]lights = {PointSize[Large], Yellow, Point[Tuples[{-1, 1}, 3]]};Graphics3D[{SpotLight[Hue[RandomReal[]], #, {Pi / 3, 8}]& /@ Tuples[{-1, 1}, 3], lights, Sphere[]}]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]属性和关系 (1)
可能存在的问题 (2)
Graphics3D[{SpotLight[Orange, {{0, 0, 1.5}, {0, 0, 0}}, Pi / 3], Sphere[]}]Graphics3D[{SpotLight[Orange, {{0, 0, 1.5}, {0, 0, 0}}, Pi / 3], Sphere[]}, Lighting -> None]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]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]巧妙范例 (1)
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}]]文本
Wolfram Research (2021),SpotLight,Wolfram 语言函数,https://reference.wolfram.com/language/ref/SpotLight.html.
CMS
Wolfram 语言. 2021. "SpotLight." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/SpotLight.html.
APA
Wolfram 语言. (2021). SpotLight. Wolfram 语言与系统参考资料中心. 追溯自 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: 04-November-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: 04-November-2026]}