Please show off what crt shaders can do!

You mean moiree? I knew it was done before so I searched for ewa and there’s an ewa curvature shader in the anti-aliasing folder.

I was able to remove the moire when using curvature with the guest-dr-venom shader by just using lower curvature values, which I find more accurate anyway. Like 1 or 2 for x/y; anything higher just looks exaggerated anyway IMO. EDIT: nevermind, lol! The moire is still there, just less noticeable. Curvature always results in some moire or noise no matter what.

I wasn’t referring to moire with my last comment; my thoughts are kinda jumping around all over the place today, lol. I was just referring to what happens with vertical black lines using different filtering methods. On an actual CRT, black lines remain sharp even on an early 1980s TV using composite video. With shaders, you have a choice: either apply a gaussian blur to the entire image, which replicates phosphor bleed behavior pretty well but turns black lines into a blurry mess; or, use one of the “fixed” filtering methods, which can keep black lines sharp but which lack versatility and have the tendency to drain the life out of highlights as well as making white lines too skinny, and can have other negative effects (ringing).

My idea is to just use a gaussian blur but add some sort of detection method that looks for vertical black lines and either greatly reduces the blur when a vertical black line is detected or reverses the blur behavior by blending the dark parts into the adjacent light parts when a vertical black line is detected. My technical knowledge is lacking so I don’t know if this would work the way I think it would or if it’s even feasible.

1 Like

I’d imagine it’s something possible as we have a dithering shader for genesis stripe dithering. The biggest hurdle imo, is false positive detection and someone actually coding it, lol.

I know of anti-ringing methods but to be honest I don’t know much about scanlines and such, I mostly work with colors.

Just to clarify the problem that I’m describing:

This is with guest-dr-venom using some custom settings and horizontal sharpness at 3.00. Highlights look good and pixels blend in a way that is accurate to the way phosphor bleed on a CRT worked (light colors bleed into dark colors). The problem is that black lines are a blurry mess and not at all as sharp as they would be on a CRT.

This is GTU with the defaults. Black lines are nice and sharp but the highlights just look bizzare; it’s especially noticeable with the text, the white around Link’s shield and the heart icons. It’s… pretty bad.

TVout-tweaks does something similar IIRC. Then you have the ones with fixed algorithms like Hyllian and Geom which can keep black lines sharp while adding a nice blur to the rest of the image, but they lack versatility and can introduce ringing artifacts. Hyllian does a nice job of removing the ringing with the anti-ringing filter, while Geom really needs the phosphor mask and scanlines to try to cover up the ringing. Both of them can only be adjusted in large increments due to the nature of the algorithms, so they have less flexibility than a gaussian blur.

@Syh

The vertical line detection part is some fairly easy logic so it shouldn’t be too hard for someone who knows code. I think false positives would be very rare depending on the logic used. It might even be necessary to do this every time there’s a black pixel that isn’t part of a large area of black (instead of looking for lines). But yeah I have no idea how to code it :stuck_out_tongue:

1 Like

My false positive comments were directly related to how dedithering shaders tend to produce false positives.

Yeah, I imagine it wouldn’t be too complicated for someone that actually knew what they were doing.

@guest.r can I cry about it? :stuck_out_tongue_closed_eyes::joy: I love your sharpness setup for guest-dr-venom, but have the same issue with black vertical lines getting destroyed.

1 Like

lol, I already cried to him about it. :laughing:

It wouldn’t work with guest-dr-venom’s “substractive sharpness” which, in certain combinations, can produce results similar to Hyllian or Geom but which also has the problem of ringing in some situations (which I guess can then be covered up to a certain extent with a mask).

2 Likes

I think detection/heuristic stuff generally looks bad with this sort of thing because there will always be a cutoff/threshold where things look weird the closer they are to it.

However, I think what you’re describing is the effect of doing blurring in linear gamma, which compresses dark values, vs on the gamma curve, which accentuates darker values. We usually do the former in CRT shaders because it’s more mathematically correct and just plain looks better, while GTU does the latter (not really sure why, other than the fact that it relies on YIQ<->RGB transformations and I can’t find any sRGB<->YIQ transformation matrices online). You can easily get a feel for the difference by commenting/uncommenting the #define LINEARIZE option in crt-geom.

Something we don’t normally do, though, is do some blurring in linear and some in curved gamma, which may achieve what you want.

Here’s a simple 3x3 blur in the 240p test suite’s sharpness test using linear gamma vs curved (notice what it does to the thickness of the lines):

Now here’s another comparison with only one direction (horizontal or vertical) in linear and the other in curved gamma:

Now, here are those same comparisons in LttP (with a mask effect on top, since that’s how we usually look at these things here):

5 Likes

So a potential fix for the issue with guest-dr-venom, would be to do the horizontal sharpness in curved gamma instead of linear gamma? (But it wouldn’t look nice.)

Am I following your post correctly?

The sharpness effect isn’t produced by the neighbour pixels, but by the neighbour’s neighbour pixels.

Something in the way: sharp, smooth, smooth, sharp

Ofc. if a combination pops up: …black, white, black, white… not enough ‘color’ will be substracted, which results in a fuzzier effect. For example 1.2a - 0.2a = a. 1.2b - 0.2a is something different.

The representation might not be entirely accurate, but it’s explaining what’s going on with the kernel.

It’s not getting better with any bell type filtering curve which reaches negative values on the edges, but it’s still a nice and established way to blend pixels.

Gamma is definitely a factor, that’s why it can be altered too.

5 Likes

Ehh, I’m happy enough with it as is then, lol. (As the black vertical lines is my only issue with sharpness code, I can accept this trade-off for all of the other benefits.)

1 Like

Hi @dogway, I’m trying to get this to work, I got a new copy of your repo, it is looking for shaders/shaders_slang/crt/shaders/crt-royale_braun…

Is this a package from @ProfessorBraun?

Am I supposed to copy Royale to crt-royale_braun and then copy your textures on top?

1 Like

Awesome reply, thanks! Very informative. Unfortunately, just doing the blur in linear gamma on the vertical axis and curved gamma blur on the horizontal looks pretty strange, too. Oh well, at least I learned a thing or two!

Would it still look weird if we applied linear gamma blur ONLY when there’s a black pixel and ONLY blur horizontally? At all other times use curved gamma blur.

I think it would actually be easier than what I initially described:

Is this a black pixel? If yes, apply linear gamma blur horizontally. If no, use curved gamma blur.

No line detection stuff required.

Seems like it should work…

2 Likes

Yes, it’s based on hims but I reverted many things like almost the whole “user-settings.h” file and edited the slotmask image (spent just near an hour looking for his OP, here it is January this same thread)

The only thing you need to copy over is the files from crt-royale/src, then put crt-royale_braun into the crt folder. I noticed the preset (.slangp) is referencing back because I put my presets into “shaders/presets/core_name”. Should I just reference forward to “crt-royale_braun/…”?

1 Like

Thanks, Yeah actually I think this might solve the problem to have the stuff you are referencing be inside your package , knowing where the preset is expected to be and what dependencies like professorbraun’s package is helpful if everything is not self contained.

1 Like

If you need more precise control over those adjustments, you can modify the shader yourself, it’s fairly simple. Open the glsl/slang file with a text editor, find the pragma parameters and you see those numerical values on the right? They are (from left to right): default, min, max, increments.

And also here’s my new preset for 240p content, which I find super-CRT-ey :smiley:

7 Likes

What shaders are you using,? Just curious.

The usual suspects: easymode halation, ia, color mangler. That’s all. It gives me the EXACT look that I have been after from the beginning. Tried millions of things lately, found several sweet spots.

2 Likes

Unfortunately this doesn’t work with these algorithms :frowning:

You can see what I mean if you edit the increment for crt-geom. You get some really wacky results with non-integer values.

Edit: Also, I just kinda prefer how gaussian blur looks. It’s just that it doesn’t handle black lines very well at all.

1 Like

Can you share your preset? For not being a super high resolution the slot mask looks really good. Those scan lines look like a square wave being examined on a oscilloscope which is exactly how they are on my CRT.

2 Likes