So I'm really new to making gmod things, but not so new to lua. I've been messing around and looking through this forum for a while, trying to make a sort of rounded, frosted/blurred box, like in macOS. I really like the look of it, and got it working to an extent, but when I draw the RoundedBox, the corners of the blurred box stick out under it.
Picture: http://prntscr.com/j1wxmi
My code:
local blur = Material("pp/blurscreen")
function DrawBlurRect(x, y, w, h, amount, heaviness)
surface.SetDrawColor(255, 255, 255, 255)
surface.SetMaterial(blur)
for i = 1, heaviness do
blur:SetFloat("$blur", (i / 3) * (amount or 6))
blur:Recompute()
render.UpdateScreenEffectTexture()
render.SetScissorRect(x, y, x + w, y + h, true)
surface.DrawTexturedRect(0 * -1, 0 * -1, ScrW(), ScrH())
render.SetScissorRect(0, 0, 0, 0, false)
end
end
local fillet = 18
hook.Add("HUDPaint", "yhyhyh", function()
local abx = 10
local aby = 500
DrawBlurRect( abx, aby, 260, 100, 5, 5 )
draw.RoundedBox( 20, abx, aby, 260, 100, Color( 0, 0, 0, 200) )
end)
draw.RoundedBox( 20, abx, aby, 260, 100, Color( 0, 0, 0, 200) )
try lowering that "200" it stands for "opacity"
but the blurry corners still stick out from underneath, it doesnt solve anything
Use stencils.
how do you make a rounded box stencil?
Sorry, you need to Log In to post a reply to this thread.