Advertisement
CloneTrooper1019

Solar Eclipse

Feb 25th, 2018
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. local RunService = game:GetService("RunService")
  2. local Lighting = game:GetService("Lighting")
  3.  
  4. local OCCLUSION_FACTOR = 80
  5.  
  6. local occluder = Instance.new("ImageHandleAdornment")
  7. occluder.Name = "MoonOccluder"
  8. occluder.Image = "rbxasset://textures/whiteCircle.png"
  9. occluder.Size = Vector2.new(171,171)
  10. occluder.Color3 = Color3.new()
  11. occluder.Adornee = workspace.Terrain
  12.  
  13. local fade = Instance.new("ColorCorrectionEffect")
  14. fade.Name = "MoonFade"
  15.  
  16. local blur = Instance.new("BlurEffect")
  17. blur.Name = "MoonBlur"
  18.  
  19. local function update()
  20.     local c = workspace.CurrentCamera
  21.     if c then
  22.         local sunDir = Lighting:GetSunDirection()
  23.         local moonDir = Lighting:GetMoonDirection()
  24.         local occ = math.max(0,(sunDir:Dot(moonDir)*OCCLUSION_FACTOR)-(OCCLUSION_FACTOR-1))
  25.         local camPos = c.CFrame.p
  26.        
  27.         occluder.CFrame = CFrame.new(camPos + (moonDir * 1000),camPos)
  28.         occluder.Transparency = 1-occ
  29.         occluder.Parent = c
  30.        
  31.         fade.Contrast = occ*.8
  32.         fade.Saturation = occ*-.2
  33.         fade.Parent = c
  34.        
  35.         blur.Size = occ*3
  36.         blur.Parent = c
  37.     end
  38. end
  39.  
  40. RunService:BindToRenderStep("SolarEclipseUpdate",201,update)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement