• Blurred background without DFrame
    2 replies, posted
Title says it all, How do I make a certain part blurred? For something like a hud, Say I only blur the background of a box for a HUD. Any idea? Thanks [editline]28th September 2015[/editline] Example if you don't understand:[IMG]https://s3.scriptfodder.com/script_media/5eefdba3b173b5a10831eed51110f34a.png[/IMG]
Theres an Lua snippet out there, that allows you to draw an blurred box, and then draw over it, I dont know if I am allowed to post it here, but I'll do that: [code] local blur = Material("pp/blurscreen") function draw.Blur(x, y, w, h, layers, density, alpha) local X, Y = 0,0 local scrW, scrH = ScrW(), ScrH() surface.SetDrawColor(255, 255, 255, alpha) surface.SetMaterial(blur) for i = 1, 3 do blur:SetFloat("$blur", (i / layers) * density) blur:Recompute() render.UpdateScreenEffectTexture() render.SetScissorRect(x, y, x+w, y+h, true) surface.DrawTexturedRect(X * -1, Y * -1, scrW, scrH) render.SetScissorRect(0, 0, 0, 0, false) end end [/code] to use it, draw the blur box, and then draw something over it(the normal box should have an alpha of 200 or lower for good effect).
[QUOTE=whitestar;48781436]Theres an Lua snippet out there, that allows you to draw an blurred box, and then draw over it, I dont know if I am allowed to post it here, but I'll do that: [code] local blur = Material("pp/blurscreen") function draw.Blur(x, y, w, h, layers, density, alpha) local X, Y = 0,0 local scrW, scrH = ScrW(), ScrH() surface.SetDrawColor(255, 255, 255, alpha) surface.SetMaterial(blur) for i = 1, 3 do blur:SetFloat("$blur", (i / layers) * density) blur:Recompute() render.UpdateScreenEffectTexture() render.SetScissorRect(x, y, x+w, y+h, true) surface.DrawTexturedRect(X * -1, Y * -1, scrW, scrH) render.SetScissorRect(0, 0, 0, 0, false) end end [/code] Thanks whitestar! to use it, draw the blur box, and then draw something over it(the normal box should have an alpha of 200 or lower for good effect).[/QUOTE]
Sorry, you need to Log In to post a reply to this thread.