Modular image adjustment shader

I know people like to tinker with mixing and matching different effects but it’s not always clear how functions fit together or what they require, so I abused slang’s #include support to make a bunch of single-purpose shader pieces and a big mega shader that they all fit into:

So far, this just sounds like the regular image adjustment shader, but I also made it really easy to disable what you don’t need while also removing the parameters from the list. (comment the #include statement, then comment the corresponding line in the vertex/fragment–all of which are labeled reasonably clearly–and that’s it)

Of course, the various shader pieces can also be #included wherever someone finds them useful, and it’s easy to add new ones if someone wants to submit things for it (I’ve already included several of the variations from @Dogway’s grade shader).

I figured @Syh and @Nesguy would probably get the most use out of it, but it could be useful for @HyperspaceMadness, too, if for no other reason than a reference.

7 Likes

I feel personally attacked, rofl.

This is cool, I’m going to go see what is all included in it there currently.

EDIT: Deleted my other post as I’m dumb and didn’t finish scrolling through your link, which would’ve answered my questions, lol.

I do have to say that’s fancy as hell, I’m not sure if I’ll end up using it but it’s lovely reference material. So this is super appreciated.

3 Likes

lol, I was thinking of something like this the other day. I think it’s useful, definitely.

Would it be possible to put ALL the CRT shader functions into a single shader? :crazy_face:

3 Likes

I did a pull request? I think, idk how github works. I sent a request to update something.

And when I had everything set up a new toy to play! lol Have no time.

I really like having CRT style controls in addition to the more conventional color controls found in grade.

A question, if I wanted to use this on the mupen64 core I’d need to change the driver to glcore, are there any drawbacks compared to plain gl driver?

2 Likes

It’s possible, but there shouldn’t be. Glcore should be the same, just newer, with the only drawback being it requires slightly less ancient hardware.

@Nesguy We can try to add some, sure. I didn’t yet add anything that monkeys with how you actually sample the texture, which most of the fancier CRT effects rely on.

3 Likes

I have some issues with glcore, it doesn’t autoload shaders from the config and I have to load manually everytime. Is/was this a known issue? I’m still on 1.7.7 so if this has been fixed recently I can update.

I don’t remember if 1.7.7 has the big shader changes in it, but you can now set a global shader preset, core shader presets and/or apply shader presets from the command line with --set-shader

If you can’t do that stuff, it may be worthwhile to update.

1 Like

Ah yeah, just tested 1.8.5, what a pain, now no driver loads from config video_shader = " " I have same cores used for different systems, so a core override is not desired. And command line calls is going to mess a lot with my current front-end setup. I’ll keep on glsl for the time being.

There’s also content directory presets/overrides, so if you have, say, SMS games in a separate directory from your Gen/MD games, you can still use genplusgx for both and apply a different shader.

2 Likes

Yes, its a little more complex because some games within a same system use different shaders under certain criteria (PAL/NTSC, H40/H32, etc), and I override the main config with a second config including the shader (and/or video driver). Well, enough rambling I’ll use vulkan un such case, thanks for the help!

3 Likes

I thought on including this to the glass shader to tint the reflection, do you know how I can pass the temperature setting to the white_point() function?

By the way I ended up switching to retroarch 1.8.6 for all the bell and whistles, so far no issues I had to include a “–set-shader” call to the module (HyperLaunch) and find the shader in the configs through a loop. The only thing is that retroach now takes like 3 times longer to close than in v1.7.7.

1 Like

Look at mame_hlsl, and it’s something like (bool = whatever) or something like that it involves bool.

We may be talking about different things though.

1 Like

No dice:

#include  "..\include\img\white_point.h"
float params.g_refltemp = float(WHITE_POINT);

nor:

float WHITE_POINT = float(params.g_refltemp);

To apply it, you wrap whatever your vec3 image is, like this:

You’ll need to do a macro for each of the parameters, too, like:

#define temperature params.temperature

3 Likes

Thank you, took me a while (I’m a bit slow) but now it’s functioning. Is it possible to change the UI name of the parameter?

1 Like

Not without changing it in the included file, but I’m up for that if you have a better name for it.

3 Likes

It was to differentiate between the two temperature calls , for the image itself and for the glass reflection. I think it would make sense to have either white_point or grade’s temperature called “White Point” while having the include one a more generic like “Color Temperature”, so it’s less confusing.

EDIT: Probably prefixing settings with an “i_” for include should be wise to avoid confussion too.

1 Like

that’s a good idea. I’ll definitely do this.

2 Likes