CRT shaders

From Emulation General Wiki
Jump to navigation Jump to search
CRT-Geom-Flat, with default settings

CRT shaders are one of the most popular categories of shaders. While there had been many attempts to include some kind of CRT-esque filters in older emulators - usually involving little more than overlaying dark gray or black lines, colloquially referred to as scanlines, over the image - modern CRT shaders are much more complex and configurable.

Many of these replicate aperture grille CRTs (exemplified primarily by Sony TVs and monitors, though other manufacturers released their own versions of the technology later on), which have sharp images and strong scanlines. If you find that these shaders don't look a damn thing like your old TV, it's probably because you owned a slot mask-style CRT, which typically had less noticeable scanlines, or simply had a smaller set, which tended to be less sharp. The easiest way to tell the difference is to feel the curve of the screen; aperture grilles only curve horizontally if at all. Alternatively, look at the left and right sides of the glass against the frame - if the sides are curved, it's a slot mask; if they're straight, it's an aperture grille. Old TVs usually had slot masks, whereas monitors usually had shadow masks. While slot masks and shadow masks can be emulated to a certain degree even at 1080p, much higher resolutions like 4K or higher are better suited to the task. Aperture grilles are much easier to emulate, and can be satisfactorily replicated at 1080p, though it goes without saying even better results can be achieved with higher resolution.

It is advisable to use integer scaling when using CRT shaders. This means either using windowed mode (x2,x3,x4) or setting an integer scaling option in the video options. The reason is that non-integer scaled scanlines will result in uneven lines with artifacts, though some shaders use oversampling to try to avoid this. If the resulting letterboxing annoys you and you still want to fill up as much of your screen's real estate as possible, you can also try integer scale overscaling, which scales the image up by another integer to fill the vertical image space while still preserving integer scaling, at the expense of some of the image on the top and bottom being cut off. As an example, at 1080p, turning on overscaling would scale a typical SNES game running at 256x224 to 5x scale i.e. 1280x1120, cutting off twenty pixels from both the top and bottom of the image to reach 1080p. Before you fret, know that at 1080p and 4K the loss from overscaling is usually negligible and well within the area that would've been expected to be cut off on a real CRT anyway due to overscan, and developers almost always took this into account and made sure not to put any crucial game information there, so on many if not most older games, overscaling is completely safe.

Download[edit]

All official releases of RetroArch come bundled with a full set of slang and GLSL shaders, including CRT shaders, pulled from their shader repositories on Github, which are regularly maintained and updated. The simplest way to keep up to date with shader development is through RetroArch's built-in updater, though if you are only interested in the CRT shaders, you can alternatively grab them from the following repos:

slang shaders - For use with devices that support Vulkan, OpenGL 3.x, GLES3, and/or D3D10/11/12. This is the most current, regularly maintained repository.

GLSL shaders - For use with devices that only support up to OpenGL 2.x or GLES2. Largely deprecated, though still sporadically maintained.

Cg shaders - For use on platforms that only support Cg or HLSL runtimes, such as the PS3. Deprecated.

Types[edit]

CRT-Geom[edit]

CRT-Geom-Flat, with default settings
Main article: CRT Geom

A very versatile and modifiable shader that simulates an aperture grille display (with the mask enabled). One of the first popular CRT shaders. The deluxe version adds more features, including more mask types. Visit the main article for more details.







CRT-Caligari[edit]

CRT-Caligari, with default settings at 1080p (view original for full details)

An older CRT shader similar to CRT-Geom that uses different methods to achieve its effects.










CRT-Easymode[edit]

CRT-Easymode, with default settings at 1080p (view original for full details)

A fast, relatively simple CRT shader with easy-to-understand settings. Similar to CRT-Geom in its effects.










CRT-Hyllian[edit]

Aims only for picture quality, so it avoids things that degrade the image just for accuracy. It, however, uses far less power to run than most other CRT shaders, so it is possible to run this on lower end systems.

Recently, after a long period of inactivity, Hyllian has restarted shader development anew, releasing all-new versions of this shader under heavy inspiration from CRT-Guest-Advanced and others. They can be acquired at his thread on the libretro forums, linked above.



CRT-Lottes[edit]

CRT-Lottes-Multipass, with default settings at 1080p (view original for full details)

A newer CRT shader that uses a horizontal shadow mask pattern with blooming. The horizontal pattern works quite well at 1080p, though it isn't entirely accurate to a true vertical slot mask pattern. The multipass version adds scanline bloom and a few other features.








GTU[edit]

GTU, with default settings at 1080p (view original for full details)

A CRT shader that focuses more on simulating blur and blending effects and color levels of CRT screens rather than the physical attributes like phosphors and curvature. Highly configurable, can be really sharp, or really blurry or anywhere in between, with optional scanlines and contrast and gamma settings. Settings are stored in a separate "config.h" file for easy editing. GTU-Famicom is a variant that takes an image from an NES with "raw" colors and processes it to output an NTSC image much like an actual NES PPU.

The test program is a program that can adjust various attributes, such as horizontal and vertical blur, scanlines, etc. It is useful for testing settings to use with the shader, and also to understand how CRT shaders work in general.





ZFast_CRT[edit]

ZFast_CRT, with aperture grille mask enabled at 1080p (view original for full details)

An extremely fast CRT shader made to run at full speed on extremely low-end hardware like the Raspberri Pi 3. Probably the fastest shader on this list.










CRT-Royale[edit]

Main article: CRT-Royale
CRT-Royale, with default settings at 1080p (view original for full details)

A highly advanced multi-pass CRT shader that simulates almost every aspect of the CRT screen. There are tons of parameters to configure, such as phosphor type (aperture grille, slot mask, and EDP shadow mask) and size (i.e. dot pitch), convergence offsets, scanline blooming and many others. Higher resolution is better for this shader, especially with EDP shadow mask phosphor layout and with smaller phosphor dot pitch values. This shader is really complicated compared to most other CRT shaders, reading the README and the documentation in the user-settings.h is a must.

CRT-Royale-Kurozumi is a preconfigured CRT-Royale made to look like a professional CRT monitor, specifically Sony's PVM/BVM line of monitors.







CRT-Guest-Advanced[edit]

CRT-Guest-Dr-Venom, with default settings at 1080p. The newer Advanced shader's default settings look identical (view original for full details)

This is quite possibly the most advanced, feature-rich CRT shader of all. It has just as many if not more parameters to configure than CRT-Royale while being more optimized, and if greater speed is desired, there are several faster versions available, as well as variants that add other neat features such as NTSC emulation and better support for games that render at 480p or higher. It is also still in active development and continues to regularly gain features and optimizations. Take heed, however: while it is hosted on the RetroArch shader repositories, it is only updated in that platform when Guest himself deems it ready. Much more regular WIP releases are made in the libretro forums in the shader's dedicated thread, linked above. The version in the RetroArch repo is currently up-to-date, but it might not hurt to check on Guest's thread for newer developments.

CRT-Guest-Dr-Venom is the precursor to CRT-Guest-Advanced. While it is now considered outdated and not as feature-filled as Guest's newest shaders, it is much faster, more so than even the fastest Advanced preset, and it still has plenty of things to tweak to deliver a pleasing image. It therefore fills a middle-of-the-road niche among CRT shaders, delivering a nice balance of features and performance. However, it has recently been removed from the slang shader repository, though it is still available as a glsl shader, and the slang version can still be acquired in the first post of Guest's thread.




Sony Megatron[edit]

Sony Megatron, using the reference preset in SDR mode with the "1000 TVL" aperture grille mask (view original for full details)

This shader is quite unique among CRT shaders, and shaders in general. It is currently the only shader that takes advantage of HDR support for greater color depth and brightness, allowing for highly accurate CRT emulation on HDR-capable displays, though it is also usable on regular SDR displays through a parameter change. Unlike other CRT shaders, its inner workings are actually fairly simple and it doesn't have many bells and whistles, focusing mainly on drawing scanlines and accurate phosphor masks as well as color correction, which coincidentally also makes it one of the fastest shaders featured on this page. As it is primarily meant for use on bright HDR-capable displays, it draws phosphor masks at full strength with no attempt at mitigating the resulting loss in brightness through parameters such as bloom, glow or mask strength typically seen in other CRT shaders, instead counting on the display to make up for it. On an SDR display, it is highly recommended to use it with the backlight turned up all the way, as otherwise the image will likely be too dim to view comfortably. There are presets emulating various CRT models and types, including several PVM models, certain arcade displays, and even PC monitors.

Future[edit]

Phosphor Mask Emulation[edit]

At the frontier of CRT shader development has been phosphor mask emulation. As stated previously, there are three overarching mask types: aperture grilles, shadow masks and slot masks. Aperture grilles were used primarily by Sony TVs, professional displays and PC monitors (with a few other brands such as Mitsubishi releasing their own version after Sony's Trinitron patent expired in the late 90's), shadow masks by the majority of PC CRT monitors from the late 80's onwards, and slot masks by just about every non-Sony consumer-level CRT TV, the vast majority of arcade monitors, and very early home computer/PC monitors. A key part of CRT emulation, then, depends on accurately replicating the look of these masks.

However, even within each of these mask types, there is a lot of variance, as some CRTs were much sharper and were able to resolve a lot more detail than others. This is encapsulated in a specification known as TVL, or television lines, defined as the number of vertical white lines a mask can resolve along the horizontal dimension in a stretch equal to the height of the tube's viewable area (this means TVL is calculated by measuring the screen's height, then counting the number of resolved lines across a horizontal span equal to that height, not across the entire length of the screen). A higher TVL count is the result of higher phosphor density and results in a sharper, more detailed image, as well as more prominent scanlines in low-res content. Most consumer-level CRTs had a relatively low TVL count, whereas professional monitors such as Sony's PVM and BVM series had much higher TVL. In PC monitors, the usual specification to determine sharpness was instead dot pitch, or the distance between two phosphors of the same color. The lower the dot pitch, the sharper the monitor and the more detail it could resolve.

Taking into account the three mask types and the variance in TVL and dot pitch, then, along with many other variables, it is no wonder no two CRTs looked alike.

External Links[edit]