Yet, another CRT Shader

Professional RGB monitors are really awfully crisp you know, and a lot of people seem to enjoy it.

That said I like the vertical gaussian better that allows a non integer scaling in CGWG shader: I can see scanlines are less precise but that’s harder to spot than their irregularity on certain part of the picture when I use 3x oversample. I’m using oversample with DeSMume though, it’s more precise for a smaller picture that seems to fit just right for the resizing I’m using.

xbr and similar filters, I can’t use them. Just feel too photoshopish for me. It always depends of what you’re used to; I like the original TV look minus defects such as strong bleeding or bad signal cables.

It seems I wasn’t using gamma code correctly. So, today I fixed it and know what? It turned out that the dilation now is useless! With proper use of gamma, there isn’t need for dilation anymore, so I deleted its code.

I had to change the default configuration to adjust the image. The need for anti-ringin now is low too as for some reason the correct use of gamma minimize some halos. The code for anti-ringing is there yet, but it’s off by default.

It’s now in common-shaders: https://github.com/libretro/common-shaders/blob/master/crt/crt-hyllian.cg

1 Like

Oh nice :smiley:

I, too, try to revisit my old shaders periodically and almost always find something I could do differently, usually for the better.

1 Like

Some more improvements in this shader. New version in common-shaders: https://github.com/libretro/common-shaders/blob/master/crt/crt-hyllian.cg

1 Like

Hyllian is there any chance you could adjust your shader so it works at 720p with even scanlines whilst not needing integer scaling enabled (glsl shader)? This is mainly for Raspberry Pi 2 used, setting the Retroarch rendering res to 1080p is too much for these devices and your shader but setting the res to 720p and it works full speed but has even so slight uneven scanline artifacts

The only way is blurring the output.

Hey Hyllian, just wanted to say that this shader is really great. It’s amazing what you’ve achieved with a single shader pass. I’ve been using this shader exclusively since Hunter’s input latency testing showed that other shaders can cause input lag. At least until further testing is done I think I’ll stick with your shader. I think I’ve managed to get a very “PVM-like” (or at least, generic high quality RGB) output with the following settings:

gamma input 2.2 gamma output 2.4 sharpness 0.0 beam width min 0.5 beam width max 1.0 everything else set to 1.0

using 5x integer scale on the vertical axis and 6x or 5x on the horizontal, depending on the system.

I’ve also adjusted my display’s “backlight” setting to 80% to compensate for the loss of brightness.

I’m not sure what to set gamma input/output to as I’m not sure what input and output is even referring to. I’ve left it at the defaults for now.

“Sharpness” doesn’t seem to do anything; I see no discernible difference between a setting of “0” and “5.” Is this due to the other settings I’m using?

Beam width variability has been hard to pin down, but I think min 50% and max 100% produces a very nice result. If beam min. is set much lower than 50%, the scanlines over dark colors start to look unnaturally thick.

btw, I’m using the regular version of crt-Hyllian, not the one that is part of the Hyllian-glow preset.

Any suggested tweaks? Thanks again!

1 Like

Here is a side by side comparison of CRT-Hyllian with the above settings and the same image on a sony PVM. The uploader of the PVM shot has said that the bloom and moire in the photo were added by the camera. I think the images are amazingly similar. The PVM is sharper, while Hyllian almost has a shadowmask softness to it. It’s possible I still need to do some gamma correction, but I don’t know how I should adjust that.

CRT-Hyllian with above settings (click to enlarge):

Sony PVM:

CRT-Hyllian with above settings (click to enlarge):

Mitsubishi XC-3730C: (scroll down to about mid-page): http://www.neo-geo.com/forums/showthread.php?238415-CRT-Fetish-Thread/page75

The scanlines in CRT-Hyllian aren’t as dark in the second comparison to the Mitsubishi’s, but is still looks amazingly accurate for a single shader pass. In both cases, I actually prefer the image from CRT-Hyllian over the real thing.

1 Like

Do you have any suggestions regarding gamma correction, sharpness or beam variability? I’m trying to get as close to a PVM as possible. What is gamma input/output? I’ve never seen that before, just “gamma.”

I’d like the beam width to be slightly more dynamic but without causing the scanlines over dark areas to become thicker. Is that possible?

I’m also not sure how the sharpness setting is supposed to work. I see no difference between “0” and “5,” but “2” seems sharper.

‘gamma input’ is the display’s actual gamma (that is, set it to whatever your monitor’s gamma is set to, probably ~2.2) and ‘gamma output’ is the corrected gamma that the shader puts out. CRTs had a gamma of 2.4-5.

Hi, Nesguy,

I’m glad you like it. Anyway, you should try other crt shaders available too, because they offer many different features that could be worth a try and are more accurate too.

Sharpness will only make a difference when you uncomment another param:

// Uncomment to increase the sharpness of the scanlines. //#define SHARPER

This is a hack and you won’t like the result (I think).

I wouln’t change the gamma settings, as it is already optimized. It changes the way colors are presented in your display (probably a flat one) to appear almost exactly as the colors in a CRT TV.

I don’t have a PVM to know how the params should be, so I can’t help you in this regard. And the level of dynamics you need for the beam I can’t provide more than this. I think it would only be possible with a bigger resolution. This shader is more of a crt simulator than an emulator.

[QUOTE=Hyllian;28732]Hi, Nesguy,

I’m glad you like it. Anyway, you should try other crt shaders available too, because they offer many different features that could be worth a try and are more accurate too.[/quote]

The only other aspect of CRTs that I’m interested in replicating is the shadowmask or aperture grill. I’m also concerned about input lag, though. I don’t know if there are any shaders that can do an acceptable aperture grill simulation at 1080p (pretty sure shadowmask will require 4k to look acceptable) without resulting in additional input latency. More testing is probably needed before we can make any definitive conclusions. Do you have any recommendations for a lightweight shader that does an aperture grill simulation?

This is a hack and you won’t like the result (I think).

Just tried it - you’re right, definitely prefer it without the hack.

I wouln’t change the gamma settings, as it is already optimized.

Ah, thanks. How does this fit with what Hunter said about gamma? By default, the shader has input at 2.4 and output at 2.2, but Hunter’s suggestions would result in those values being flipped; output at 2.4 and input at 2.2.

the level of dynamics you need for the beam I can’t provide more than this. I think it would only be possible with a bigger resolution.

That’s what I had assumed. I’m still toying with this param, can’t decide whether min/max of 40/100 or 30/90 looks better, but I’m leaning toward 30/90. I’m trying to get the scanline variability to match what you would see on a high end CRT with accurate white and black levels. I’m using the scene from FFVI, which is a particularly tricky scene given the shadow details.

[QUOTE=Nesguy;28737]Do you have any recommendations for a lightweight shader that does an aperture grill simulation?

Ah, thanks. How does this fit with what Hunter said about gamma? By default, the shader has input at 2.4 and output at 2.2, but Hunter’s suggestions would result in those values being flipped; output at 2.4 and input at 2.2.

That’s what I had assumed. I’m still toying with this param, can’t decide whether min/max of 40/100 or 30/90 looks better, but I’m leaning toward 30/90. I’m trying to get the scanline variability to match what you would see on a high end CRT with accurate white and black levels. I’m using the scene from FFVI, which is a particularly tricky scene given the shadow details.[/QUOTE]

There isn’t a lightweight that I know. All good alternatives are slower.

Probably hunter has swapped the gammas. The correct input is 2.4 and the output is 2.2. If you try the other way around, the result will be terrible.

Yeah, I was just basing it on what you had in your earlier post. Hyllian’s defaults are good, and he’s right that swapping them would look very bad.

Easymode’s recent updates to his crt shader look great and it’s still quite lightweight (either the regular or halation version; both are nice).

Okay, I played around some more and found that the crt-hyllian shader that is part of the hyllian-glow preset is actually slightly different from the one found in the main CRT directory. This one does a better job of dealing with some artifacts I was noticing in the previous shot, particularly in the shadows around the window edges.

After checking some more sources and testing more games, I’ve increased the minimum beam width to 70, and left max at 100. I also turned up the color boost to 1.2.

Here is the revised shot. I think this is looking a bit better. Thoughts? Still not totally sure about color boost, red boost, and green boost. I definitely need to adjust those, but I don’t even know where to begin. Getting color right is hard.

Looks good to me. Compared with that photo from a pvm, the castle bricks still look a little red, so you may want to give it more blue/green to compensate.

I’m inclined to think that the PVM shot is a little off due to the camera being used. I haven’t been able to get rid of the red without making the rest of the screen look too blue.

After doing a lot more tweaking with my eyes inches from the screen and obsessively comparing results with shots of PVMs and BVMs, I think my original setting of 50/100 for beam min/max is the correct setting to replicate the beam dynamics of a BVM or high-resolution PVM. I’ll post some comparison shots later when I get chance.

Really, the only thing I needed to change from my original shot was use the version of CRT-Hyllian that comes with the glow preset, instead of the one in the main CRT shader directory. This one does a better job of handling artifacts present in my original shot.

I have everything else set to 1.0 except for gamma and sharpness which are left at defaults. I have raised color boost just slightly to 1.10. This may look too dim on a properly calibrated display, but as I mentioned, I have my backlight set quite high when playing video games- almost twice as high as the calibrated value. I find that setting color boost higher than this just causes everything to be oversaturated and blown out. The correct color boost is probably something that is going to differ depending on the display being used. I just eyeballed it and set it to a point just barely high enough so that the colors didn’t look washed-out.

So, I think I’ve found the right settings for CRT-Hyllian to replicate a high end CRT. Now that I’ve found something satisfactory, it’s time to start playing around with CRT-Easymode :slight_smile:

Here are some shots demonstrating that 50/100 is the correct setting for beam min/max if trying to replicate the beam width variability of a BVM or high resolution PVM.

For all images, you have to click on the image and then click the “zoom” button on the new page to view them properly. Also, ignore the garbage at the top/bottom of the screen - that’s the result of using 5x integer scale and it gets cropped off while playing.

First up, we have Ducktales on a PVM:

Notice how thin those lines in the background are - they are less than half of the width of the black gaps between.

Now, let’s look at the same thing running on Retroarch with the CRT-Hyllian shader applied, beam width set to 50/100:

Viewed at a normal distance, the visible lines of the background appear to be half as thick as the gaps between, or the same as the shot of the PVM.

If we raise the beam width to 60/100, the visible lines of the background appear too thick compared to the PVM:

As you can see, the visible lines appear to be just slightly more than half of the width of the gaps.

Now let’s check out Symphony of the Night on a BVM:

Notice the visible lines making up Alucard’s cape are less than the width of the gaps between those lines. The same is true for the bricks making up the background and the blocks making up the floor. As in the Ducktales shot, the thinnest visible lines are less than half of the width of the gaps between them.

Here is the same shot at beam width of 50/100 in Retroarch:

And the same shot again, with a beam width of 60/100:

Notice how it’s now no longer clear at first glance if the visible lines of either the bricks in the background or the blocks making up the floor are thinner than the gaps between them. In fact, the visible lines appear to be about equal with the gaps in some areas, which is not what we see in the photo of the BVM.

I’ve also got some shots of Castlevania III and Super Mario World which I’ll post later when I get a chance. The difference between a beam minimum of 50 compared to 60 is so slight, that it’s probably better to say that a beam minimum of anywhere between 50-60% is correct, with a maximum of 100. 50% in some cases may look a little too sharp; while 60% in some cases might not look quite defined enough.

Guys, this shader is starting to be pretty amazing. I´m using the settings you provided, and the results are really impressive. My favourite shader right now, as for whatever reason i never get good results with the diferent varieties of crt royale. Nice work!

Yeah, it is pretty sweet, I think it’s a toss-up between this and CRT-Easymode for me, but they do different things. I don’t think I mentioned this, but sharpness should actually be left at the default of 2.0. So the settings for the above shots are:

Sharpness: 2.0 Gamma input/output: leave at defaults Beam width minimum: anywhere between 0.50 and 0.60 Beam width max: 1.0 Color boost: 1.30 (this probably varies depending on the display being used) Everything else: 1.00

I need to adjust my display’s backlight setting (NOT brightness) to 100% for the display to be bright enough with the above settings.

Oh, and I’m using the version located in /shader/CRT/Hyllian-glow/