• GMod - What are you working on? September 2016 (#61)
    330 replies, posted
more blur. I think I'll turn this into a tool or something so people can place these around in places. will include options to make draw a box behind the text, control box color, control if it has blur, and control if the box pulses in a sine/absolute sine. [video]https://youtu.be/8V8RtD18d_I[/video]
[QUOTE=Z0mb1n3;51100179]more blur. I think I'll turn this into a tool or something so people can place these around in places. will include options to make draw a box behind the text, control box color, control if it has blur, and control if the box pulses in a sine/absolute sine. [video]https://youtu.be/8V8RtD18d_I[/video][/QUOTE] Very "The Division"-esque.
[QUOTE=Revenge282;51100487]Very "The Division"-esque.[/QUOTE] definitely what I'm going for
Working on a light bounce script: first results: [t]https://picload.org/image/rdrpiipd/poster-16-09-2422-42-45.png[/t][t]https://picload.org/image/rdrpiwol/poster-16-09-2422-57-42.png[/t] After some improvements: [t]https://picload.org/image/rdrppooa/poster-16-09-2423-01-29.jpg[/t] At this point I realized it was infact (as expected) generating legit reflections due to phong: [t]https://picload.org/image/rdrpplrd/poster-16-09-2423-10-38.png[/t][t]https://picload.org/image/rdrpplda/poster-16-09-2423-01-29.jpg[/t] Played around with it some more: [t]https://img5.picload.org/image/rdrpwdaa/poster-16-09-2500-55-10.jpg[/t][t]https://picload.org/image/rdrpwodr/poster-16-09-2500-15-38.png[/t][t]https://picload.org/image/rdrpwoda/poster-16-09-2500-44-11.png[/t] [t]https://picload.org/image/rdrpwodi/poster-16-09-2500-45-59.png[/t][t]https://picload.org/image/rdrpwodw/poster-16-09-2500-47-19.png[/t][t]https://picload.org/image/rdrpwoar/poster-16-09-2500-54-31.png[/t] [t]https://picload.org/image/rdrpworw/poster-16-09-2501-05-29.png[/t] This works by utilizing a serverside/clientside visual scan system I coded which scans a client's screen information and calculates pixel positions and retrieves their color. Here a lamp's projection was scanned, producing "accurate" light bounce data. Most of the above pictures are just the first light bounce pass, and don't include the initial direction illumination
Please link those to an imgur gallery or something... I think you almost made my phone explode.
[QUOTE=VIoxtar;51100673][t]https://picload.org/image/rdrpwodr/poster-16-09-2500-15-38.png[/t][/QUOTE] You always manage to make gmod look good somehow It'd be amazing if you got all your lighting stuff together and shoved it into one addon called 'Source 2 Graphics Simulation' or something- I'd get it even if it's 1fps
[QUOTE=Nak;51098978]Instant crash when calling right before returning false. The hook works, but in some cases it will break the physic engine completely.[/QUOTE] You need to call CollisionRulesChanged when collision rules has been changed, i.e. when calling ShouldCollide hook will return different results then last time it was called for this entity. [editline]25th September 2016[/editline] Here is an example: [CODE]concommand.Add( "nocollidemepls", function(ply) ply.NoCollideMePlease = !ply.NoCollideMePlease end) hook.Add( "ShouldCollide", "NoCollideMePlease", function(e1,e2) if e1.NoCollideMePlease or e2.NoCollideMePlease then return false end end)[/CODE]
[QUOTE=MPan1;51101136]You always manage to make gmod look good somehow It'd be amazing if you got all your lighting stuff together and shoved it into one addon called 'Source 2 Graphics Simulation' or something- I'd get it even if it's 1fps[/QUOTE] It would be cool if he figured out some way to store baked data and load it for clients without having to rebake every time.
[QUOTE=VIoxtar;51100673]Working on a light bounce script: first results: [t]https://picload.org/image/rdrpiipd/poster-16-09-2422-42-45.png[/t][t]https://picload.org/image/rdrpiwol/poster-16-09-2422-57-42.png[/t] After some improvements: [t]https://picload.org/image/rdrppooa/poster-16-09-2423-01-29.jpg[/t] [/QUOTE] that looks fucking incredible.
[QUOTE=Z0mb1n3;51100179]more blur. I think I'll turn this into a tool or something so people can place these around in places. will include options to make draw a box behind the text, control box color, control if it has blur, and control if the box pulses in a sine/absolute sine. [video]https://youtu.be/8V8RtD18d_I[/video][/QUOTE] How'd you do 3D2D blur? Looks cool.
[QUOTE=Tenrys;51103184]How'd you do 3D2D blur? Looks cool.[/QUOTE] I have posted a solution in one of the past WAYWOs.
[QUOTE=MPan1;51101136]It'd be amazing if you got all your lighting stuff together and shoved it into one addon called 'Source 2 Graphics Simulation' or something- I'd get it even if it's 1fps[/QUOTE]That's the plan, though none of this is real time, it takes quite a while render actually. Not even 1 FPS, it's only for taking pictures. Context: I am the main coder for most of the other lighting scripts, but this one specifically is all Viox. Viox - how do you even make your TEST screenshots look amazing?! god dammit [editline]25th September 2016[/editline] [QUOTE=Robotboy655;51103443]I have posted a solution in one of the past WAYWOs.[/QUOTE] ok so we just gotta look in 60 threads thanks
[QUOTE=Robotboy655;51103443]I have posted a solution in one of the past WAYWOs.[/QUOTE] Could be useful to put it in Useful Code Snippets then.. or whatever that thread was named.
[QUOTE=Tenrys;51103546]Could be useful to put it in Useful Code Snippets then.. or [B]whatever that thread was named[/B].[/QUOTE] [QUOTE=Robotboy655;51103443]I have posted a solution in [B]one of the past WAYWOs[/B].[/QUOTE]
[QUOTE=NeatNit;51103507] [editline]25th September 2016[/editline] ok so we just gotta look in 60 threads thanks[/QUOTE] [QUOTE=Tenrys;51103546]Could be useful to put it in Useful Code Snippets then.. or whatever that thread was named.[/QUOTE] Literally all you have to do is type "3d2d blur" into google and the thread I was referencing comes as the second result. [img]http://i.imgur.com/o18sbFe.png[/img] [url]https://facepunch.com/showthread.php?t=1444245&p=46973556&viewfull=1#post46973556[/url] Also this on the first result: [url]https://facepunch.com/showthread.php?t=1498758[/url]
[QUOTE=Nak;51098978]Instant crash when calling right before returning false. The hook works, but in some cases it will break the physic engine completely.[/QUOTE] You are not supposed to call it inside the hook, and it only breaks if you are returning inconsistent results from the last call to CollisionRulesChanged.
Simple NPC talk screen: (Ignore the HUD) [t]http://images.akamai.steamusercontent.com/ugc/251463491390689457/D8722E9261F18C4073D47F87119AE3E66430589E/?interpolation=lanczos-none&output-format=jpeg&output-quality=95&fit=inside|1024:576&composite-to%3D%2A%2C%2A%7C1024%3A576&background-color=black[/t]
[QUOTE=Robotboy655;51103818]Literally all you have to do is type "3d2d blur" into google and the thread I was referencing comes as the second result.[/QUOTE] I think he really did just mean it would be an awesome addition to Useful Code Snippets. I doubt he was trying to sass you off or anything.
[QUOTE=Zeh Matt;51104238]You are not supposed to call it inside the hook, and it only breaks if you are returning inconsistent results from the last call to CollisionRulesChanged.[/QUOTE] I'm not sure how I should call ENT:CollisionRulesChanged() before GM:ShouldCollide, as the hook determines what passes through. It's currently working without ENT:CollisionRulesChanged() and I haven't had any physic-crash since the last time. Am I doing something wrong? [lua]hook.Add("ShouldCollide","ent_Energy_Gates",function(ent1,ent2) if !IsValid(ent1) or !IsValid(ent2) then return end local building = (ent1:GetClass()=="ent_energy_gate" and ent1 or ent2:GetClass()=="ent_energy_gate" and ent2 or nil) if !IsValid(building) then return end -- Not a gate local ply = GetPlayer(ent1) or GetPlayer(ent2) or nil if !IsValid(ply) then return end -- We got a gate and a player if build.CanInteract(building,ply) and building:GetOn() then return false end return true end)[/lua] GetPlayer(ent) checks for a few things like vehicles, and returns a valid player or nil.
Some testing with buying perks on yet another zombies gamemode [media]https://www.youtube.com/watch?v=lahrSohzvl8[/media] Enjoy the 480p
I made it into a tool. Lots of options... [quote][vid]http://zombine.me/file/2016-09-25_17-07-39.mp4[/quote][/vid] Unfortunately, having more than two screens with blur enabled in your view at the same time starts to majorly kill FPS. I don't know of a better way to do the blur for the panels. Here's the code for that if you want to help. [code]local function startCanvas(ref) render.ClearStencil(); render.SetStencilEnable(true); render.SetStencilCompareFunction(STENCIL_ALWAYS); render.SetStencilPassOperation(STENCIL_REPLACE); render.SetStencilFailOperation(STENCIL_KEEP); render.SetStencilZFailOperation(STENCIL_KEEP); render.SetStencilWriteMask(254); render.SetStencilTestMask(254); render.SetStencilReferenceValue(ref or 43); end; local function drawOn() render.SetStencilCompareFunction(STENCIL_EQUAL); end; local function stopCanvas() render.SetStencilEnable(false); end; function CLASS:DrawHeaderBG(str, x, y, size, clr, xalign, yalign, boxColor, bBlur) surface.SetFont(self:ParseFont(size)); local w, h = surface.GetTextSize(str); local aligned_x = x; local aligned_y = y; if (xalign == TEXT_ALIGN_CENTER) then aligned_x = x - w / 2; elseif (xalign == TEXT_ALIGN_RIGHT) then aligned_x = x - w; end; if (yalign == TEXT_ALIGN_CENTER) then aligned_y = y - h / 2; elseif (yalign == TEXT_ALIGN_BOTTOM) then aligned_y = y - h; end; if (bBlur) then startCanvas(); surface.SetDrawColor(255, 255, 255, math.Round(1 * self.openFactor)); surface.DrawRect(aligned_x, aligned_y, w, h); drawOn(); render.SetMaterial(divBlur); for i = 0, 1, 0.2 do divBlur:SetFloat("$blur", i * 8); divBlur:Recompute(); render.UpdateScreenEffectTexture(); render.DrawScreenQuad(); end; stopCanvas(); surface.SetDrawColor(ColorAlpha(boxColor, boxColor.a * self.openFactor)); surface.DrawRect(aligned_x, aligned_y, w, h); else surface.SetDrawColor(ColorAlpha(boxColor, boxColor.a * self.openFactor)); surface.DrawRect(aligned_x, aligned_y, w, h); end; self:Header(str, x, aligned_y, size, clr, xalign, yalign); end;[/code]
I personally think the blur isn't necessary especially if the FPS is gonna drop.
Slightly relevant - Created a thread for those who created custom gamemodes and have servers for them ( [URL="https://facepunch.com/showthread.php?t=1535717"]https://facepunch.com/showthread.php?t=1535717[/URL] )
[QUOTE=Nak;51098935]Working on trying to make ShouldCollide behave. (Thx for Spai for testing) [media]https://www.youtube.com/watch?v=6lo_CzfGlC4[/media] Seems like a loosing battle tho..[/QUOTE] There's only one way to use ShouldCollide properly. All your logic should live outside of the ShouldCollide hook (e.g. in a Think hook) and whenever the result of two entities changes, you call [url=https://wiki.garrysmod.com/page/Entity/CollisionRulesChanged]CollisionRulesChanged[/url] on both of them. The ShouldCollide hook itself should be no more complicated than: [code] hook.Add( "ShouldCollide", "", function( ent1, ent2 ) if staticCondition( ent1, ent2 ) then return false end end ) [/code] Obviously if the result of staticCondition is changing, that is when you call CollisionRulesChanged. Do it right and you'll be able to change the collision of every entity against every other entity every single tick without anything fucking up.
[QUOTE=Willox;51107083]There's only one way to use ShouldCollide properly. All your logic should live outside of the ShouldCollide hook (e.g. in a Think hook) and whenever the result of two entities changes, you call [url=https://wiki.garrysmod.com/page/Entity/CollisionRulesChanged]CollisionRulesChanged[/url] on both of them. The ShouldCollide hook itself should be no more complicated than: [code] hook.Add( "ShouldCollide", "", function( ent1, ent2 ) if staticCondition( ent1, ent2 ) then return false end end ) [/code] Obviously if the result of staticCondition is changing, that is when you call CollisionRulesChanged. Do it right and you'll be able to change the collision of every entity against every other entity every single tick without anything fucking up.[/QUOTE] Theres another way one that should be efficient if I got it right: [lua]if SERVER then AddCSLuaFile() end local COLLISION_ID_PAIRS = {} local DbgPrint = print local function GetPairId(ent1, ent2) local id1 = ent1:EntIndex() local id2 = ent2:EntIndex() if (id2 < id1) then id1, id2 = id2, id1 end local id = bit.lshift(id2, 16) id = bit.bor(id, id1) return id end hook.Add("ShouldCollide", "LambdaShouldCollide", function(ent1, ent2) local id = GetPairId(ent1, ent2) return COLLISION_ID_PAIRS[id] or true end) local ENTITY_META = FindMetaTable("Entity") function ENTITY_META:SetCollideWith(ent2, state) local id = GetPairId(self, ent2) self:EnableCustomCollisions(state) ent2:EnableCustomCollisions(state) COLLISION_ID_PAIRS[id] = state self:CollisionRulesChanged() ent2:CollisionRulesChanged() end [/lua] All you have to do in think is ent:SetCollideWith(ent2, true/false) It takes care of the rest. NOTE: I never really tested it.
[QUOTE=Zeh Matt;51107196]:snip:[/QUOTE] This doesn't handle ent indexes being recycled as entities are removed and spawned - especially for players Edit: better to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetCreationID]Entity:GetCreationID[/url]. It's guaranteed to be unique and never repeat. Also I'm not 100% sure but I think entity index -1 is used for all clientside entities, better play it safe and support those as well ;D
[QUOTE=NeatNit;51107750]This doesn't handle ent indexes being recycled as entities are removed and spawned - especially for players Edit: better to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetCreationID]Entity:GetCreationID[/url]. It's guaranteed to be unique and never repeat. Also I'm not 100% sure but I think entity index -1 is used for all clientside entities, better play it safe and support those as well ;D[/QUOTE] You could be right, altho as long you are not calling EnableCustomCollisons on the entity it will not query it. However the thing about the ent index being -1 could be trouble, need to check out GetCreationID, if its just counting up it would do the trick.
tweaked the light bounce script a lot today and yesterday, I think I'm pretty close to nailing believable bounce, thought I'd share the results, this is almost practically all in-game (no manual touches): [t]https://picload.org/image/rddralrd/lightbouncetest.jpg[/t] Which is a stitch of two bounce passes and a direct illumination pass (the script outputs these separately): [t]https://picload.org/image/rddracri/3.jpg[/t][t]https://picload.org/image/rddracrl/2.jpg[/t][t]https://picload.org/image/rddracra/1.jpg[/t] I have no idea how to encapsulate this into a more streamlined tool, it feels like there are too many settings
That is so cool! Do you bake it or is it actually real-time? Would definitely be useful for scenebuild type things.
[QUOTE=Grocel;50941303]Guys, as I am a developer of [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=246756300"]a radio addon[/URL] that can also play from SoundCloud, I use the [URL="https://developers.soundcloud.com/docs/api/reference"]SoundCloud API[/URL]. About a year after registration I got an email telling me that my application would violate the [URL="https://developers.soundcloud.com/docs/api/terms-of-use"]Terms of Use[/URL] and that they would disable my access. So I checked them. Maybe it just me but, I think they just went into Nazi mode. Before the last time I checked they were quite gentle. I like to you guys to know about it before you may use their API and run into the same problem. I mean just look at this: [QUOTE][...] you must not use the SoundCloud® API, or any User Content accessible via the SoundCloud® API, for any of the following purposes [see below:][/QUOTE] [QUOTE][...] to create any kind of alternative digital content service, including: any service that aggregates and streams User Content from multiple users into an on-demand listening service, or any playback experience which aggregates and streams User Content with content from other services (e.g. SoundCloud with YouTube) I am not allowed to use this when the application supports other things than SoundCloud as well?[/QUOTE] Or this: [QUOTE][...] to incorporate, synchronize or use User Content with or into any advertisement, game, video, film or other audiovisual work, or any other application, unless you’ve obtained all relevant licenses, including synchronization licenses, from all relevant rightsholders So no in game usage of any content that has be already been made public, free and yes made available for API access by the author?[/QUOTE] This: [QUOTE][...] to create any webcasting radio app So what useful applications beside radio clients and media players could have use for such an API? I think none in the GMod world or even everywhere else.[/QUOTE] [...][/QUOTE] Well an update for one who might thinking about using the SoundCloud API for one of their projects too. I just got an email saying that my API key got revoked, because of this: [QUOTE=email] Regardless of any permissions set by any Uploader with respect to any User Content, you must not use the SoundCloud® API, or any User Content accessible via the SoundCloud® API, for any of the following purposes: to incorporate, synchronize or use User Content with or into any advertisement, game, video, film or other audiovisual work, or any other application, unless you’ve obtained all relevant licenses, including synchronization licenses, from all relevant rightsholders. Notwithstanding the above, SoundCloud shall have the sole right to determine whether or not an app is acceptable, and we reserve the right to revoke API access for any app that we determine is not providing added benefit to SoundCloud® users and/or is not in the best interests of SoundCloud or our users.[/QUOTE] So basically it's a "Don't use the API for anything, especially for in-game stuff!", isn't it?
Sorry, you need to Log In to post a reply to this thread.