Retro TV shader

This shader simulates a retro CRT TV with or without scanlines. The shader original is coded by a youtuber named “LetsGameDev”. Check out his channel: https://www.youtube.com/user/Tomzalat

Shader code
//---CRT Shader---
shader_type canvas_item;

uniform float scanline_count : hint_range(0, 1800) = 50.0;

vec2 uv_curve(vec2 uv)
	uv = (uv - 0.5) * 2.0;
	//You can modify the numbers and try different values
	uv.x *= 1.0 + pow(abs(uv.y) / 3.0, 2.0);
	uv.y *= 1.0 + pow(abs(uv.x) / 3.0, 2.0);
	//The scale part (you can delete it when you want)
	uv /= 1.2;
	uv = (uv/2.0) + 0.5;
	return uv;

void fragment()
	float PI = 3.14159;
	//You can modify the *3.0, *-3.0 for a bigger or smaller 
	float r = texture(SCREEN_TEXTURE, uv_curve(SCREEN_UV) + vec2(SCREEN_PIXEL_SIZE.x*0.0), 0.0).r;
	float g = texture(SCREEN_TEXTURE, uv_curve(SCREEN_UV) + vec2(SCREEN_PIXEL_SIZE.x*3.0), 0.0).g;
	float b = texture(SCREEN_TEXTURE, uv_curve(SCREEN_UV) + vec2(SCREEN_PIXEL_SIZE.x*-3.0), 0.0).b;
	//If you dont want scanlines you can just delete this part
	float s = sin(uv_curve(SCREEN_UV).y * scanline_count * PI * 2.0);
	s = (s * 0.5 + 0.5) * 0.9 + 0.1;
	vec4 scan_line = vec4(vec3(pow(s, 0.25)), 1.0);
	COLOR = vec4(r, g, b, 1.0) * scan_line;
2d, 80s, CRT, retro, scanlines, tv
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

Related shaders

Retro dither

2D Hologram Shader

Half-Tone Comic Shader

1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
1 month ago

Wow, this is an amazing shader, Just one question, I implemented it into my game, I want to reduce to lens distortion effect ( fish eye lens), but while looking through the shader code, I couldn’t find how to change this effect. Is there a value that I can change to reduce this effect? Thanks again for the amazing shader. 🙂