Advertisement
boatbomber

Filter Module

Jun 17th, 2019
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.19 KB | None | 0 0
  1. local LightingService   = game:GetService("Lighting")
  2. local Applying          = false
  3. local Objects           = {}
  4.  
  5. local module = {
  6.    
  7.     -- To create your own filter, just add another table like these
  8.     -- and give it a unique key so it can be called in module.ApplyFilter
  9.     Filters = {
  10.    
  11.         ['Realistic']   = {
  12.             ["BloomEffect"]             = {Intensity = 1, Size = 38, Threshold = 0.8};
  13.             ["BlurEffect"]              = {Size = 2};
  14.             ["ColorCorrectionEffect"]   = {Brightness = -0.01, Contrast = 0.07, Saturation = -0.06, TintColor = Color3.fromRGB(255,253,252)};
  15.             ["SunRaysEffect"]           = {Intensity = 0.2, Spread = 0.1};
  16.         };
  17.        
  18.         ['Western']     = {
  19.             ["BloomEffect"]             = {Intensity = 2, Size = 40, Threshold = 1};
  20.             ["BlurEffect"]              = {Size = 1};
  21.             ["ColorCorrectionEffect"]   = {Brightness = 0.02, Contrast = -0.03, Saturation = -0.4, TintColor = Color3.fromRGB(255,205,123)};
  22.             ["SunRaysEffect"]           = {Intensity = 0.1, Spread = 0.7};
  23.         };
  24.        
  25.         ['Old School']  = {
  26.             ["BloomEffect"]             = {Intensity = 3, Size = 50, Threshold = 1};
  27.             ["BlurEffect"]              = {Size = 2};
  28.             ["ColorCorrectionEffect"]   = {Brightness = 0.05, Contrast = 0.06, Saturation = -0.95, TintColor = Color3.fromRGB(249,255,255)};
  29.             ["SunRaysEffect"]           = {Intensity = 0.5, Spread = 0.02};
  30.         };
  31.        
  32.         ['Meme']        = {
  33.             ["BloomEffect"]             = {Intensity = 10, Size = 80, Threshold = 1};
  34.             ["BlurEffect"]              = {Size = 1};
  35.             ["ColorCorrectionEffect"]   = {Brightness = 0.2, Contrast = 1, Saturation = 30, TintColor = Color3.fromRGB(255,255,255)};
  36.             ["SunRaysEffect"]           = {Intensity = 0.01, Spread = 0.12};
  37.         };
  38.    
  39.     };
  40. }
  41.  
  42. function module:ApplyFilter(FilterType)
  43.    
  44.     --Avoid doing two applications at once and making a mess
  45.     if Applying then repeat wait(0.1) until not Applying end Applying = true
  46.    
  47.     --Remove old filter
  48.     for i=1,#Objects do
  49.         Objects[i]:Destroy()
  50.     end
  51.    
  52.     --Find chosen filter
  53.     local Filter = self.Filters[FilterType] or self.Filters.Realistic
  54.    
  55.     --Apply filter
  56.     for obj, props in pairs(Filter) do
  57.         local effect = Instance.new(obj)
  58.        
  59.         for p,v in pairs(props) do
  60.             effect[p] = v
  61.         end
  62.        
  63.         Objects[#Objects+1] = effect
  64.        
  65.         effect.Parent = LightingService
  66.        
  67.     end
  68.    
  69.     --Allow new application
  70.     Applying = false
  71.    
  72. end
  73.  
  74. return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement