Tuesday, April 14, 2015

More CRT Shaders

There have been a number of new CRT shaders written since I last did a big roundup, and some people have asked about it, so here we go! All Cg-format shaders are available in libretro's common-shaders repo on github, while all Quark shaders are available in my github repo. All shots were taken at 4x scale factor, and the closeups are scaled up 400% with nearest-neighbor. Click the thumbnails to embiggen:

CRT-Geom

I've already written about this one at length, but I figured I'd include it here anyway for reference and comparison. It's the original awesome CRT shader written by cgwg with some help from Themaister and DOLLS[!], and it's still a good choice. It has extensive customization available via code modification and/or RetroArch's runtime shader parameters.
 Many users don't care for the curvature effect and turn it off, like this:
This shader is available in Cg and Quark formats.

CRT-Easymode

This one was written by a fellow from the NeoGAF forums who goes by the name Easymode. It is notable for looking nice even at non-integer scale factors and for being very lightweight considering how nice it looks. It's a good one to try on mobile platforms and desktops/laptops with weaker GPUs. It also has some nice runtime parameters for switching between cgwg-style and Lottes-style mask effects.
This shader is available in Cg format only.

CRT-Hyllian

This one is written by Hyllian, who is well-known for his popular upscaling interpolation algorithm known as xBR. It includes some interesting options, such as a "blue boost" that is helpful for making water in many games go from purple to blue.
This shader is available in Cg format only.

CRT-Lottes

This one was written by Timothy Lottes, an engineer at Nvidia who is known for his work creating the FXAA fullscreen antialiasing GPU algorithm. This shader is adapted from the shadertoy he made and was generous enough to release into the public domain. Notably, it uses a sideways shadow mask effect that is designed to avoid chromatic aberration.
 It's easy to flatten this one out, as well, using RetroArch's runtime parameters to set the warpX/warpY values to zero or by commenting line 142 in the Quark shader:
This shader is available in Cg and Quark formats.

PhosphorLUT

This is one I worked on awhile back and it only focuses on doing a phosphor/shadow mask using an external lookup texture (LUT) and a little bit of horizontal blurring.
You can adjust the scale of the phosphor mask with 1.0 looking more like a high-res CRT monitor, while 1.5 and 2.0 look more like an SDTV or CGA monitor. As you adjust the scale, the colors can get wonky, so there are runtime parameters for dialing in the right balance. Here it is at a scale of 1.5:
 There's also a preset for use with 4K displays (not pictured here). This shader is available in Cg and Quark formats.

GTU

I've raved about this shader--which was written by aliaspider--before for its ability to blur out dithering, but it also belongs on any list of good CRT shaders. While it doesn't provide any phosphor/shadow mask effects, it does allow horizontal/vertical bandwidth control (for blending things like pseudo transparency and dithering), scanline effects and NTSC color blending/bleeding.
All of these effects are user-customizeable by editing the code (he put the various options right at the tops of the files for easy access) and, with the NTSC color option disabled, it looks remarkably close to the output of Micomsoft's famed XRGB-Mini Framemeister deinterlacing/upscaling device.

This shader is available in Cg and Quark formats.

CRT-Royale

This shader was written by a guy named TroggleMonkey and it uses some intense, RetroArch-specific black magic to overcome many of the issues with CRT emulation that I thought were unavoidable, particularly using large-scale blurring passes without totally wrecking performance and making a true RGB phosphor / shadow mask that looks good at less than 4K resolution. As I said, it is Cg-only and only works on RetroArch, at that (i.e., no OpenEmu, even though it supports Cg in general).
CRT-Royale has an option (on by default and in these shots) for simulating the characteristic glow of a CRT tube. This is another common goal of CRT shaders, and I've broken those off into their own group:

Glow/Halation

Glow

Written by Themaister, this one eschews phosphor/shadow mask effects and just focuses on using special blurs to accentuate the variable beam width of a CRT (i.e., brighter pixels bleed further into the space between scanlines).
 He also made a variant that tacks on his NTSC-composite shader (looks better in motion):
This shader is available in Cg format only.

CRT-Hyllian-Glow

Just like regular CRT-Hyllian, but with some whole-screen blur/glow.
This shader is available in Cg format only.

CRT-Lottes-Halation

Mr. Lottes made a revision to his scanline shadertoy that added a number of gaussian blur kernels to bloom out bright pixels, which increases the overall brightness of the image without getting the fullscreen haze of some of the other options.
Unfortunately, the limitations of the shadertoy format forced the blurs into a single pass, which is extremely slow. This variant is available in Cg format only.

For anyone who's curious, I took 4K screenshots of most of these, but blogspot down-rezzes them and adds jpeg compression on top of that, so I couldn't post those directly. Instead, here is a download.