Shaders and filters
Shaders and filters can be applied to video games to enhance visuals or achieve some kind of visual effect. These can be from attempting to replicate aperture grille displays, NTSC signals, or something more exotic.
Contents
Emulator support[edit]
Name | Shader file types | Notes |
---|---|---|
RetroArch | .cg, .cgp, .glsl, .glslp, .slang, .slangp, .dll/.so |
Old bsnes XML shaders (.shader) and old bsnes filter plugins (.filter) are no longer usable in current versions of RetroArch. SoftFilters are dynamic libraries, the extension depends on the platform. .cgp stacks several .cg files on top of one another. Same thing with .glslp and .slangp. |
DOSBox | .fx | Only on special builds such as SVN Daum. |
higan | .filter, .shader, folders |
.shader removed in future higan releases in favor of Quark shader folders. .filter works in old bsnes versions (circa v082) but not current in current versions of higan. |
HqMAME | .fx | xBRZ and HQx |
OpenEmu | .cg, | slangp support coming soon with a new Metal rendering engine |
Snes9x | .cg, .shader | |
Project64 | .fx | Only with a custom Rice Video plugin. |
PCSX-Reloaded | .slv/.slf, .vp/.fp | Requires Pete's OpenGL2 or gpuBladeSoft. |
ePSXe | .slv/.slf, .vp/.fp | Requires Pete's OpenGL2 or gpuBladeSoft. |
DuckStation | .glsl, .fx | |
PCSX2 | .fx | Must be named shader.fx and be in the main directory. PageUp to activate. |
Dolphin | .txt, .glsl | Can only be used with OpenGL backend. |
Mobile | .glsl | GLSL is the shader language used by default on mobile (Android/iOS/Blackberry). |
Mobile | .glslp | GLSL equiv. of cgp - possible to stack several shaders with this. |
- Before diving in;
- Some of the shaders and filters listed below are already included in the chain for some of the Shader Presets or present as an enhancement/adjustment option (such as digital vibrance) from GPU driver control panel or from your digital display OSD. Some of those things may cause color clipping, exposure issues (due to using excessive digital adjustments to image) and Input lag. It's recommended to avoid usage of color or excessive image options/filters. But you can use analog device/CRT's OSD adjustments. Another proper option for this using the RTX Dynamic Vibrance option (see #AI-powered filters) to avoid color crashing and top of that using a HDR device with Inverse tone mapping.
Types[edit]
CRT Shaders[edit]
- Main article: CRT Shaders
Many of these shaders replicate aperture grille CRTs, which tend to have sharp images and strong scanlines. Only a few replicate shadow mask CRTs, often requiring much higher resolutions to display the mask without aliasing.
NTSC Filters[edit]
- Main article: NTSC Filters
These software filters replicate the signals that consoles output to the TV. They vary in quality, with the lowest quality being RF, then composite, then S-Video, and then RGB (SCART) being the highest quality. Many emulators have blargg's NTSC filter libraries[1] built into them. They can also be separately downloaded in filter plugin format.
Handhelds[edit]
These shaders replicate the visuals of the Dot matrix and LCD displays of older handhelds and their specific artifacts in comparison to newer screens.
For LCDs these replicate the look of a low-resolution LCD common on handhelds. These can range from a simple grid drawn around the pixels to a detailed recreation of each pixel's RGB subpixels. May also include motion blurring to simulate ghosting and washed out color gamuts.
Smoothing shaders[edit]
These shaders, such as 2xSai, Super Eagle, Super 2xSai, scaleX, HQx, xBR and xBRZ attempt to reduce the pixelation by smoothing and rounding. They can cause a lot of false positives and distortions, however, scaling the image 2x or 3x using nearest neighbor, then applying the smoothing shader will reduce the intensity of the smoothing by keeping the pixel shapes intact, eliminating most distortions while keeping a fairly smooth look.
Lanczos[edit]
lanczos4.cg, lanczos6.cg, laczos12.cg, laczos16.cg
Bicubic[edit]
Enlarges images by calculating the colour values of new pixels based on a weighted average of neighbouring pixels in the original image. Popular for its ability to produce smooth, high-quality results when resizing images, especially when significant upscaling is required.
Name | Image |
Description |
---|---|---|
bicubic-fast.cg | ||
bicubic-normal.cg | ||
bicubic-sharp.cg | ||
bicubic-sharper.cg |
DDT[edit]
Data-Dependent Triangulation Shaders look at the square plane formed by the four nearest neighbours (a basic image resizing technique that assigns each pixel in the resized image the colour value of the nearest pixel in the original image). They divide the square plane into two triangular planes. The pixels are bilinearly interpolated using only the three points of the triangles to which they belong.
Hqx[edit]
("hq" stands for "high quality" and "x" for magnification) is a pixel art scaling algorithm developed by Maxim Stepin and used in emulators such as Nestopia, bsnes, ZSNES, Snes9x, FCE Ultra and many more. There are 3 hqx filters: hq2x, hq3x and hq4x, which scale by a factor of 2, 3 and 4 respectively.
Eagle[edit]
Dithering[edit]
- Main article: Dithering#Shaders
A technique used to increase the amount of colour and shading that can be produced on a system. The effect is achieved by using lines or dots which are then blurred by the low quality NTSC signals (composite or RF) used by the system.
Anti-aliasing[edit]
A graphics rendering technique used to reduce or eliminate jagged or stepped edges (aliasing artefacts). It works by applying various methods such as super-sampling, multi-sampling, or post-processing filters to improve the smoothness and visual quality of the image, particularly when displaying diagonal lines, curves, or fine details.
Pixellate[edit]
This shader is supposed to appear the same as the nearest neighbor (aka "unfiltered"), except with minor corrections when using a non-integer scale that is increasingly less noticeable the higher it is scaled. This shader is useful to anyone who wants to keep things as sharp as possible without worrying about scale factors. Available in Quark and Cg shader formats. A newer alternative that does the same thing (but may give sharper results) is the sharp-bilinear shader, which prescales the image to a high resolution, then downscales using bilinear scaling.
Auto-box[edit]
Shaders that scale the image within the viewport. This can be useful for ensuring a certain quality of scaling, often with the intention of applying other effects on top that are picky about scaling.
Border[edit]
A shader that applies a border overlay to the game image. Can be used to fill empty areas on widescreen monitors with artwork, display a CRT or handheld bezel, or simulate Game Boy Player and Super Game Boy output.
Image Adjustment[edit]
Image adjustment shaders allow you to adjust the color levels of an image, including gamma, luminance, contrast, saturation, and so on, for personal preference, accuracy, or compensating your display. Often, these are used alongside other shaders. There are also shaders that simulate the color profiles of specific displays, such as the GBA or DS.
Tonemapping[edit]
A tone mapping shader allows you to use an external LUT texture to do tone mapping and other color adjustments.[2] The LUT texture is PNG image that can be edited in any image editing software to have the desired color adjustment. When the modified LUT is used in the shader, the color adjustment gets applied to the game's video output.
- See this page for Inverse tone mapping.
Shaders on real CRTs[edit]
On 31+kHz PC CRT monitors displaying in high-resolution modes, most filters/shaders should work fine as is, as most were intended for output scaled 3x or higher.
However, CRT monitors (and 15kHz CRTs) displaying in low-resolution modes like 240p or 480p, you will find many of them won't work correctly due to the low output resolution. In these cases, you should use shaders that are applied only on the horizontal axis, only make changes to color output without scaling, or those that add scanlines/interlacing for 480p output.
You can combine those things with these two shader presets: tvout.cgp for 240p and tvout+interlacing.cgp for 480p. Both of these allow you to have adjustable signal resolution blur applied horizontally, as well as color controls like gamma, saturation, and the option to use TV color range (16-235) instead of PC color range (0-255), while the 480p version provides a scanline shader that is interlaced on 480-line content. The signal resolution blur works best if you use a large horizontal resolution (1280 or higher recommended) while keeping your vertical resolution at 240 or 480, and setting the aspect ratio of the emulator to stretch to fit. The higher horizontal resolution will make it look natural and convincing, avoiding banding issues. Can be combined with NTSC filters/shaders for maximum authenticity, check out the shader presets in /cgp/tvout and /cgp/tvout+interlacing for some examples.
AI-powered filters[edit]
- New Nvidia app features AI-powered filters
- Nvidia FreeStyle
- What are the requirements to enable RTX Dynamic Vibrance?
AI-powered filters are a new technology with the potential to further improve the emulation experience. These filters use machine learning to automatically enhance the visuals of content. Nvidia recently release their new Nvidia App[1] which comes with new AI-powered filters called "Nvidia FreeStyle". Notable examples include RTX Dynamic Vibrance, an AI-powered dynamic image enhancement that avoids color crashing and RTX HDR, an AI-powered inverse tone mapping filter. AI-powered filters offer exciting possibilities for the future of emulation. As the technology matures, expect even more advanced features and use cases to emerge, further improving the way we experience various content such as classic video games.
Notable ReShade shaders[edit]
These are not shader presets. But you can create your own custom preset using these .fx shaders. As some of the effects (RTGI and Motion Estimation etc.) require depth access, make sure to have your depth buffer correctly configured if you want to use them. See this thread for using reshade and depth buffer access for emulators.
- Pascal Gilcher's RTGI shader ($)
- Developed by Pascal "Marty McFly" Gilcher, RTGI & Screen-Space Ray Traced Global Illumination is a shader for ReShade which make use of Path Tracing to bring Real Time Global Illumination to every game. Global Illumination is certainly not something new for games, but unlike conventional Baked / Precomputed Realtime GI, Marty McFly's Path Traced solution can provide a way more realistic and physically correct Global Illumination for every game.
- Ray Tracing Revolution's video about RTGI
- qUINT ReGrade ($)
- Many shaders for ReShade are designed to apply specific color adjustments similar to industry standard software like Adobe Lightroom or DaVinci Resolve. A common approach in ReShade presets is to use many of these color adjustments at once to achieve their look. LUTs (Look-up Tables) are a cheap and simple way of changing the colours of your game without having to rely on a huge stack of shaders that eats at your performance. You can use them to make in-game colours look more natural (colour correction), or give your game a certain stylised look (colour grading)
- qUINT Lightroom
- Free alternative to qUINT ReGrade, but qUINT ReGrade recommended instead of this one.
- qUINT Solaris ($)
- Solaris is a physically based exposure and bloom solution. Together with ReGrade, they replicate the journey of light into the camera, onto the sensor and through the editing software. It uses various tricks to generate a physically plausible glow effect around bright light sources with very little performance overhead. It also supports masking objects by depth for better scene integration and make it look natural. For best practices, only use Solaris to adjust the scene brightness so ReGrade receives a well-balanced image to work with.
- qUINT Physical DOF ($)
- Games use a pinhole lens camera model to render their images. As such, they do not exhibit the same visual effects seen in real cameras, and effects exclusive to those have to be artificially reintroduced. A Depth of Field (or DOF) filter simulates the blurring of out-of-focus areas in the image. In a real camera, many factors influence the appearance of the DOF blur, or so-called “Bokeh”, which photographers and filmmakers use extensively as an artistic tool. This physical Depth of Field shader recreates this effect as faithfully as possible.
- qUINT Clarity ($)
- Effects like unsharp mask are designed to sharpen or soften the image in a wider range, to enhance medium-sized details in the image and give the content some grip. The balanced, yet contrasty look of movie posters and magazine covers is quite often partially achieved through this effect. Much research is going into the type of filters that enhance local contrast, from the most basic unsharp mask to state of the art “Local Laplacian” filtering. Using this effect in realtime on video games allows to give blurry textures some bite, enhance the overall contrast of a scene or produce some pseudo Depth of Field effect to give the scene some depth. Clarity contains 2 different types of image enhancements, which can be used together.
- qUINT Optical Flow
- Optical Flow for games in realtime. The nature of optical flow is to detect/compare changes between frames over time, and then it gives us the motion vector in pixel color like flow map or normal map.
- qUINT Motion Estimation
- Motion estimation for games in realtime. Useful for Injecting TAA and per-object motion blurs into games (Demonstration). Also see this ReShade forum thread.
- lordbean HQAA
- Post-rendering Anti-Aliasing.
- matsilagi's RSRetroArch
- Repository of RetroArch and retro-related shaders / shaders from programs, ported for ReShade
- MajorPainTheCactus's Sony Megatron ReShade
- Sony Megatron shader ported from Retroarch to ReShade. ReShade forum thread.
- AutoHDR
- This add-on is ideally intended to be used with the Sony Megatron ReShade Port Presets.
- DevilSingh's CRT-Guest-Advanced, HD and NTSC for ReShade
- This is a port of the CRT-Guest-Advanced, HD and NTSC shaders from RetroArch/libretro to ReShade.
- Obsolete
- qUINT MXAO:Alternative to RTGI but there is no need to use MXAO, as RTGI does what it does much better.
- lordbean ASMAA:Post-rendering Anti-Aliasing.
- akgunter's crt-royale-reshade:This is a port of the crt-royale shader by TroggleMonkey from RetroArch/libretro to ReShade 4.9+. Recommended to use "DevilSingh's CRT-Guest-Advanced, HD and NTSC" instead.
Standalone patches and mods for shaders[edit]
Audio filters[edit]
Audio filters and presets are used to simulate the lo-fi audio quality of classical hardware such as CRT TVs. They're in no way meant to be 100% accurate, but are more designed to simulate, envoke the feeling and nostalgia of our 8 and 16bit youth.
MIDI, soundfonts and software synth solutions[edit]
Lots of projects out there for simulating these either via software implementation or FPGA solutions.
Here's why using soundfonts and MIDI is beneficial for PC emulators and emulation of sound cards;
useful resources;
- https://www.vogons.org/viewtopic.php?t=52977
- https://www.philscomputerlab.com/roland-midi-emulator-project-20.html
- https://sourceforge.net/projects/munt/
- https://github.com/skjelten/emusc
- SC-55mkII emulation WIP
- FluidSynth with MT-32 (demonstration)
- Roland SC-55 Soundfont by EmperorGrieferus (useful for DOSBox forks)
- PhilsComputerLab: General MIDI and Soundfonts (useful for DOSBox forks)
- PC emulators built-in solutions etc...
Downloads[edit]
- Libretro Cg shaders repository
- Libretro GLSL shaders conversion repository
- Libretro Vulkan (.slang) shaders repository (forked from Vulkan (.slang) shaders by Themaister)
- Libretro (CG/GLSL/Slang) shaders pack (Snes9x/puNES/RetroArch and more)
- RAINE/bsnes(073 to 091)/FS-UAE shaders pack
Further reading[edit]
All things shaders and filters
Vulkan GLSL (Slang) shader spec
Shader preview thumbnail repository
See also[edit]
- High dynamic range (HDR)