CRT Screen Shader

Uses the “pixel_texture” as an overlay for what each pixel on the result should look like.

“screen_size” should be how large the base texture is.

For pixel perfect results, the sprite/ texture rect should be (screen_size * pixel_texture) in size.

Shader code
shader_type canvas_item;

uniform sampler2D pixel_texture : hint_default_white;
uniform vec2 screen_size = vec2(128, 128);

void fragment() {
	vec2 uv = UV * screen_size;
	uv -= floor(uv);
	vec4 crt_overlay = texture(pixel_texture, uv);
	vec4 base_texture = texture(TEXTURE, UV);
	COLOR.rgb = crt_overlay.rgb * base_texture.rgb * base_texture.a;
	COLOR.a = 1.;
}
Live Preview
Tags
CRT, LCD, monitor, oldschool, screen
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

guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
gatzai
gatzai
7 months ago

cool,it’s really simple and efficiency