• HUD Blur?
    5 replies, posted
Hey Facepunch! I was doing today hud for my server and then i wanted to make draw.RoundedBoxEx blurred. How can i do that?
[lua] local blur = Material("pp/blurscreen") local function DrawBlur(panel, amount) local x, y = panel:LocalToScreen(0, 0) local scrW, scrH = ScrW(), ScrH() surface.SetDrawColor(255, 255, 255) surface.SetMaterial(blur) for i = 1, 3 do blur:SetFloat("$blur", (i / 3) * (amount or 6)) blur:Recompute() render.UpdateScreenEffectTexture() surface.DrawTexturedRect(x * -1, y * -1, scrW, scrH) end end [/lua] Then use DrawBlur(Panel, BlurAmt)
[QUOTE=Mrkrabz;47696256][lua] local blur = Material("pp/blurscreen") local function DrawBlur(panel, amount) local x, y = panel:LocalToScreen(0, 0) local scrW, scrH = ScrW(), ScrH() surface.SetDrawColor(255, 255, 255) surface.SetMaterial(blur) for i = 1, 3 do blur:SetFloat("$blur", (i / 3) * (amount or 6)) blur:Recompute() render.UpdateScreenEffectTexture() surface.DrawTexturedRect(x * -1, y * -1, scrW, scrH) end end [/lua] Then use DrawBlur(Panel, BlurAmt)[/QUOTE] Sorry, but how i am supposed to convert PANEL to Draw.RoundedBoxEx?
Do it within the Paint function for example: [lua] Frame.Paint = function( self, w, h ) DrawBlur(self, 2) draw.RoundedBox( 5, 0, 0, w, h, Color( 0, 0, 0, 200 ) ) end [/lua]
I think he is talking about using it outside of Derma for his HUD. I guess you could try using that DrawBlur function but changing X and Y to your own variables
[CODE] local blur = Material("pp/blurscreen") local function DrawBlurRect(x, y, w, h) local X, Y = 0,0 surface.SetDrawColor(255,255,255) surface.SetMaterial(blur) for i = 1, 5 do blur:SetFloat("$blur", (i / 3) * (5)) 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 draw.RoundedBox(0,x,y,w,h,Color(0,0,0,205)) surface.SetDrawColor(0,0,0) surface.DrawOutlinedRect(x,y,w,h) end [/CODE] There's that if it does not work for you, Credit to Chessnut
Sorry, you need to Log In to post a reply to this thread.