Advertisement
Diamond_Nicholas

voxel shader

Jan 30th, 2020
11,365
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.94 KB | None | 1 0
  1.  
  2. function sandbox(var,func)
  3. local env = getfenv(func)
  4. local newenv = setmetatable({},{
  5. __index = function(Enum,k)
  6. if k=="script" then
  7. return var
  8. else
  9. return env[k]
  10. end
  11. end,
  12. })
  13. setfenv(func,newenv)
  14. return func
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. Script0 = Instance.new("Script")
  19. Script1 = Instance.new("Script")
  20. Sky2 = Instance.new("Sky")
  21. Sound3 = Instance.new("Sound")
  22. ScreenGui4 = Instance.new("ScreenGui")
  23. Frame5 = Instance.new("Frame")
  24. LocalScript6 = Instance.new("LocalScript")
  25. ImageLabel7 = Instance.new("ImageLabel")
  26. ImageLabel8 = Instance.new("ImageLabel")
  27. ImageLabel9 = Instance.new("ImageLabel")
  28. ImageLabel10 = Instance.new("ImageLabel")
  29. ImageLabel11 = Instance.new("ImageLabel")
  30. ImageLabel12 = Instance.new("ImageLabel")
  31. LocalScript13 = Instance.new("LocalScript")
  32. Script0.Name = "READ ME OR IT WILL NOT WORK"
  33. Script0.Parent = mas
  34. table.insert(cors,sandbox(Script0,function()
  35. --[[
  36. TO USE THIS MAKE SURE PROPERTIES PANEL AND EXPLORER ARE OPEN AND SELECT LIGHTING IN THE EXPLORER
  37. THEN, GO THE PROPERTIES PANEL AND FIND TECHNOLOGY, DOUBLE CLICK IT AND SELECT "ShadowMap"
  38.  
  39.  
  40. Done!
  41.  
  42. Now you can delete the read me script, But KEEP THE SHADERS SCRIPT!
  43. --]]
  44. end))
  45. Script1.Name = "Shaders"
  46. Script1.Parent = mas
  47. table.insert(cors,sandbox(Script1,function()
  48. --Leave script alone!
  49.  
  50.  
  51. game.Players.PlayerAdded:Connect(function(plr)
  52. wait()
  53. local SunFX = script.LensFlareGui:Clone()
  54. SunFX.Parent = plr.PlayerGui
  55. end)
  56.  
  57.  
  58.  
  59. print('Voxel: SEGI LIGHTING loaded..')
  60.  
  61. wait(2)
  62. script.Beep:Play()
  63.  
  64. Lighting = game:GetService("Lighting")
  65.  
  66. wait(0.1)
  67.  
  68. Lighting.Brightness = 2
  69. Lighting.ExposureCompensation = 1.5
  70.  
  71. Lighting.ShadowSoftness = 0.2
  72.  
  73. Lighting.OutdoorAmbient = Color3.new(139/255, 139/255, 139/255)
  74. Lighting.Ambient = Color3.new(2/255, 2/255, 2/255)
  75.  
  76. SunFlare = Instance.new("SunRaysEffect", Lighting)
  77. SunFlare.Intensity = 0.04
  78.  
  79. ColorCorrection = Instance.new("ColorCorrectionEffect", Lighting)
  80. ColorCorrection.TintColor = Color3.new(229/255, 231/255, 255/255)
  81. ColorCorrection.Contrast = 0.1
  82. ColorCorrection.Brightness = 0.05
  83.  
  84.  
  85. Lighting.FogEnd = 2999
  86. Lighting.FogStart = 0
  87. Lighting.FogColor = Color3.new(162/255, 195/255, 255/255)
  88.  
  89. --- water
  90.  
  91. workspace.Terrain.WaterTransparency = 1
  92. workspace.Terrain.WaterReflectance = 0.2
  93.  
  94. sky = script.Sky
  95. sky.Parent = Lighting
  96.  
  97.  
  98.  
  99.  
  100. local Blur = Instance.new("BlurEffect")
  101. Blur.Parent = game.Lighting
  102. Blur.Size = 25
  103. wait(0.1)
  104. Blur.Size = 24
  105. wait(0.1)
  106. Blur.Size = 23
  107. wait(0.1)
  108. Blur.Size = 22
  109. wait(0.1)
  110. Blur.Size = 21
  111. wait(0.1)
  112. Blur.Size = 20
  113. wait(0.1)
  114. Blur.Size = 19
  115. wait(0.1)
  116. Blur.Size = 18
  117. wait(0.1)
  118. Blur.Size = 17
  119. wait(0.1)
  120. Blur.Size = 16
  121. wait(0.1)
  122. Blur.Size = 15
  123. wait(0.1)
  124. Blur.Size = 14
  125. wait(0.1)
  126. Blur.Size = 13
  127. wait(0.1)
  128. Blur.Size = 12
  129. wait(0.1)
  130. Blur.Size = 11
  131. wait(0.1)
  132. Blur.Size = 10
  133. wait(0.1)
  134. Blur.Size = 9
  135. wait(0.1)
  136. Blur.Size = 8
  137. wait(0.1)
  138. Blur.Size = 7
  139. wait(0.1)
  140. Blur.Size = 6
  141. wait(0.1)
  142. Blur.Size = 5
  143. wait(0.1)
  144. Blur.Size = 4
  145. wait(0.1)
  146. Blur.Size = 3
  147. wait(0.1)
  148. Blur.Size = 2
  149. wait(0.1)
  150. Blur.Size = 1
  151. wait(0.1)
  152. Blur.Size = 0
  153.  
  154.  
  155.  
  156.  
  157. print('Loading..Bloom')
  158. wait(2)
  159. print('Loading..Lens Flares')
  160.  
  161.  
  162. print("Done!")
  163.  
  164.  
  165. while wait(1) do
  166. for i,v in pairs(game.Players:GetPlayers()) do
  167. if v.PlayerGui:FindFirstChild("LensFlareGui") == nil then
  168. gui = script.LensFlareGui:Clone()
  169. gui.Parent = v.PlayerGui
  170. end
  171. end
  172. end
  173. end))
  174. Sky2.Parent = Script1
  175. Sky2.MoonAngularSize = 13
  176. Sky2.SkyboxBk = "http://www.roblox.com/asset/?id=225469345"
  177. Sky2.SkyboxDn = "http://www.roblox.com/asset/?id=225469349"
  178. Sky2.SkyboxFt = "http://www.roblox.com/asset/?id=225469359"
  179. Sky2.SkyboxLf = "http://www.roblox.com/asset/?id=225469364"
  180. Sky2.SkyboxRt = "http://www.roblox.com/asset/?id=225469372"
  181. Sky2.SkyboxUp = "http://www.roblox.com/asset/?id=225469380"
  182. Sky2.SunAngularSize = 20
  183. Sky2.SunTextureId = "rbxassetid://1168763430"
  184. Sound3.Name = "Beep"
  185. Sound3.Parent = Script1
  186. Sound3.SoundId = "rbxassetid://1029495337"
  187. Sound3.Volume = 1
  188. ScreenGui4.Name = "LensFlareGui"
  189. ScreenGui4.Parent = Script1
  190. Frame5.Name = "lensFlare"
  191. Frame5.Parent = ScreenGui4
  192. Frame5.Size = UDim2.new(1, 0, 1, 0)
  193. Frame5.BackgroundColor = BrickColor.new("Really black")
  194. Frame5.BackgroundColor3 = Color3.new(0, 0, 0)
  195. Frame5.BackgroundTransparency = 1
  196. Frame5.BorderColor = BrickColor.new("Really black")
  197. Frame5.BorderColor3 = Color3.new(0, 0, 0)
  198. Frame5.BorderSizePixel = 0
  199. LocalScript6.Name = "Lens Flare Script"
  200. LocalScript6.Parent = Frame5
  201. table.insert(cors,sandbox(LocalScript6,function()
  202. local player = game.Players.LocalPlayer
  203. local camera = workspace.CurrentCamera
  204. local gui = script.Parent
  205. local flares = {}
  206. local char
  207.  
  208. repeat char = player.Character wait(1/30) until char
  209.  
  210. for i, child in pairs(gui:GetChildren()) do
  211. if child.Name:sub(1, 5) == "flare" then
  212. flares[child] = tonumber(child.Name:match("flare%d+ : (%-?.+)"))
  213. end
  214. end
  215.  
  216. function project(cam, point)
  217. local dif = cam:pointToObjectSpace(point)
  218. local fov = math.atan(math.rad(camera.FieldOfView))
  219. local z = -dif.z
  220. if z > 0 then
  221. local x = (dif.x / fov / 1.3) / (z + 1) * (gui.AbsoluteSize.y / gui.AbsoluteSize.x)
  222. local y = (dif.y / fov / 1.3) / (z + 1) * -1
  223. return x, y, true
  224. else
  225. return 0, 0, false
  226. end
  227. end
  228.  
  229. function rayCast(pos, dir, ignore)
  230. return workspace:FindPartOnRayWithIgnoreList(Ray.new(pos, dir), ignore)
  231. end
  232.  
  233. while wait(1/60) do
  234. local suns = 0
  235. for i = 1, 5 do
  236. local frame = CFrame.new(camera.CoordinateFrame.p, camera.CoordinateFrame.p + game.Lighting:GetSunDirection())
  237. frame = frame * CFrame.Angles(0, 0, i/5 * math.pi*2)
  238. frame = frame * CFrame.Angles(math.rad(5), 0, 0)
  239. if not rayCast(frame.p, frame.lookVector*999, {char}) then
  240. suns = suns + 1
  241. end
  242. end
  243. if suns > 0 then
  244. local x, y, z = project(camera.CoordinateFrame, camera.CoordinateFrame.p + game.Lighting:GetSunDirection()*25)
  245. if z then
  246. for flare, pos in pairs(flares) do
  247. flare.Position = UDim2.new(0.5 + x*pos, -flare.AbsoluteSize.x/2, 0.5 + y*pos, -flare.AbsoluteSize.y/2)
  248. flare.Visible = true
  249. end
  250. else
  251. for flare in pairs(flares) do
  252. flare.Visible = false
  253. end
  254. end
  255. else
  256. for flare, pos in pairs(flares) do
  257. flare.Visible = false
  258. end
  259. end
  260. end
  261.  
  262. end))
  263. ImageLabel7.Name = "flare2 : 0.5"
  264. ImageLabel7.Parent = Frame5
  265. ImageLabel7.Size = UDim2.new(0.0625, 0, 0.0625, 0)
  266. ImageLabel7.BackgroundColor = BrickColor.new("Really black")
  267. ImageLabel7.BackgroundColor3 = Color3.new(0, 0, 0)
  268. ImageLabel7.BackgroundTransparency = 1
  269. ImageLabel7.BorderColor = BrickColor.new("Really black")
  270. ImageLabel7.BorderColor3 = Color3.new(0, 0, 0)
  271. ImageLabel7.BorderSizePixel = 0
  272. ImageLabel7.SizeConstraint = Enum.SizeConstraint.RelativeXX
  273. ImageLabel7.ZIndex = 2
  274. ImageLabel7.Image = "http://www.roblox.com/asset/?id=109801097"
  275. ImageLabel8.Name = "flare3 : -0.1"
  276. ImageLabel8.Parent = Frame5
  277. ImageLabel8.Size = UDim2.new(0.03125, 0, 0.03125, 0)
  278. ImageLabel8.BackgroundColor = BrickColor.new("Really black")
  279. ImageLabel8.BackgroundColor3 = Color3.new(0, 0, 0)
  280. ImageLabel8.BackgroundTransparency = 1
  281. ImageLabel8.BorderColor = BrickColor.new("Really black")
  282. ImageLabel8.BorderColor3 = Color3.new(0, 0, 0)
  283. ImageLabel8.BorderSizePixel = 0
  284. ImageLabel8.SizeConstraint = Enum.SizeConstraint.RelativeXX
  285. ImageLabel8.ZIndex = 3
  286. ImageLabel8.Image = "http://www.roblox.com/asset/?id=109801097"
  287. ImageLabel9.Name = "flare1 : -0.5"
  288. ImageLabel9.Parent = Frame5
  289. ImageLabel9.Size = UDim2.new(0.100000001, 0, 0.100000001, 0)
  290. ImageLabel9.BackgroundColor = BrickColor.new("Really black")
  291. ImageLabel9.BackgroundColor3 = Color3.new(0, 0, 0)
  292. ImageLabel9.BackgroundTransparency = 1
  293. ImageLabel9.BorderColor = BrickColor.new("Really black")
  294. ImageLabel9.BorderColor3 = Color3.new(0, 0, 0)
  295. ImageLabel9.BorderSizePixel = 0
  296. ImageLabel9.SizeConstraint = Enum.SizeConstraint.RelativeXX
  297. ImageLabel9.ZIndex = 2
  298. ImageLabel9.Image = "http://www.roblox.com/asset/?id=109801097"
  299. ImageLabel10.Name = "flare4 : 1"
  300. ImageLabel10.Parent = Frame5
  301. ImageLabel10.Size = UDim2.new(1, 0, 1, 0)
  302. ImageLabel10.BackgroundColor = BrickColor.new("Really black")
  303. ImageLabel10.BackgroundColor3 = Color3.new(0, 0, 0)
  304. ImageLabel10.BackgroundTransparency = 1
  305. ImageLabel10.BorderColor = BrickColor.new("Really black")
  306. ImageLabel10.BorderColor3 = Color3.new(0, 0, 0)
  307. ImageLabel10.BorderSizePixel = 0
  308. ImageLabel10.SizeConstraint = Enum.SizeConstraint.RelativeXX
  309. ImageLabel10.ZIndex = 3
  310. ImageLabel10.Image = "http://www.roblox.com/asset/?id=109801097"
  311. ImageLabel11.Name = "flare5 : -1.1"
  312. ImageLabel11.Parent = Frame5
  313. ImageLabel11.Size = UDim2.new(0.150000006, 0, 0.150000006, 0)
  314. ImageLabel11.BackgroundColor = BrickColor.new("Really black")
  315. ImageLabel11.BackgroundColor3 = Color3.new(0, 0, 0)
  316. ImageLabel11.BackgroundTransparency = 1
  317. ImageLabel11.BorderColor = BrickColor.new("Really black")
  318. ImageLabel11.BorderColor3 = Color3.new(0, 0, 0)
  319. ImageLabel11.BorderSizePixel = 0
  320. ImageLabel11.SizeConstraint = Enum.SizeConstraint.RelativeXX
  321. ImageLabel11.ZIndex = 2
  322. ImageLabel11.Image = "http://www.roblox.com/asset/?id=109801061"
  323. ImageLabel12.Name = "vignette"
  324. ImageLabel12.Parent = ScreenGui4
  325. ImageLabel12.Size = UDim2.new(1, 0, 1, 0)
  326. ImageLabel12.BackgroundColor = BrickColor.new("Institutional white")
  327. ImageLabel12.BackgroundColor3 = Color3.new(1, 1, 1)
  328. ImageLabel12.BackgroundTransparency = 1
  329. ImageLabel12.BorderSizePixel = 0
  330. ImageLabel12.Image = "rbxassetid://192776775"
  331. ImageLabel12.ImageTransparency = 0.69999998807907
  332. LocalScript13.Name = "MotionBlur"
  333. LocalScript13.Parent = ScreenGui4
  334. table.insert(cors,sandbox(LocalScript13,function()
  335. --[[
  336. By AstroCode on August 17, 2016
  337.  
  338. This motion blur script is activated by the rotation of the camera.
  339. Place this script in StarterPlayer > StarterPlayerScripts
  340. By default, players must have their graphics quality set to 6+ to see the blur effect.
  341. --]]
  342.  
  343. --//Settings
  344. BlurAmount = 15 -- Change this to increase or decrease the blur size
  345.  
  346. --//Declarations
  347. Camera = game.Workspace.CurrentCamera
  348. Last = Camera.CFrame.lookVector
  349. Blur = Instance.new("BlurEffect",Camera)
  350.  
  351. --//Logic
  352. game.Workspace.Changed:connect(function(p) -- Feels a bit hacky. Updates the Camera and Blur if the Camera object is changed.
  353. if p == "CurrentCamera" then
  354. Camera = game.Workspace.CurrentCamera
  355. if Blur and Blur.Parent then
  356. Blur.Parent = Camera
  357. else
  358. Blur = Instance.new("BlurEffect",Camera)
  359. end
  360. end
  361. end)
  362.  
  363. game:GetService("RunService").Heartbeat:connect(function()
  364. if not Blur or Blur.Parent == nil then Blur = Instance.new("BlurEffect",Camera) end -- Feels a bit hacky. Creates a new Blur if it is destroyed.
  365.  
  366. local magnitude = (Camera.CFrame.lookVector - Last).magnitude -- How much the camera has rotated since the last frame
  367. Blur.Size = math.abs(magnitude)*BlurAmount -- Set the blur size
  368. Last = Camera.CFrame.lookVector -- Update the previous camera rotation
  369. end)
  370. end))
  371. for i,v in pairs(mas:GetChildren()) do
  372. v.Parent = workspace
  373. pcall(function() v:MakeJoints() end)
  374. end
  375. for i,v in pairs(cors) do
  376. spawn(function()
  377. pcall(v)
  378. end)
  379. end
Advertisement
Comments
  • Piez4
    282 days
    # text 0.17 KB | 0 0
    1. pretty good script but is there any way to remove the black transpart color over the screen or make it across the *entire* roblox screen since it ends below the roblox logo
Add Comment
Please, Sign In to add comment
Advertisement