What's the reason Garry's Mod won't get any new shaders at all?

I’ve dug deep into this knowing that there’s multiple threads, but none of the threads really received a definitive answer.

From what I understand, Garry has been quoted as saying this:

But there’s also this:

So shaders have been added to Garry’s Mod in the past, apparently, and code can be compatible for all platforms, and yet:

This has always confused me. There’s people on the 2006 branch of Half-Life 2 who have managed to get parallax working in Half-Life 2 Deathmatch and Counter-Strike (defunct of course). There’s people on the 2007 branch and the 2013 branch who get to use the Source Shader Editor. (both of which have a tutorial for installation and usage) And it really doesn’t end there - there’s code for parallax corrected cubemaps floating around for anyone to use, and shaders already made for the Source Shader Editor as well for people to use.

So what’s the problem? When you get right down to it, it doesn’t have to involve Lua at all - it could just be fixing and adding features (like parallax corrected cubemaps) to existing shaders. It could involve people making their own shaders and sending them in to be added to a future update. I don’t know why the answer has to be “can’t and won’t be done”.

This is not me shaking my fist angrily with demands, either. If it is honestly too much of a task to be dealt with, I can completely understand that. If it’s just something no one wants to do, I can completely understand that. I’ve just become confused looking at these multiple statements that don’t necessarily agree with each other.

Imagine garrysmod getting a feature

rubat is too busy removing the shit from the workshop to implement shaders :v:

There’s is a big difference between getting NEW shaders, and making existing ones function the way they do in CS:GO/Portal 2/Whatever.

The latter cannot be done because we obviously don’t have any sources from those games.

What NEW shaders do you want, that wouldn’t be used by 1 or 2 mods/people or whatever?
I don’t see how spending time making new shaders on any modders whim is a good idea.

As for Parallax Corrected Cubemaps, don’t they only work under very specific circumstances (i.e. the room has to be a box basically) and require every cubemap on every map to be rebuilt to actually work? Doesn’t seem like a reasonable thing to bother with to me.

And with Source Shader Editor, I personally haven’t looked into it at all. It’s can be a good idea/solution if it actually works.

A lot of mappers would totally love having fixed shaders. It wouldn’t be just one or two people.

Lots of rooms are generally box-shaped because of how Source and vis works. You could break plenty of maps into boxes.

And with Source Shader Editor and the stuff people have already finished, a lot of the work is already done for you. There’s code in my post for PCCM. Last I tinkered with SSE there were example shaders as well, which I believe also includes ambient occlusion.

Ultimately, a lot of people either don’t say anything about shaders because they’re convinced they’re never going to happen, or don’t really know about them and how useful they can be. A person who hasn’t heard of classes, for instance, probably doesn’t see a lot of value in it out right but will find them a useful tool after exposure. Therefore, I don’t think it’s fair to say “hey, no one cares about X” or “hey, no one would use X” because I think you’re biased to not wanting to use your time on uncertain things. And just so you know, I do think that’s an understandable fear to have and sympathize. But seriously ask the mappers we have in this forum and I’m sure they can come up with lots of ideas for shaders and use them.

I stumbled into this post somehow but

Shaders can be a bitch when it comes to cross-platform stuff, and since HLSL is used on Windows and GLSL is used on Mac there will undoubtedly by potential incompatibilities. Especially because Mac OpenGL support is so piss-poor. It looks like the shader editor might export compiled shader bytecode, though?

That would make things worse, I believe. You can’t take shader bytecode made for HLSL and hope to run it on a different OS with a different API on different graphics hardware running different graphics drivers. This sounds like it’d be a nightmare for the devs to implement, but I’m not familiar with Source, GMod, or any graphics API (anymore) besides Vulkan. Its too bad you can’t use something like SPIR-V and that ecosystem of tools, which would maybe simplify supporting custom shaders on different platforms + rendering APIs. Mac supposed supports OpenGL 4.1 (Nominal support, ugh) and there’s a SPIR-V extension for OpenGL 3.3 that could maybe work? Windows shaders would still require something like SPIR-V cross to get them into an HLSL-like format. not sure how the rendering backend works for Garry’s Mod at all tbh. Unity seems to have figured something out though?

[sp]this is why I love Vulkan and SPIR-V tbh, even using MoltenVK (vulkan-to-metal shim for mac) I’m able to use the same set of compiled SPIR-V shaders everywhere[/sp]

My main concern with shaders would be security. I’m not sure how it works in source engine but assuming it’s just straight forward HLSL shaders with some extensions you can do things like read textures out of bounds and end up showing the contents of a browser running in the background.

You can also of course stall the GPU and make it do hard work (I’m sure someone will make a server that mines cryptocurrency) but maybe this is not so bad or different from being able to do the same in lua.

As for shader use cases I can think of many things. I would love to make a 2d effect library for instance if it was added to gmod. Could even play with new ways of rendering 3d geometry (depending on how it’s implemented)

Source engine is a cross platform engine so I’m sure it handles this. Your concern here is for making an engine from scratch. According to ToGL it translates HLSL to GLSL at bytecode level. So I assume the workflow is to just to write HLSL and compile it with the tools the valve wiki says you should.

I think adding already available and written shaders would be a good thing because it would further diversify Garry’s Mod as a content platform. Things such as Tower Unite started off on Gmod as Gmod Tower, and it would be good to keep such content on Garry’s Mod rather than it moving away due to limitations with the game.

I feel shaders such as those used in Portal 2 and CSGO could likely be acquired if a dialogue was opened with Valve. After all Garry’s Mod already takes advantage of the content of those games.

Though I can also understand not wanting to add more things to Garry’s Mod what with Gmod 2 under development.

I think something like Phong for materials, corrected cubemaps, parallax, and SSAO would go a long way.

IIRC first requirement for parallax mapping is directx 11 implementation into source, not sure about SSAO, but i’ve seen some SSAO implementations on source shader editor, but it looked pretty bad, maybe once again, due engine limitations…
But as content creator, you can create pretty good looking models and materials with actual source engine with the correct material parameters, but the only thing we really lack is a base PBR shader

One thing that makes Garry’s Mod such a great platform is it has a ton of content for the modders to tap into - not the game developers. If anything, Garry’s Mod is a platform for new content. The argument (usually) isn’t “raise your hand if you might use this, we can’t think of too many options so we don’t want to add it”, but instead “here’s some tools, go make some shit with them.”

PBR is another one that I thought would be cool, but I think might take a lot of work, right?

I’ve seen working deffered lighting in both ASW, and a, well, “forward port” of 2013 SP/MP onto the ASW platform. Of course I’ve no idea if this is within the bounds of the Source shader editor.

Not to mention it was pretty dang buggy a lot of the time.

I think I’ve misunderstood the point of this thread, in WAYWO there was talks of adding a shader API so I kinda wrote my post with context from that thread.

If gmod has a shader API, you can do some of these things by yourself. SSAO for instance is very simple, but you need access to the depth buffer to do that. (which we have already)

If you want to do PBR you’ll need to modify VertexLitGeneric and I’m not sure how an API for doing that in lua is possible. But even if it was, it’s not just about “making a PBR shader”, you’ll need to replace materials and textures in game as well and just revamp the whole system. You might get something easily going for 1 model and a cubemap, but you need to think about how to do this for an entire map and all of its assets. You can’t just apply this type of shading on an existing source engine map for instance.

I’m not sure what kind of buffers you get access to when writing shader code with the shader API, but typically in forward shading most of the stuff is done in one big shader (VertexLitGeneric) as much of the information you want to use is only available there.

So if you want to make SSR for instance you’ll need access to at least a position buffer and normal buffer which I don’t think sure exists in this system. (a position buffer is just like a depth buffer except it contains a position (xyz) per pixel, same goes with normal)

If source engine was deferred it would be a lot easier to write effects for.

That’s what I thought. I originally thought PBR was just making materials on the fly with pre-made materials and settings, but it appears it’s way, way more complicated than that which is why I didn’t mention it. I don’t think we need it either.

Well…Unity 5 main feature was pbr rendering pipeline, it’s a master material, just like VertexLitGeneric
I’ve seen someone in programming waywo implementing pbr in a source ask 2013 project although, merging it would be way satisfying

You mean like this?

This one

Everything looks too not-source

Can anyone explain what they mean by ‘new’ shaders? Surely we’re not talking about things like Color Correction/Bloom/Sobel, right? How are ‘new’ shaders coded, how are they made, and what is their limit? Hoping someone could enlighten me.

Shader as it means, is how an object (Can be a model, a quad, a hud) is drawn in the screen, how the light affects it, how it shines, how it reacts to maths and properties
Like you can animate something by using a degree

Take as example pokemon battle start animation, that’s a shader, it uses a black texture and another image as sampler to animate the screen, so you don’t have to create every frame of animation

This guy teach about how shader works and how you can write those

Everything is most likely code, the limits are the graphic engine, like direct x version, open gl, platform, etc