Another shader thread (gamma + blur)

Here’s a result I wanted to share with you.

Breath of Fire III:

Final Fantasy IX:

Saga Frontier II:

Saru! Get You! (Ape Escape):

First pass: https://github.com/Themaister/Emulator-Shader-Pack/blob/master/Cg/TV/gamma.cg Second pass: https://github.com/libretro/common-shaders/blob/master/Mudlord/blur-lighter.cg FBO Scale X/Y: 2.000000

gamma.cg replicates the gamma ramp feature introduced in bsnes way back. It actually works pretty well with most systems, not just SNES. To adjust the gamma, change the value “const float gamma” in a text editor. I set it to 1.75.

blur-lighter.cg is a blur shader. It looks pretty much like bilinear except you can smooth things out a lot more. To adjust the amount of blur, change the “float BlurFactor” value. I set it to 0.0007. IMO, with this, the 2D is really smooth without going too far (e.g ruining the text), and the 3D looks OK too.

Not a fan of blur or bilinear.

Is it possible to tone down the blur?

If you’re not interested in any blurring/smoothing at all, then you don’t need to use the blur shader. If you just want to tone it down, open it up in a text editor and change the “float BlurFactor” value on line 55. It looks like this by default in blur-lighter.cg:

float BlurFactor = 0.0010; //set between 0.001 and 0.05

Lower value for less blur. In my examples, it’s changed from 0.0010 to 0.0007. So I guess you’d want it to be even lower than 0.0007.

What is “Gamma ramp” exactly? Is it something I should be caring about?

It gives you a better colour balance, more in line with the real console connected to a CRT, making blacks actually black and not grey. There are more conventional methods of doing that by making the whole image darker, but it usually has the effect of making whites grey instead, and doesn’t look as good. I think it’s worth caring about.

Would a Scanline/CRT shader already do that, or should I pair both of them up?

Not sure, but I think some of the more advanced TV shaders might have some gamma stuff. I personally have pretty much given up on the shaders that utilize scanlines and similar effects though, because they are all too resolution-dependent.

Btw, has anyone seen any shader that does trilinear or anisotropic filtering?

Not sure, but I think some of the more advanced TV shaders might have some gamma stuff.

They do. Which means I’d have to disable that gamma correction in that, and then tweak the gamma.cg settings until it resulted in something similar.

I personally have pretty much given up on the shaders that utilize scanlines and similar effects though, because they are all too resolution-dependent.

And to display them right, you need to use integer scaling, which means you usually do not make full use of your screen. But they make the sprites look so good.

So solution: I’m finding a way to hook up my laptop to a CRT tv. Shaders are such a mixed bag.

And to display them right, you need to use integer scaling, which means you usually do not make full use of your screen. But they make the sprites look so good.

Not only that, but you will also get the wrong aspect ratio, since a lot of games are in a non-4:3 resolution that is supposed to be stretched to 4:3 by your TV. It’s a bit surprising that these shaders aren’t more flexible considering pretty much every single SNES game uses a resolution that is supposed to result in non-square pixels, but oh well.

So solution: I’m finding a way to hook up my laptop to a CRT tv. Shaders are such a mixed bag.

Be sure to write about it if you get good results. I haven’t seen any modern PC GPUs that even have the right inputs, so I’d be interested.

Capcom arcade games (CPS1) are a good example of this, especially Strider. In the cutaway scenes the text doesn’t flow onto the screen, it is masked by “black” (greyer than the background) boxes that fly off at the edge.

I remember the MAME team talking about it years ago. The real arcade board does the same, it’s just hardly noticeable on a CRT.