Загрузка данных


local Lighting = game:GetService("Lighting")

--------------------------------------------------
-- GLOBAL LIGHTING
--------------------------------------------------

Lighting.GlobalShadows = true
Lighting.Technology = Enum.Technology.ShadowMap

Lighting.ShadowSoftness = 0.25

Lighting.EnvironmentDiffuseScale = 0.65
Lighting.EnvironmentSpecularScale = 0.85

Lighting.Brightness = 2
Lighting.ExposureCompensation = 0

--------------------------------------------------
-- ATMOSPHERE
--------------------------------------------------

local atmosphere = Lighting:FindFirstChild("RTXAtmosphere")

if not atmosphere then
	atmosphere = Instance.new("Atmosphere")
	atmosphere.Name = "RTXAtmosphere"
	atmosphere.Parent = Lighting
end

atmosphere.Density = 0.16
atmosphere.Offset = 0.05
atmosphere.Haze = 1.1
atmosphere.Glare = 0.08

atmosphere.Color = Color3.fromRGB(
	210,
	220,
	235
)

atmosphere.Decay = Color3.fromRGB(
	95,
	105,
	125
)

--------------------------------------------------
-- REMOVE OLD GLOBAL POST EFFECTS
-- They will now be created locally by RTXPerformance
--------------------------------------------------

for _, name in ipairs({
	"RTXColorCorrection",
	"RTXBloom",
	"RTXSunRays"
}) do

	local old = Lighting:FindFirstChild(name)

	if old then
		old:Destroy()
	end

end

--------------------------------------------------
-- AUTOMATIC ATMOSPHERE / LIGHTING BY TIME
--------------------------------------------------

local function updateLighting()

	local time = Lighting.ClockTime

	--------------------------------------------------
	-- MORNING
	--------------------------------------------------

	if time >= 6 and time < 10 then

		local alpha = (time - 6) / 4

		Lighting.Brightness =
			1.5 + alpha * 0.8

		Lighting.ExposureCompensation =
			-0.15 + alpha * 0.1

		atmosphere.Color =
			Color3.fromRGB(
				205,
				215,
				230
			)

		atmosphere.Decay =
			Color3.fromRGB(
				105,
				110,
				125
			)

	--------------------------------------------------
	-- DAY
	--------------------------------------------------

	elseif time >= 10 and time < 17 then

		Lighting.Brightness = 2.3
		Lighting.ExposureCompensation = 0

		atmosphere.Color =
			Color3.fromRGB(
				215,
				225,
				240
			)

		atmosphere.Decay =
			Color3.fromRGB(
				120,
				125,
				140
			)

	--------------------------------------------------
	-- EVENING
	--------------------------------------------------

	elseif time >= 17 and time < 20 then

		local alpha = (time - 17) / 3

		Lighting.Brightness =
			2.3 - alpha * 1.2

		Lighting.ExposureCompensation =
			-alpha * 0.35

		atmosphere.Color =
			Color3.fromRGB(
				245,
				190,
				155
			)

		atmosphere.Decay =
			Color3.fromRGB(
				110,
				75,
				65
			)

	--------------------------------------------------
	-- NIGHT
	--------------------------------------------------

	else

		Lighting.Brightness = 0.8
		Lighting.ExposureCompensation = -0.45

		atmosphere.Color =
			Color3.fromRGB(
				105,
				125,
				165
			)

		atmosphere.Decay =
			Color3.fromRGB(
				35,
				45,
				70
			)

	end
end

--------------------------------------------------
-- UPDATE
--------------------------------------------------

while true do

	updateLighting()

	task.wait(0.2)

end