CRT Shader
Based on: https://www.shadertoy.com/view/Ms23DR
Works as Control Overlay with ColorRect. No values to set.
Look at Test_CRT.tscn in the Github to see how it works.
Shader code
// Based on: https://www.shadertoy.com/view/Ms23DR
shader_type canvas_item;
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
// Loosely based on postprocessing shader by inigo quilez, License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
vec2 curve(vec2 uv)
{
uv = (uv - 0.5) * 2.0;
uv *= 1.1;
uv.x *= 1.0 + pow((abs(uv.y) / 5.0), 2.0);
uv.y *= 1.0 + pow((abs(uv.x) / 4.0), 2.0);
uv = (uv / 2.0) + 0.5;
uv = uv *0.92 + 0.04;
return uv;
}
void fragment( )
{
vec2 iResolution = 1.0 / SCREEN_PIXEL_SIZE;
vec2 q = FRAGCOORD.xy / iResolution.xy;
vec2 uv = q;
uv = curve( uv );
vec3 oricol = texture( screen_texture, vec2(q.x,q.y) ).xyz;
vec3 col;
float x = sin(0.3*TIME+uv.y*21.0)*sin(0.7*TIME+uv.y*29.0)*sin(0.3+0.33*TIME+uv.y*31.0)*0.0017;
col.r = texture(screen_texture,vec2(x+uv.x+0.001,uv.y+0.001)).x+0.05;
col.g = texture(screen_texture,vec2(x+uv.x+0.000,uv.y-0.002)).y+0.05;
col.b = texture(screen_texture,vec2(x+uv.x-0.002,uv.y+0.000)).z+0.05;
col.r += 0.08*texture(screen_texture,0.75*vec2(x+0.025, -0.027)+vec2(uv.x+0.001,uv.y+0.001)).x;
col.g += 0.05*texture(screen_texture,0.75*vec2(x+-0.022, -0.02)+vec2(uv.x+0.000,uv.y-0.002)).y;
col.b += 0.08*texture(screen_texture,0.75*vec2(x+-0.02, -0.018)+vec2(uv.x-0.002,uv.y+0.000)).z;
col = clamp(col*0.6+0.4*col*col*1.0,0.0,1.0);
float vig = (0.0 + 1.0*16.0*uv.x*uv.y*(1.0-uv.x)*(1.0-uv.y));
col *= vec3(pow(vig,0.3));
col *= vec3(0.95,1.05,0.95);
col *= 2.8;
float scans = clamp( 0.35+0.35*sin(3.5*TIME+uv.y*iResolution.y*1.5), 0.0, 1.0);
float s = pow(scans,1.7);
col = col*vec3( 0.4+0.7*s) ;
col *= 1.0+0.01*sin(110.0*TIME);
if (uv.x < 0.0 || uv.x > 1.0)
col *= 0.0;
if (uv.y < 0.0 || uv.y > 1.0)
col *= 0.0;
col*=1.0-0.65*vec3(clamp((mod(FRAGCOORD.x, 2.0)-1.0)*2.0,0.0,1.0));
float comp = smoothstep( 0.1, 0.9, sin(TIME) );
COLOR = vec4(col,1.0);
}



i Made a game about this shader and made a video about it (trying to get feedback 🙂
https://www.youtube.com/watch?v=UQcv-61Gg0s&t=65s&ab_channel=BlueOctopus
The license statement in the fifth line confuses me. It is declared to comply with the License Creative Commons Attribution NonCommercial ShareAlike 3.0 Unported License, which requires modified materials to use the same license. However, the license statement at the bottom of the page is CC0.
Hey, I know this Shader is old af now, but I’m seriously in love with the Fisheye effect on it and was curious if you’d be willing to drop a Shader that is just the Fisheye? I can’t quite reverse engineer this myself as I’m not very good with Shaders lol
Plus no one else does a Fisheye like this and I cannot live without this effect
Hey I upgrade this shader with chat gpt to personalise things further:shader_type canvas_item;
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
// Activation/désactivation des effets
uniform bool enable_curve = true;
uniform bool enable_scanlines = true;
uniform bool enable_glow = true;
uniform bool enable_vignette = true;
uniform bool enable_chromatic_aberration = true;
uniform bool enable_fine_lines = true; // **NOUVEAU : Active les lignes fines**
// Réglage des effets
uniform float curve_amount : hint_range(0.8, 1.5) = 1.1;
uniform float scanline_intensity : hint_range(0.0, 2.0) = 1.0;
uniform float glow_intensity : hint_range(0.5, 3.0) = 1.0;
uniform float vignette_intensity : hint_range(0.1, 2.0) = 1.0;
uniform float chromatic_amount : hint_range(0.0, 5.0) = 1.0;
uniform float fine_lines_intensity : hint_range(0.0, 1.0) = 0.5; // **NOUVEAU : Intensité des lignes fines**
vec2 curve(vec2 uv) {
if (!enable_curve) return uv;
uv = (uv – 0.5) * 2.0;
uv *= curve_amount;
uv.x *= 1.0 + pow((abs(uv.y) / 5.0), 2.0);
uv.y *= 1.0 + pow((abs(uv.x) / 4.0), 2.0);
uv = (uv / 2.0) + 0.5;
uv = uv * 0.92 + 0.04;
return uv;
}
void fragment() {
vec2 iResolution = 1.0 / SCREEN_PIXEL_SIZE;
vec2 q = FRAGCOORD.xy / iResolution.xy;
vec2 uv = curve(q);
vec3 col;
if (enable_chromatic_aberration) {
col.r = texture(screen_texture, uv + vec2(chromatic_amount * 0.002, 0.0)).r;
col.g = texture(screen_texture, uv).g;
col.b = texture(screen_texture, uv – vec2(chromatic_amount * 0.002, 0.0)).b;
} else {
col = texture(screen_texture, uv).rgb;
}
if (enable_glow) {
col = clamp(col * 0.6 + glow_intensity * col * col * 1.0, 0.0, 1.0);
}
if (enable_vignette) {
float vig = vignette_intensity * 16.0 * uv.x * uv.y * (1.0 – uv.x) * (1.0 – uv.y);
col *= vec3(pow(vig, 0.3));
}
if (enable_scanlines) {
float scans = clamp(0.35 + scanline_intensity * 0.35 * sin(3.5 * TIME + uv.y * iResolution.y * 1.5), 0.0, 1.0);
col *= vec3(0.4 + 0.7 * pow(scans, 1.7));
}
// **NOUVEAU : Effet de lignes fines CRT**
if (enable_fine_lines) {
float fine_lines = sin(uv.y * iResolution.y * 500.0) * 0.5 + 0.5; // Fréquence élevée pour plein de petites lignes
col *= mix(1.0, fine_lines, fine_lines_intensity); // MĂ©lange l’effet en fonction de l’intensitĂ©
}
col *= 1.0 – 0.65 * vec3(clamp((mod(FRAGCOORD.x, 2.0) – 1.0) * 2.0, 0.0, 1.0));
COLOR = vec4(col, 1.0);
}