One of the more popular CRT shaders.
Tweaking CRT Geom
CRT Geom is highly customizable. You can open up CRT Geom in notepad++ and edit it. Regular notepad will work, but notepad++ is recommended.
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.
SharpnessIf 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):
uniform vec2 rubyInputSize; uniform vec2 rubyTextureSize;
then add these lines afterwards:
vec2 InputSize = vec2(n*rubyInputSize.x, rubyInputSize.y); 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.
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:
<fragment filter="nearest" outscale_x="1" outscale_y="2"><![CDATA[
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.
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.
Define Curvature. Something like that Comment it out. That means adding "//" in front of it. It should look like this when you're done:
For the original, to disable interlacing, change this line:
ilfac = vec2(1.0,floor(rubyInputSize.y/200.0));
to the following:
ilfac = vec2(1.0,1.0);
PhosphorTo 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( vec3(1.0, 0.7, 1.0), vec3(0.7, 1.0, 0.7), floor(mod(mod_factor, 2.0)) ); mul_res *= dotMaskWeights;
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.
CRT Monitor variant
If you're using a CRT monitor, you can use 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.