Using gradient mask on blurred panel?

To achieve blur I use this draw_Blur function. I call it in the panel:paint wherever I need it.

local function draw_Blur(panel, amount) 
	local x, y = panel:LocalToScreen( 0, 0 )
	surface.SetDrawColor( 255, 255, 255 )
	surface.SetMaterial( blur )
	for i = 1, 6 do
		blur:SetFloat('$blur', (i / 6) * (amount ~= nil and amount or 6))
		surface.DrawTexturedRect(x * -1, y * -1, scrW, scrH)

Now I’d like to expand upon this by making the blur effect fade out (via gradient) as you go from the bottom of the panel to the top. But I have no idea how to do this, since it looks like surface.SetMaterial (which is usually used for gradients) is already being used for the blur.

Thank you.

I don’t think that would be possible without drawing it one row of pixels at a time, not sure tbh.


1 Like