AmbientLight[col]
是一个三维图形指令,指定颜色 col 的均匀环境光用于着色三维表面.
AmbientLight
AmbientLight[col]
是一个三维图形指令,指定颜色 col 的均匀环境光用于着色三维表面.
更多信息
- AmbientLight 也被称为自然光.
- AmbientLight 通常用于通过向各个方向投射柔和的光线来填充没有足够照明的区域.
- AmbientLight[col] 产生颜色为 col 的均匀环境光.
- 光源 col 的颜色可以由 RGBColor、Hue 或任何其他颜色规范定义.
- AmbientLight 的设置仅影响与三维表面上的漫反射和镜面反射相关的颜色.
- 具有 {dcol,Specularity[scol]} 形式的颜色规格的光源可有效使用颜色 dcol 以用于漫反射,scol 用于镜面反射.
- 漫反射遵循朗伯定律,光从表面的各个方向有效地均匀散射.
- 如 Specularity 的注释中所述,镜面反射有效地使光仅在接近镜面反射方向时散射.
范例
打开所有单元 关闭所有单元基本范例 (2)
范围 (2)
Graphics3D[{AmbientLight[Orange], Sphere[], Cuboid[{1, 2, -1}, {2, 3, 1}], Cylinder[{{3, -1, 0}, {3, -1, 1}}]}, Lighting -> None]l1 = AmbientLight[GrayLevel[.3]];
l2 = DirectionalLight[Orange, {{1, 1, 1}, {0, 0, 0}}];{Graphics3D[{l2, EdgeForm[], Sphere[], Cuboid[{1, 2, -1}, {2, 3, 1}], Cylinder[{{3, -1, 0}, {3, -1, 1}}]}, Lighting -> None],
Graphics3D[{l1, l2, EdgeForm[], Sphere[], Cuboid[{1, 2, -1}, {2, 3, 1}], Cylinder[{{3, -1, 0}, {3, -1, 1}}]}, Lighting -> None]}推广和延伸 (2)
Graphics3D[Sphere[], Lighting -> Automatic]Graphics3D[{Sphere[], AmbientLight[RGBColor[{0.4, 0.2, 0.2}]], DirectionalLight[RGBColor[{0., 0.18, 0.5}], ImageScaled[{2, 0, 2}]], DirectionalLight[RGBColor[{0.18, 0.5, 0.18}], ImageScaled[{2, 2, 3}]], DirectionalLight[RGBColor[{0.5, 0.18, 0.}], ImageScaled[{0, 2, 2}]], DirectionalLight[RGBColor[{0., 0., 0.18}], ImageScaled[{0, 0, 2}]]}]Graphics3D[{Sphere[]}, Lighting -> "Neutral"]Graphics3D[{AmbientLight[RGBColor[{.35, .35, .35}]], DirectionalLight[RGBColor[{.37, .37, .37}], ImageScaled[{2, 0, 2}]], DirectionalLight[RGBColor[{.37, .37, .37}], ImageScaled[{2, 2, 2}]], DirectionalLight[RGBColor[{.37, .37, .37}], ImageScaled[{0, 2, 2}]], Sphere[]}, Lighting -> None]应用 (1)
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)
巧妙范例 (1)
p1[θ_] := RotationTransform[θ, {0, 0, 1}][{0, 2, 0}];
p2[θ_] := RotationTransform[θ + Pi / 2, {1, 0, 1}][{0, 2, 0}];
p3[θ_] := RotationTransform[θ + Pi, {1, 0, 0}][{0, 2, 0}];
p4[θ_] := RotationTransform[θ + 3Pi / 2, {1, 0, -1}][{0, 2, 0}];Animate[Graphics3D[{AmbientLight[GrayLevel[.1]], PointLight[Red, p1[θ]], PointLight[Green, p2[θ]], PointLight[Blue, p3[θ]], PointLight[Yellow, p4[θ]], Specularity[White, 30], Sphere[], Sphere[p1[θ], .4], Sphere[p2[θ], .4], Sphere[p3[θ], .4], Sphere[p4[θ], .4]}, Lighting -> None, PlotRange -> 2.5, Background -> Black, Boxed -> False, ImageSize -> 300], {θ, 0, 2Pi}, SaveDefinitions -> True, AnimationRunning -> False]文本
Wolfram Research (2021),AmbientLight,Wolfram 语言函数,https://reference.wolfram.com/language/ref/AmbientLight.html.
CMS
Wolfram 语言. 2021. "AmbientLight." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/AmbientLight.html.
APA
Wolfram 语言. (2021). AmbientLight. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/AmbientLight.html 年
BibTeX
@misc{reference.wolfram_2026_ambientlight, author="Wolfram Research", title="{AmbientLight}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/AmbientLight.html}", note=[Accessed: 17-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_ambientlight, organization={Wolfram Research}, title={AmbientLight}, year={2021}, url={https://reference.wolfram.com/language/ref/AmbientLight.html}, note=[Accessed: 17-August-2026]}