Files
Roblox-Elevator-Game/src/server/main/Lighting/init.lua

74 lines
2.2 KiB
Lua

--!optimize 2
--!native
--!strict
type LightingProps = { [string]: Color3 | number | boolean | string | Enum.Technology }
export type Effects = {
ColorCorrection: ColorCorrectionEffect
}
local Lighting = game:GetService("Lighting")
local mat_fullbright = false
local Lighting_PropsTree: LightingProps = {
["Ambient"] = mat_fullbright and Color3.new(1,1,1) or Color3.fromRGB(40,40,40),
["Brightness"] = 1,
["ColorShift_Bottom"] = Color3.new(0,0,0),
["ColorShift_Top"] = Color3.new(0,0,0),
["EnvironmentDiffuseScale"] = 1,
["EnvironmentSpecularScale"] = .7,
["GlobalShadows"] = true,
["OutdoorAmbient"] = Color3.fromRGB(50,50,50),
["ShadowSoftness"] = 1,
["ClockTime"] = 0,
["GeographicLatitude"] = 0,
["Name"] = "Lighting",
["ExposureCompensation"] = 0,
["FogColor"] = Color3.new(0,0,0),
["FogEnd"] = 10_0000,
["FogStart"] = 10_0000,
["Technology"] = Enum.Technology.Future
}
local function Skybox(): (Atmosphere, BloomEffect)
local Atmosphere = Instance.new("Atmosphere") :: Atmosphere
Atmosphere.Density = .429
Atmosphere.Offset = 0
Atmosphere.Color = Color3.new(0,0,0)
Atmosphere.Decay = Color3.new(0,0,0)
Atmosphere.Glare = .1
Atmosphere.Haze = 1.5
local Bloom = Instance.new("BloomEffect") :: BloomEffect
Bloom.Intensity = .75
Bloom.Size = 35
Bloom.Threshold = 1.5
return Atmosphere, Bloom
end
return function(): Effects
Lighting:ClearAllChildren()
--VFX Effects for later
local ColorCorrection = Instance.new("ColorCorrectionEffect") :: ColorCorrectionEffect
ColorCorrection.Parent = Lighting
for Light_Prop, Light_Value in Lighting_PropsTree do
local changed, err = pcall(function()
Lighting[Light_Prop] = Light_Value
end)
if not changed then
warn(err)
end
end
local Atmosphere, Bloom = Skybox()
Atmosphere.Parent = Lighting
Bloom.Parent = Lighting
return {
ColorCorrection = ColorCorrection
}
end