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:


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.


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.


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.


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.


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.


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.


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:



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.


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


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.


Anonymous said...

Another excellent post!

What is interesting is that people started using CRT shaders even for "retro-looking" indie games.

SweetFX + "Shovel Knight" (http://steamcommunity.com/sharedfiles/filedetails/?id=279040845) or "La-Mulana"(http://www.neogaf.com/forum/showpost.php?p=99128324&postcount=151).

Some indie titles have such shaders/filters built-in! For example, "You Have to Win the Game" (http://www.piratehearts.com/blog/2014/03/28/crt-simulation/)

Anonymous said...

Is royale.png using default shader settings?

-- twipley

Anonymous said...

Reading the subtext I'm getting you've modified it a little bit.

Informative blog post, again!

Hunter K. said...

Hmm. I *think* it's default settings, but I may have done some things to it at some point. I'll have to double-check. If it's non-standard, I'll re-post with default settings.

I've used that SweetFX injector before! I like to play Street Fighter 4 with scanlines ;)

Anonymous said...

A couple of CRT Royale settings for recreating specific display types

Trinitron TV

Sony BVM

NewYears1978 said...

Could someone tell me shoudl I use LINEAR/NEAREST and how many passes? I can't seem to get mine to look like the pics exactly.

Hunter K. said...

It depends on which shader you're using. If you have a recent pull from the common-shaders repo, it will have cgp files for each of the shaders and, if you load that instead of the individual shader files, it will choose the correct filtering method (if necessary) and set the correct number of passes.

NewYears1978 said...

Thanks Hunter, also, how do you use these .fs ones with Retroarch they are not the right format?

Sorry for dumb questions, I am new to using shaders.

Hunter K. said...

.fs shaders are for Higan (v095 doesn't have shader support but v096 will) rather than RetroArch. Those shaders are available from my 'quark' shader repo on github. To load those, put the entire folder (which will have a manifest.bml, at least one *.fs and maybe one or more *.vs files inside) into your 'Video Shaders' directory.

I don't think there are any shaders available in quark format that aren't available in some way in Cg format.

Analytics Tracking Footer