Yet, another CRT Shader

See if this fix your problem.

And see what Tatsuya said about using Nearest instead Linear in all places.

Thank you, I had to set it to Nearest, I still not quite understand why some filter need linear and other nearest. I understand interpolation algos, bicubic, spline, lanczos, etc but not what is used for on shaders.

I set a folder with my working shaders, so I can simply cycle them with M and N, but the shortcuts browse inside subfolders too (I mix cg and cgp shaders on parent folder).

I’ve found a major bug in this shader for ATI cards.

Later I discovered this bug is spread in many other Retroarch shaders I have been working for the last two or three years. It only manifests in specific resolutions of some games, that’s why it was so hard to realize it.

I have isolated it in the first screen that appears in the Snes game of Judge Dread. xBR is one of the shaders ‘infected’, look how it appears in this screen:

http://postimg.org/image/d78khgow9/

To reproduce it, use Integer Scaling and 5x5 with custom aspect ratio.

I have to do a big fix in many shaders of the Retroarch repository, but first I need to know the complete list of infected shaders. I have a workaround already.

This bug manifests in other emulators too, like Snes9x, when using these shaders in ATI cards.

Yeah the shortcuts read cg as well as cgp. But you can organize your files with numbers like “01-crt.cg”, “02-lcd.cg” etc to achieve what suits you better.

@Hyllian: Sorry I can’t help, I’m on nvidia.

Ok, just pushed the fix for many shaders (63) in the repo.

And, the last crt v5 with that fix is here: http://pastebin.com/sN32dWiD

I observed that it cycles from the shaders default path, not the loaded shader path, so I had to change the default path to my “favourites” shader folder.

V6 here: http://pastebin.com/HdbbFf8f

I wasn’t varying the beam width per color channel. Now it does! And the colors are better!

Thanks, when cycling the shaders look wrong because the default scaling algo is linear, is there a way to embed scaling method in the shader?

No. I think this question must be done to the retroarch authors. The linear filter isn’t useful for my shader.

Tweaked a bit more the params.

V6b: http://pastebin.com/FnS31ve7

Shots off screen from my plasma TV. The colors are a bit spread by my celular camera:

Nice, a bit over-saturated though. A 1.8 for color saturation seems more natural. I still love the interpolation in gamma CGWG shader does, quite visible in Mario World (like on those comparison images here).

But I think your shader manages to stay quite crisp (unlike a bilinear filter) while avoiding the slight edges artefacts a lanczo filter does (like in CGWG).

…you’re 1 pixel on the right now! =D

The saturation was necessary to keep an overal “normal” brightness and compensate the big varying beam width Im using. Needs some more tricks.

About the pixel to the right, yeah, I’m aware of that. I’m thinking about an easy way to fix that yet.

Looking pretty good :stuck_out_tongue:

Ok, found an easy way to fix it in vertex, yeah!

Here’s V6c: http://pastebin.com/Uy1dZhsG

change: fix display position.

Nice! Good work. :slight_smile:

V7: http://pastebin.com/zYt3H3gk

Changes: created a param to boost blue tint.

Now, the water in Secret of Mana is blue (as in my CRT TV):

Most CRT TVs have this blue tint that give a cool tint to the image.

If you don’t wanna this effect, just use 1.0 for the parameter inside the shader.

Some SOTN shots using V7:

http://i.imgur.com/oInyLap.png

http://i.imgur.com/w5raxuR.png

http://i.imgur.com/7eH89oR.png

http://i.imgur.com/6mHTBzU.png

https://i.imgur.com/i5RSdf3.png

http://i.imgur.com/HXAyuVW.png

http://i.imgur.com/zFxtw47.png

It’s actually great. This is the shader I’m gonna use with snes probably since for some reason all the other (halation and geom flat) give me issues on this core. Do you know hot to make scanlines fainter? I think if you add scanline jitter maybe they wouldn’t look too strong. These are the settings I use:

#define SCANLINES_MIN_WIDTH 0.1 #define SCANLINES_MAX_WIDTH 0.5 #define COLOR_BOOST 1.4 #define BEAM_WIDTH_SENSITIVITY 0.3 #define CRT_TV_BLUE_TINT 1.05 #define OutputGamma 3.0

Increase this parameter:

#define SCANLINES_MAX_WIDTH 0.5

(I thought about scanlines as the beam itself when creating this param. Maybe I should rename it to BEAM_MAX_WIDTH.)

Ok, now I understand what Dogway was asking. I’ve changed some parameter names from SCANLINES to BEAM and added a new parameter to control scanlines strength.

The V7b is here: http://pastebin.com/rNSpfVDM

The new controle params are these:

// Control scanlines transparency by changing this param below. Use always values between 0.0 and 1.0.
#define SCANLINES_STRENGTH 1.0

// Control the beam width range by changing these two params below. Use always values between 0.0 and 1.0.
#define BEAM_MIN_WIDTH 0.1
#define BEAM_MAX_WIDTH 0.7

// You can saturate colors using this parameter.
#define COLOR_BOOST 2.0

// This param change the threshold from where the beam gets thicker.
#define BEAM_WIDTH_SENSITIVITY 0.5

// Cool tint. Controls the blue level. CRT TVs from the 90's had a blue tint.
// To turn OFF this effect, use 1.0 value.
#define CRT_TV_BLUE_TINT 1.15

Using a more eye-firendly profile, some shots of DKC:

SCANLINES_STRENGTH 0.6 COLOR_BOOST 1.6 CRT_TV_BLUE_TINT 1.0

http://s3.postimg.org/3o68luqhf/don1.jpg http://s3.postimg.org/3znoym6xf/don2.jpg http://s3.postimg.org/atxzoazkj/don5.jpg http://s3.postimg.org/5h95a6bo3/don6.jpg