Blur without derma.


Quick question here, how do I draw a blurred RoundedBox?

Kind regards,

[lua]local blur = Material(“pp/blurscreen”)

function surface.DrawBlurRect(x, y, w, h, amount, heavyness)
local X, Y = 0,0
local scrW, scrH = ScrW(), ScrH()


for i = 1, heavyness do
	blur:SetFloat("$blur", (i / 3) * (amount or 6))


	render.SetScissorRect(x, y, x+w, y+h, true)
		surface.DrawTexturedRect(X * -1, Y * -1, scrW, scrH)
	render.SetScissorRect(0, 0, 0, 0, false)


Why thank you.

However, I have decided to be using DPanel.

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

	HUDF = vgui.Create("DPanel")
	HUDF:SetPos(10,scrh - 200)
	HUDF:SetExpensiveShadow(10, Color(0,0,0,255))

Why is that not working?

DFrame:SetBackgroundBlur only works with DFrames.

Welcome :smiley:

Would this work then?

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

	HUDF = vgui.Create("DFrame")
	HUDF:SetPos(10,scrh - 200)
	HUDF:SetExpensiveShadow(10, Color(0,0,0,255))

[editline]12th December 2016[/editline]

Okay nevermind, that just blurs out everything EXCEPT the frame. So, how do I get a blurred background on my DPanel? Sorry for asking so many questions, this is like my first HUD ever and am still kind of confused.

You shouldn’t have quotes around your boolean values. The string false is truthy value.

local b = "false"
if b then

That would print “true”

You can paint. Panels :smiley:

I found the solution and will post it tomorrow if anyone’s interested.

Next question though, how would I make the upper half of the current player’s player model appear inside of a DPanel? I probably know how to put it in the DPanel, but I can’t seem to find a function or anything that renders the upper half of the player model. If someone could help me out, that’d be great.

What have you tried already? Majority of these questions here are always “How to do this i want to do this.” and people never really try to figure it out on there own.

I searched on the wiki. When typing PlayerModel it only gives 2 results; none of which are the answer. When typing model alone it gives too many results too search through. As I mentioned earlier, this is my first HUD ever so I’m very new to basically anything.

With the model panel you’d need to change where the camera is focusing on.

local plymodel = vgui.Create("DModelPanel","HUDF")


This is how far I came :frowning: Again I do apologize as this is my first HUD and pretty much script aswell. How do I find the a campos that shows pretty much the upper part of the body (starting somewhere from the bellybutton :P)

Thanks for the help so far!

The second argument of vgui.Create needs to be a panel. You’ve put a string.

Oh yeah my bad, I wrote that on my phone. Sorry.

Do you happen to know how to use the SetCamPos properly to achieve what I wish to achieve?

[editline]12th December 2016[/editline]

Crap, I accidentally rated your post Disagree. Dunno how to remove that, sorry

Can we just take a look at the wiki for more than a couple seconds? I’m aware the example in the Wiki is not spot on perfect for what you want however… If you just inputted some other values and messed with it you could of achieved your results. Heres the example FROM THE WIKI.

BGPanel = vgui.Create( “DPanel” )
BGPanel:SetPos( 20, 20 )
BGPanel:SetSize( 200, 200 )
BGPanel:SetBackgroundColor( Color( 0, 0, 0, 255 ) )

local mdl = vgui.Create( “DModelPanel”, BGPanel )
mdl:SetSize( BGPanel:GetSize() )
mdl:SetModel( “models/player/gman_high.mdl” )

function mdl:LayoutEntity( ent )
ent:SetSequence( ent:LookupSequence( “menu_gman” ) )

local eyepos = mdl.Entity:GetBonePosition( mdl.Entity:LookupBone( “ValveBiped.Bip01_Head1” ) )

eyepos:Add( Vector( 0, 0, 2 ) ) – Move up slightly

mdl:SetLookAt( eyepos )

mdl:SetCamPos( eyepos-Vector( -12, 0, 0 ) ) – Move cam in front of eyes

mdl.Entity:SetEyeTarget( eyepos-Vector( -12, 0, 0 ) )

I checked that put but don’t understand how to use it. I don’t want to use the gman mdl, but the player model. I don’t understand how that script works so I was hoping that someone could explain it a little bit to me. I don’t wanna be using code that I don’t underdtand.

[editline]13th December 2016[/editline]

I think I’ve got it figured out (partially)

Why is the character turning around constantly? I want to freeze his model at the position I set earlier.

// Top bar
local TBAR = vgui.Create("DPanel", HUDF)

function TBAR:Paint(w,h)

// Left panel
local BGMDL = vgui.Create("DPanel", HUDF)

function BGMDL:Paint(w,h)

local PLYMDL = vgui.Create("DModelPanel", BGMDL)

PLYMDL:SetSize(150, 110)
PLYMDL:SetModel( LocalPlayer():GetModel() )
PLYMDL:SetCamPos( Vector( 25, -15, 60 ) )
PLYMDL:SetLookAt( Vector( 0, 0, 60 ) )

Thanks in advance.

Take a look at example 2 here

The wiki lists every single function you would need, you need to start looking at it more and figuring it out.

LayoutEntity will do this for you.

I checked it out earlier but it says I really shouldn’t use it. I’m scared of breaking my game so maybe I should look for another solution?

[editline]13th December 2016[/editline]

// Playermodel

local PLYMDL = vgui.Create("DModelPanel", BGMDL)

PLYMDL:SetSize(150, 110)
PLYMDL:SetModel( LocalPlayer():GetModel() )
PLYMDL:SetCamPos( Vector( 25, -15, 60 ) )
PLYMDL:SetLookAt( Vector( 0, 0, 60 ) )

function PLYMDL:LayourEntity(PLYMDL)

still doesnt do anything? ugh this stuff is so confusing!

[editline]13th December 2016[/editline]

nvm, I’m retarded, typo in LayourEntity kek

(bold added by me)

The phrasing on the wiki is a little confusing but ‘shouldn’t use it’ is meaning you don’t/shouldn’t need to actually call the function ie. you should never need to call pnl:LayoutEntity() yourself, the engine will call it for you. However you can override the function, so the engine will call your new function for you.