• Blur
    21 replies, posted
Hello, I want to put a blur material under this draw.RoundedBox: [code] draw.RoundedBox( 0, 775, ScrH() - 100, 350, 70, Color( 50, 50, 50, 165 )) draw.RoundedBox( 0, 800, ScrH() - 90, 260 * hp, 45, Color( 225, 255, 255, 150)) [/code] How would i do this? I already saw a other thread but that wasn't working for me. Thank you very much!
Literally the second result from Facepunch when searching "gmod blur": [url]https://facepunch.com/showthread.php?t=1509349[/url]
[QUOTE=geferon;52633410]Literally the second result from Facepunch when searching "gmod blur": [url]https://facepunch.com/showthread.php?t=1509349[/url][/QUOTE] Literally another person that can't read :P [B]I already saw a other thread but that wasn't working for me.[/B]
Second comment on the thread already linked [url]https://facepunch.com/showthread.php?t=1509349&p=49878319&viewfull=1#post49878319[/url]
[QUOTE=Scepto;52633489]Literally another person that can't read :P [B]I already saw a other thread but that wasn't working for me.[/B][/QUOTE] Mate, we're trying to help you. If you treat us like that you ain't going to get more help from us. And, you say i'm "another one that can't read", yet you didn't even take a look at that thread i linked you.
[QUOTE=geferon;52633514]Mate, we're trying to help you. If you treat us like that you ain't going to get more help from us. And, you say i'm "another one that can't read", yet you didn't even take a look at that thread i linked you.[/QUOTE] Im not treating you... Im just trying to say that i already looked that the threat and that it did not work.. [editline]31st August 2017[/editline] [QUOTE=txike;52633497]Second comment on the thread already linked [url]https://facepunch.com/showthread.php?t=1509349&p=49878319&viewfull=1#post49878319[/url][/QUOTE] Tryed that already... It's messing with my Arc... And it doesn't show up..
[QUOTE=Scepto;52633527]Tryed that already... It's messing with my Arc... And it doesn't show up..[/QUOTE] Once more, as I always say, saying "It doesn't work" doesn't supply us any info and we can't even help you with that. Care to share the code to see how it is so we can help you with it and see what's wrong about it and how is it messing with your Arc?
[QUOTE=geferon;52633544]Once more, as I always say, saying "It doesn't work" doesn't supply us any info and we can't even help you with that. Care to share the code to see how it is so we can help you with it and see what's wrong about it and how is it messing with your Arc?[/QUOTE] [code] local blur = Material("pp/blurscreen") local function DrawBlur( 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 myFrame.Paint = function( slf ) DrawBlur( slf, 3, 6 ) --> You can change the 3 and 6 to whatever you want. end [/code] Im using ARC Circle... But the textures of the arc is getting bugged... The same when im using a roundedbox the arc gets effected. The Blur doesn't show up aswell
[QUOTE=geferon;52633544]Once more, as I always say, saying "It doesn't work" doesn't supply us any info and we can't even help you with that. Care to share the code to see how it is so we can help you with it and see what's wrong about it and how is it messing with your Arc?[/QUOTE] The code Tupac has supplied is for rectangles only. [code]surface.DrawTexturedRect( x * -1, y * -1, scrw, scrh )[/code] [editline]31st August 2017[/editline] [QUOTE=Scepto;52633572][code] local blur = Material("pp/blurscreen") local function DrawBlur( 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 myFrame.Paint = function( slf ) DrawBlur( slf, 3, 6 ) --> You can change the 3 and 6 to whatever you want. end [/code] Im using ARC Circle... But the textures of the arc is getting bugged... The same when im using a roundedbox the arc gets effected. The Blur doesn't show up aswell[/QUOTE] If you want this to work, you will need to involve this code into the arc code and remove some of its code.
[QUOTE=FireWolf2525;52633573]The code Tupac has supplied is for rectangles only. [code]surface.DrawTexturedRect( x * -1, y * -1, scrw, scrh )[/code] [editline]31st August 2017[/editline] If you want this to work, you will need to involve this code into the arc code and remove some of its code.[/QUOTE] For example i have a RoundedBox that is transparent... I want to have a layer under it that is blur... What do i have to do then.. Because the only thing that i get is this: [code] [ERROR] lua/autorun/client/cl_hud.lua:105: attempt to index global 'myFrame' (a nil value) 1. unknown - lua/autorun/client/cl_hud.lua:105 [/code] (Sorry if im frustrating you)
[QUOTE=Scepto;52633792]For example i have a RoundedBox that is transparent... I want to have a layer under it that is blur... What do i have to do then.. Because the only thing that i get is this: [code] [ERROR] lua/autorun/client/cl_hud.lua:105: attempt to index global 'myFrame' (a nil value) 1. unknown - lua/autorun/client/cl_hud.lua:105 [/code] (Sorry if im frustrating you)[/QUOTE] Put the code in myFrame.Paint in the HUDPaint hook and get rid of the myFrame.Paint function.
Next time, try adapting your code. So, i see that you're trying to use HUDPaint instead of an actual panel. So instead, in that case, you would need a different function. [url]https://facepunch.com/showthread.php?t=1487492&p=48781436&viewfull=1#post48781436[/url] which, again, is the 3rd result from google when searching for "gmod blur"
[QUOTE=geferon;52633808]Next time, try adapting your code. So, i see that you're trying to use HUDPaint instead of an actual panel. So instead, in that case, you would need a different function. [url]https://facepunch.com/showthread.php?t=1487492&p=48781436&viewfull=1#post48781436[/url] which, again, is the 3rd result from google when searching for "gmod blur"[/QUOTE] So where should i put the cordinates so there's a blur under my draw.RoundedBox? [code] draw.RoundedBox( 15, 1400, ScrH() - 970, 470, 850, Color( 50, 50, 50, 255 )) [/code] [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]
[QUOTE=Scepto;52634086]So where should i put the cordinates so there's a blur under my draw.RoundedBox? [code] draw.RoundedBox( 15, 1400, ScrH() - 970, 470, 850, Color( 50, 50, 50, 255 )) [/code] [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][/QUOTE] Idk what's the best coordinates for your blur. How about you do some trial and error with it and see which coordinates is the best (you have to realise this bit is based on visual look which you cannot be helped with)?
You've basically gotta put the same coords as on the box you're drawing
[QUOTE=FireWolf2525;52634452]Idk what's the best coordinates for your blur. How about you do some trial and error with it and see which coordinates is the best (you have to realise this bit is based on visual look which you cannot be helped with)?[/QUOTE] Well that's the problem... The blur just does not pup op...
[QUOTE=Scepto;52637743]Well that's the problem... The blur just does not pup op...[/QUOTE] How do you you have your code laid out? Saying that the blur doesn't pop up and there's a problem doesn't tell me anything. In lua, a simple miss of a comma can screw up your whole code so I don't know what you've done wrong right now. Sorry, but I can't help without either guessing the problem or receiving your work to look at and solve the problem.
[QUOTE=FireWolf2525;52637951]How do you you have your code laid out? Saying that the blur doesn't pop up and there's a problem doesn't tell me anything. In lua, a simple miss of a comma can screw up your whole code so I don't know what you've done wrong right now. Sorry, but I can't help without either guessing the problem or receiving your work to look at and solve the problem.[/QUOTE] [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(1067, ScrH() - 110, 80, 52) render.SetScissorRect(0, 0, 0, 0, false) end end [/code]
You're not meant to change the code of the actual function, just pass the arguments to it
[QUOTE=MPan1;52639739]You're not meant to change the code of the actual function, just pass the arguments to it[/QUOTE] How then?
[QUOTE=Scepto;52639786]How then?[/QUOTE] Post the code where you actually call draw.Blur.
[QUOTE=Scepto;52639786]How then?[/QUOTE] Don't think you know what a function is. A function is a re-usable block of code that can be called. It can accept parameters and return variables. Example: [code]function AddStuff(a,b) return a + b end[/code] Will take the input (a and b), add them together and return the result. What you've don is taking one of the default functions in garrysmod, and replaced it with your code. This will result in any script that uses the function to use yours instead. You need to call a function. This is don by: [code]AddStuff(1,5)[/code]
Sorry, you need to Log In to post a reply to this thread.