Difference between revisions of "CRT shaders"

From Emulation General Wiki
Jump to navigation Jump to search
(Scanline Size)
(grammar)
(35 intermediate revisions by 12 users not shown)
Line 1: Line 1:
 +
[[File:Retroarch_2013-07-22_17-21-17-60.png|thumb|298px|CRT-Geom-Flat, with default settings]]
 +
Many of these replicate aperture grille CRTs, which have sharp images and strong scanlines. If you find that this doesn't look a damn thing like your old TV, it's probably because you owned a shadow-mask (Slot mask or dot mask) style CRT, which has less noticeable scan lines. The easiest way to tell the difference is to feel the curve of the screen; aperture grilles only curve horizontally if at all, or look at the left and right sides of the glass against the frame. If those sides are curved, it's a shadow mask. If they're straight, it's an aperture grille. Old TVs usually had slot masks, whereas monitors usually had dot masks. Unfortunately, shadow masks require resolutions of upwards of 4K UHD to emulate accurately with no downsampling of the phosphor grid, so all we have for the time being are aperture grille shaders for current display resolutions.
  
[[File:Crt-geom.png|thumb|350px|crt-geom-flat]]These replicate aperture grille CRTs, which have sharp images and strong scanlines. If you find that this doesn't look a damn thing like your old TV, it's probably because you owned a shadow-mask style CRT, which has less noticeable scanlines (the easiest way to tell the difference is to feel the curve of the screen; aperture grilles only curve horizontally if at all). Unfortunately, shadow masks require resolutions of upwards of 3000x4000 to emulate accurately, so all we have for the time being are aperture grille shaders.
+
Use integer scaling. 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.
  
Use integer scaling. 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.
+
==Download==
 +
https://github.com/libretro/common-shaders/tree/master/crt
 +
 
 +
==Types==
 +
===CRT-Geom===
 +
{{Main|CRT Geom}}
 +
*[https://github.com/libretro/common-shaders/blob/master/crt/shaders/crt-geom.cg crt-geom.cg]
 +
*[https://github.com/libretro/common-shaders/blob/master/crt/shaders/crt-cgwg-fast.cg crt-cgwg-fast-cg]
 +
 
 +
Simulates an aperture grille display (with the dot mask enabled). Very versatile and modifiable. One of the first popular CRT shaders. Visit the main article for more details.
  
====Download====
+
===CRT-Calagari===
https://github.com/libretro/common-shaders/tree/master/crt
+
*[https://github.com/libretro/common-shaders/blob/master/crt/shaders/crt-caligari.cg crt-calagari.cg]
  
==CRT Geom==
+
An older CRT shader similar to CRT-Geom but uses different methods to achieve its effects.
One of the more popular CRT shaders.
 
  
==Tweaking CRT Geom==
+
===CRT-Easymode===
You can open up CRT Geom in notepad and edit it.
+
*[https://github.com/libretro/common-shaders/blob/master/crt/shaders/crt-easymode.cg crt-easymode.cg]
 +
*[https://github.com/libretro/common-shaders/tree/master/crt/shaders/crt-easymode-halation crt-easymode-halation]
  
===Scanline Brightness===
+
A flat CRT shader whose settings are easier to understand. Similar to CRT-Geom in its effects.
vec4 weights = vec4(distance / 0.3);
 
  
Raise the 0.3 to a higher value to make the scanlines brighter. I do not recommend going past 0.4, as at that point on bright colors scanlines completely disappear, and going further makes them appear again, but on the wrong field in said bright colors, which is inaccurate. Try 0.35.
+
===CRT-Hyllian===
===Sharpness===
+
*[https://github.com/libretro/common-shaders/blob/master/crt/shaders/crt-hyllian.cg crt-hyllian.cg]
If you find the shader looks too blurry, you can increase the sharpness by going to the sections in the code that have the following lines (should be at the beginning of both the vertex and fragment portions of the shader code):
+
*[https://github.com/libretro/common-shaders/blob/master/crt/shaders/crt-hyllian-fast.cg crt-hyllian-fast.cg]
uniform vec2 rubyInputSize;
 
uniform vec2 rubyTextureSize;
 
  
then add these lines afterwards:
+
Aims only for picture quality, so it avoids things that degrade the image just for accuracy. It, however, uses far less power to run, so it is possible to run this shader on lower end systems than CRT-Geom.
  
vec2 InputSize = vec2(n*rubyInputSize.x, rubyInputSize.y);
+
Another version, crt-hyllian-lq.cg is specifically aimed at even lower end systems.
vec2 TextureSize = vec2(n*rubyTextureSize.x, rubyTextureSize.y);
 
Replace "n" with either 2 for increased sharpness, or 4 for maximum sharpness. Then Ctrl+F and seek out any portions of the code that say "rubyInputSize" and "rubyTextureSize", and replace them with "InputSize" and "TextureSize" respectively.
 
===Scanline Size===
 
To obtain thinner, 480p-esque scanlines, first tweak the shader to apply greater sharpness, but only apply it to the TextureSize. The code should look like this:
 
uniform vec2 rubyTextureSize;
 
vec2 TextureSize = vec2(2*rubyTextureSize.x, 2*rubyTextureSize.y);
 
Again, this is for both the vertex and fragment portions. Don't forget to seek out any other instances of rubyTextureSize, and replace them with simply TextureSize.
 
  
Now, go to the beginning of the fragment portion, and modify it as such:
+
===CRT-Lottes===
<fragment filter="nearest" outscale_x="1" outscale_y="2"><![CDATA[
+
*[https://github.com/libretro/common-shaders/blob/master/crt/shaders/crt-lottes.cg crt-lottes.cg]
This will only yield satisfactory results at 4x integer scale. Anything else will likely cause problems. It might also be wise to disable the phosphor emulation, as leaving it on produces a "grid"-like effect, which may or may not be desirable.
+
*[https://github.com/libretro/common-shaders/blob/master/crt/shaders/crt-lottes-halation.cg crt-lottes-halation.cg]
  
===Curvature===
+
A newer CRT shader that uses a horizontal shadow mask pattern with blooming. The horizontal pattern works quite well at current resolutions, though it isn't entirely accurate to a true vertical slot mask pattern.
  
To make it flat, just set cornersize (line 107) to something small, like 0.001 and cornersmooth (line 110) to something large, like 8000.0. Then, comment out (i.e., put two slashes in front of it, like this: // ) line 141, #define CURVATURE.
+
===GTU===
 +
*[https://github.com/libretro/common-shaders/tree/master/crt/shaders/gtu-v050 GTUv050 Cg]
 +
*[https://github.com/hizzlekizzle/quark-shaders/tree/master/GTU.shader GTUv040 Quark]
 +
*[https://github.com/libretro/common-shaders/tree/master/crt/shaders/GTU-famicom GTU-Famicom Cg]
 +
*[https://github.com/hunterk/interpolation-shaders/raw/master/GTUv050test.tar.gz GTUv50 Test program]
  
Define Curvature. Something like that Comment it out. That means adding "//" in front of it. It should look like this when you're done:
+
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.
  
//#Define Curvature
+
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.
  
===Interlacing===
+
===CRT-Royale===
 +
{{Main|CRT-Royale}}
 +
[[File:CRT-Royale.png|thumb|298px|CRT-Royale, with default settings at 1080p (view original for full details)]]
  
For the original, to disable interlacing, change this line:
+
*[https://github.com/libretro/common-shaders/tree/master/crt/shaders/crt-royale CRT-Royale]
  
ilfac = vec2(1.0,floor(rubyInputSize.y/200.0));
+
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 offests, 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.
  
to the following:
+
===CRT-Royale-Kurozumi===
  
ilfac = vec2(1.0,1.0);
+
*[https://github.com/libretro/common-shaders/blob/master/cgp/crt-royale-kurozumi.cgp CRT-Royale-Kurozumi]
===Phosphor===
 
To disable phosphor emulation (which alternately tints pixels green and magenta), comment out the following lines, found at the bottom of the shader code:
 
  
vec3 dotMaskWeights = mix(
+
A preconfigured CRT-Royale made to look like a professional CRT monitor, specifically Sony's PVM/BVM line of monitors.
vec3(1.0, 0.7, 1.0),
 
vec3(0.7, 1.0, 0.7),
 
floor(mod(mod_factor, 2.0))
 
);
 
 
mul_res *= dotMaskWeights;
 
  
==Variants==
+
==Future==
===Halation===
 
If you find the effect too strong on the Halation version, go to the following line of code:
 
mul_res += pow(texture2D(rubyTexture, xy2).rgb, vec3(monitorgamma))*0.1;
 
  
Lowering the last number reduces the effect of the halation. This is prefered since the default halation level is too high.
+
===Shadow Mask Phosphor Emulation===
 +
Hypothetical shadow mask phosphor shaders such as PhosphorLUT and CRT-Royale are being developed. Due to the nature of the shadow mask screen, 4K resolution is likely needed to avoid significant downsampling of the phosphors.
  
===CRT Monitor variant===
+
==External Links==
 +
*[http://filthypants.blogspot.com/2015/04/more-crt-shaders.html More CRT Shaders (filthypants.blogspot.com)] - hunterk's comparison of current CRT shaders.
  
If you're using a CRT monitor, you can use [http://www.mediafire.com/download/6ygh7saafpn7gm0/CRT-Geom_for_CRT_monitors.7z these] variants of CRT-Geom at 1280x960 full screen for an authentic 240p look. These variants are based on the flat variant with phosphor code commented out and the gamma correction disabled. There are three main variants (Normal, Sharp, Sharper), and each have different scanline brightness presets and interlacing enabled/disabled. As above, use integer scaling and force 4:3 aspect ratio. Some games may have black borders due to the full overscan area being visible, use your monitor's zoom function to zoom in and hide overscan. Also works with handheld games if you use the non-interlaced variant and force a 4x scale in RGUI.
 
 
[[Category:FAQs]]
 
[[Category:FAQs]]
 +
[[Category:Shaders/Filters]]

Revision as of 15:08, 22 August 2018

CRT-Geom-Flat, with default settings

Many of these replicate aperture grille CRTs, which have sharp images and strong scanlines. If you find that this doesn't look a damn thing like your old TV, it's probably because you owned a shadow-mask (Slot mask or dot mask) style CRT, which has less noticeable scan lines. The easiest way to tell the difference is to feel the curve of the screen; aperture grilles only curve horizontally if at all, or look at the left and right sides of the glass against the frame. If those sides are curved, it's a shadow mask. If they're straight, it's an aperture grille. Old TVs usually had slot masks, whereas monitors usually had dot masks. Unfortunately, shadow masks require resolutions of upwards of 4K UHD to emulate accurately with no downsampling of the phosphor grid, so all we have for the time being are aperture grille shaders for current display resolutions.

Use integer scaling. 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.

Download

https://github.com/libretro/common-shaders/tree/master/crt

Types

CRT-Geom

Main article: CRT Geom

Simulates an aperture grille display (with the dot mask enabled). Very versatile and modifiable. One of the first popular CRT shaders. Visit the main article for more details.

CRT-Calagari

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

CRT-Easymode

A flat CRT shader whose settings are easier to understand. Similar to CRT-Geom in its effects.

CRT-Hyllian

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

Another version, crt-hyllian-lq.cg is specifically aimed at even lower end systems.

CRT-Lottes

A newer CRT shader that uses a horizontal shadow mask pattern with blooming. The horizontal pattern works quite well at current resolutions, though it isn't entirely accurate to a true vertical slot mask pattern.

GTU

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.

CRT-Royale

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 offests, 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

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

Future

Shadow Mask Phosphor Emulation

Hypothetical shadow mask phosphor shaders such as PhosphorLUT and CRT-Royale are being developed. Due to the nature of the shadow mask screen, 4K resolution is likely needed to avoid significant downsampling of the phosphors.

External Links