用途
roblox-lighting 用于在 Roblox 中设置或更改灯光、大气氛围(Atmosphere)、昼夜循环以及后处理特效(Bloom、ColorCorrection、DepthOfField 等)。当需要进行光照与氛围相关的配置时应加载此技能。
主要能力
Lighting 服务
提供 Lighting 服务的关键属性配置参考:
Lighting.ClockTime = 14 -- 0-24 numeric
Lighting.Brightness = 2 -- 0-10, default 2
Lighting.Ambient = Color3.fromRGB(70, 70, 70) -- shadow fill
Lighting.OutdoorAmbient = Color3.fromRGB(128, 128, 128)
Lighting.GlobalShadows = true
Lighting.ShadowSoftness = 0.2 -- 0=sharp, 1=soft
-- Configure tech/style/quality in Studio; these properties are not script-writable.
-- Verify enum values and device behavior against current Creator Hub docs before setting them.
Atmosphere 大气效果
local atmo = Instance.new("Atmosphere")
atmo.Density = 0.3 -- 0=clear, 1=opaque (keep <0.5)
atmo.Offset = 0.25 -- 0=ground, 1=sky
atmo.Color = Color3.fromRGB(199, 199, 199) -- near fog
atmo.Decay = Color3.fromRGB(92, 92, 92) -- far/horizon
atmo.Glare = 0 -- 0-10
atmo.Haze = 0 -- 0-10
atmo.Parent = Lighting
后处理特效
以下特效均挂载到 Lighting 下:
| 特效 | 关键属性 |
|---|---|
| BloomEffect | Intensity (0-1), Size (px), Threshold (>0.7 recommended) |
| ColorCorrectionEffect | Brightness, Contrast, Saturation (-1 to 1), TintColor |
| DepthOfFieldEffect | FarIntensity, FocusDistance, InFocusRadius, NearIntensity |
| SunRaysEffect | Intensity (0-1), Spread (0-1) |
昼夜循环
local CYCLE_SPEED = 1 -- minutes per full day
task.spawn(function()
while true do
Lighting.ClockTime += (task.wait() / 60) * (24 / CYCLE_SPEED)
if Lighting.ClockTime >= 24 then Lighting.ClockTime -= 24 end
end
end)
局部光源
| 光源 | 用途 | 关键属性 |
|---|---|---|
| PointLight | 灯具、火把 | Range, Brightness, Color |
| SpotLight | 手电筒 | Range, Angle, Face |
| SurfaceLight | 屏幕、面板 | Range, Angle, Face |
性能提示:将投射阴影的光源限制在可见范围内 4-6 个。对大多数光源使用 Shadows=false。Neon 材质可实现低成本发光效果。
使用方式
通过 MCP 进行操作:检查、最小化更改、捕获、检查性能。
适用场景
适用于 Roblox 开发中涉及光照、氛围、昼夜循环与后处理效果的配置场景。
限制与注意事项
- Brightness >3 会导致画面过曝。
- Density >0.5 会显得浑浊。
- 后处理特效最多 2-3 个。
- 避免使用纯黑 Ambient。
- Technology 已弃用;它及其替代项仅可在 Studio 中配置。
- 参考文档中提供了情绪预设(Day、Golden Hour、Night、Horror、Underwater、Sci-Fi)、区域渐变(zone tweens)与完整示例,位于 references/full.md。
- Lighting 的 tech/style/quality 需在 Studio 中配置,这些属性不可通过脚本写入。设置前请对照当前 Creator Hub 文档验证枚举值与设备行为。