Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RunService = game:GetService("RunService")
- local Lighting = game:GetService("Lighting")
- local OCCLUSION_FACTOR = 80
- local occluder = Instance.new("ImageHandleAdornment")
- occluder.Name = "MoonOccluder"
- occluder.Image = "rbxasset://textures/whiteCircle.png"
- occluder.Size = Vector2.new(171,171)
- occluder.Color3 = Color3.new()
- occluder.Adornee = workspace.Terrain
- local fade = Instance.new("ColorCorrectionEffect")
- fade.Name = "MoonFade"
- local blur = Instance.new("BlurEffect")
- blur.Name = "MoonBlur"
- local function update()
- local c = workspace.CurrentCamera
- if c then
- local sunDir = Lighting:GetSunDirection()
- local moonDir = Lighting:GetMoonDirection()
- local occ = math.max(0,(sunDir:Dot(moonDir)*OCCLUSION_FACTOR)-(OCCLUSION_FACTOR-1))
- local camPos = c.CFrame.p
- occluder.CFrame = CFrame.new(camPos + (moonDir * 1000),camPos)
- occluder.Transparency = 1-occ
- occluder.Parent = c
- fade.Contrast = occ*.8
- fade.Saturation = occ*-.2
- fade.Parent = c
- blur.Size = occ*3
- blur.Parent = c
- end
- end
- RunService:BindToRenderStep("SolarEclipseUpdate",201,update)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement