Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local smooth_color = Vector(0)
- local cvar = CreateClientConVar("pp_lightcolor", "1")
- local color = vector_origin
- local last
- hook.Add("RenderScreenspaceEffects", 1, function()
- if not cvar:GetBool() then return end
- local ply = LocalPlayer()
- if (last or 0) < CurTime() then
- for y = 1, 8 do
- local direction = (ply:EyeAngles() + Angle(0, y/8*360, 0)):Forward() * 60
- --if not util.QuickTrace(ply:EyePos(), direction).Hit then
- for i = -20, 20 do
- local point = ply:EyePos() + (direction * i)
- color = color + render.GetLightColor(point)
- end
- --end
- end
- color = color / 300
- last = CurTime() + 0.2
- print("sampled")
- end
- smooth_color = LerpVector(FrameTime() * 10, smooth_color, color * 2)
- local sat = math.Clamp(smooth_color:Length() / 2 + 0.5, 1, 2)
- local len = smooth_color:Length()
- local mult = (smooth_color - (Vector() * 0.2)) * 4
- mult.x = math.max(mult.x, 0)
- mult.y = math.max(mult.y, 0)
- mult.z = math.max(mult.z, 0)
- DrawColorModify{
- ["$pp_colour_addr"] = smooth_color.x,
- ["$pp_colour_addg"] = smooth_color.y,
- ["$pp_colour_addb"] = smooth_color.z,
- ["$pp_colour_mulr"] = mult.x,
- ["$pp_colour_mulg"] = mult.y,
- ["$pp_colour_mulb"] = mult.z,
- ["$pp_colour_brightness"] = -len * 0.5,
- ["$pp_colour_contrast"] = len * 0.2 + 1,
- ["$pp_colour_colour"] = sat,
- }
- end)
Advertisement
Add Comment
Please, Sign In to add comment