local m = Material("vignette/vignette.png")
local m_w = Material("vignette/vignette_white.png")
local alpha_saved = 255
local alphanew = 0

if not ConVarExists("suppression_vignette_size") then
    CreateConVar("suppression_vignette_size", 1, FCVAR_ARCHIVE)
end

hook.Add("RenderScreenspaceEffects", "supp_vignette", function()

    if not render.SupportsPixelShaders_2_0() then return end

    local amt = LocalPlayer():GetNWFloat("FT_Suppression", 0)
    alphanew = Lerp(6 * FrameTime(), alphanew, amt)

    local a = alphanew

    render.SetMaterial(m)
    m:SetFloat("$alpha", a)

    local cvar = GetConVar("suppression_vignette_size")
    local size = cvar and cvar:GetFloat() or 1

    for i = 1, 4 * size do
        render.DrawScreenQuad()
    end
end)
