Python1320

Untitled

Oct 12th, 2010
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. local smooth_color = Vector(0)
  2. local cvar = CreateClientConVar("pp_lightcolor", "1")
  3.  
  4. local color = vector_origin
  5. local last
  6. hook.Add("RenderScreenspaceEffects", 1, function()
  7.     if not cvar:GetBool() then return end
  8.    
  9.     local ply = LocalPlayer()
  10.    
  11.    
  12.     if (last or 0) < CurTime() then
  13.         for y = 1, 8 do
  14.             local direction = (ply:EyeAngles() + Angle(0, y/8*360, 0)):Forward() * 60
  15.             --if not util.QuickTrace(ply:EyePos(), direction).Hit then
  16.                 for i = -20, 20 do
  17.                     local point = ply:EyePos() + (direction * i)
  18.                     color = color + render.GetLightColor(point)
  19.                 end
  20.             --end
  21.         end
  22.  
  23.         color = color / 300
  24.        
  25.         last = CurTime() + 0.2
  26.        
  27.         print("sampled")
  28.     end
  29.  
  30.     smooth_color = LerpVector(FrameTime() * 10, smooth_color, color * 2)
  31.  
  32.     local sat = math.Clamp(smooth_color:Length() / 2 + 0.5, 1, 2)
  33.     local len = smooth_color:Length()  
  34.     local mult = (smooth_color - (Vector() * 0.2)) * 4
  35.    
  36.     mult.x = math.max(mult.x, 0)
  37.     mult.y = math.max(mult.y, 0)
  38.     mult.z = math.max(mult.z, 0)
  39.        
  40.     DrawColorModify{
  41.         ["$pp_colour_addr"] = smooth_color.x,
  42.         ["$pp_colour_addg"] = smooth_color.y,
  43.         ["$pp_colour_addb"] = smooth_color.z,
  44.        
  45.         ["$pp_colour_mulr"] = mult.x,
  46.         ["$pp_colour_mulg"] = mult.y,
  47.         ["$pp_colour_mulb"] = mult.z,
  48.  
  49.         ["$pp_colour_brightness"] = -len * 0.5,
  50.         ["$pp_colour_contrast"] = len * 0.2 + 1,
  51.         ["$pp_colour_colour"] = sat,
  52.     }
  53. end)
Advertisement
Add Comment
Please, Sign In to add comment