How do i properly make a blur screen

I’ve been trying many ways that i have just found all of them look pixelated or didnt work

Maybe

Global.Derma_DrawBackgroundBlur or

render.BlurRenderTarget? Not really sure what you mean

Just render a screen quad with Material(“pp/blurscreen”). If you draw it more than once, with different blur value each step, it will be smoother.


local blur = Material("pp/blurscreen")
surface.SetMaterial(blur)
	for i = 1, steps do
		blur:SetFloat("$blur", (i / steps) * (multiplier or 6))
		blur:Recompute()
		render.UpdateScreenEffectTexture()
		render.DrawScreenQuad() 
	end

I haven’t tested it, but it should do what you want. Just change the “steps” and “multiplier” variables. Keep in mind that more steps means more processing.

  • No Material!DrawScreenQuad - No Material! is spammed in console

Code above won’t work. Use this instead:




local blur = Material("pp/blurscreen")

local function draw_blur( p, a, d )

	local x, y = p:LocalToScreen(0, 0)
	surface.SetDrawColor( 255, 255, 255 )
	surface.SetMaterial( blur )
	for i = 1, d do
	
		blur:SetFloat( "$blur", (i / d ) * ( a ) )
		blur:Recompute()
		render.UpdateScreenEffectTexture()
		surface.DrawTexturedRect( x * -1, y * -1, scrw, scrh )
		
	end
	
end



And then in your Paint function do




MyFrame.Paint = function( slf )

    draw_blur( slf, 3, 6 ) --> You can change the 2 numbers to what you want!

end



Sorry, its render.SetMaterial(blur). I took that from an old snippet and forgot to change that part. The code above should do the same.

You never defined “scrw” and “scrh” in that code, thus, not going to work.

My mistake, lol.

be sure to add this to the code above:




local scrw, scrh = ScrW(), ScrH()



Thank you like seriously ty works amazingly ty (not the best at derma so this really helped :smiley: )