Scanline-less CRT shader

I’ve been using CRT-Geom for a while now, but as time goes on, I have found myself modifying it more and more, removing things I have concluded to be superfluous to the quality of the image, such as curvature, halation, and phosphor emulation, and even making the scanlines bloom more to make the black lines look less dark and obvious. I have also made it less blurry. This is what my current implementation looks like:

Here’s the code if anyone’s curious:

http://pastebin.com/sSWEgRic

However, now I’m beginning to think even the scanlines themselves may be superfluous as well. They aren’t really what makes the picture look so good to me, but rather the scaling algorithm and slight blur. So I’ve been wondering if there’s any way to have just whatever CRT-Geom does to scale the image, but without the lines.

And before you ask, yes, I have tried a bunch of shaders. None really do what I want. Bilinear is too simple yet too blurry at once, bicubic just looks bad, and GTU doesn’t let you tone down the vertical blur without adding scanlines, and it’s just too blurry overall. CRT-Geom just does it in a way that softens the image, yet still looks good. I also like the blooming around bright colors and such.

Any ideas on how one could make this happen? Is it even possible?

I think the scanlines give the illusion of a higher resolution than it really is. If you take it out, the jaggies will turn more apparent and the image will look more like nearest neighbor.

Yeah, I think it uses Lanczos scaling, which is a bit sharper than bilinear, so you might try using it on its own. You might also try quilez, which is similar.

Ah, the problem with those is that they don’t have that blooming that CRT-Geom has that makes bright pixels “pop”, which is something I would like to keep. Also, despite using Lanczos, I think CRT-Geom also does other things to keep the “ringing” to a minimum. On standalone Lanczos, it’s really noticeable.

Anyway, I tried a whole slew of things, to no avail. Guess it’s just a pipe dream for now. I did, however, manage to get that very slight pixel blur effect I was looking for some time back. Turns out all you gotta do is multiply the texture size by two on both axes. It was under my nose the entire time. Looks very nice, and takes care of aspect correction errors and such.

I’d say it’s better suited for DOS games, though, since those were meant to look pixellated.

Be sure to give this version a name.

Say, hunterk, is there a way to separate the gaussian blur passes from your PhosphorLUT shader so they constitute a simple gaussian blur shader?

@GPDP yeah, most definitely. In fact, I made this the other day: http://www.mediafire.com/download/5vbfp2bajs0hunb/halation.zip

It’s just a passthrough shader, 2 gaussian passes and a last pass combining them together. It’s the same idea as the halation from cgwg’s CRT shader, but it’ll work with any shader (just replace the stock.cg shader and update the cgp to match). It looks nice with xBR :slight_smile:

Is this a mistake? I saw this line in the vertical gaussian pass:

float oney = 1.0 / IN.texture_size.x;

Shouldn’t it be like this?

float oney = 1.0 / IN.texture_size.y;

Same thing with the horizontal pass, but backwards. I changed them, and the halation now looks even.

Anyway, this is neat, though I suppose it’s not quite what I’m looking for. I am still (perhaps foolishly) seeking out a way to get that special kind of blur CRT-Geom does, minus the scanlines. Here’s another shot that better demonstrates what I am looking for:

Check out the numbers on the HUD, and the dots around the minimap, which constitute single pixels. They look nice and rounded, akin to how they would on a CRT (though of course, not perfectly so), yet not too blurry all at once. That is what I am trying to achieve more or less, but on the entire image. Other blur shaders overdo it, I feel, and some like Quilez don’t go far enough. Lanczos has visible ringing, which is annoying.

I think you can achieve it by tweaking crt-caligari.

Christ, why didn’t I think to try caligari?

Not 100% perfect, but this is the closest by far to what I was trying to achieve. Thank you for the suggestion.

Whoops! You’re right.

You can try some combos with dilation.cg.

For example:

2-pass shader #0: stock.cg filter #0: nearest scale #0: 4x

shader #1: dilation.cg filter #1: linear scale #1: don’t care

or:

2-pass shader #0: crt-caligari.cg filter #0: nearest scale #0: 4x

shader #1: dilation.cg filter #1: linear scale #1: don’t care

What’s the code for caligari with no scanlines?

It’s the same code on repo. You just need to tweak some parameters there like SPOT_WIDTH and SPOT_HEIGHT.