Animal Well inspired CRT effect

My attempt at recreating the Animal Well crt effect, with the nice round pixels.

You’ll need to change the resolution and abberationFac constants to fit your needs. I’ve found that a 4x upscale and a linearFac of 1.3 give a nice blown-out effect.

Shader code
shader_type canvas_item;

uniform bool crt_enabled;
uniform sampler2D viewportNearest : filter_nearest, repeat_disable;
uniform sampler2D viewportLinear : filter_linear, repeat_disable;

uniform float scanLineFac = 0.1;
uniform float scanLineWidth = 0.25;
uniform float nearestFac = 0.0;
uniform float linearFac = 1.3;
uniform bool abberation_enabled = true;
const highp float abberationFac = 0.001;

const vec2 RESOLUTION = vec2(320,180);

void fragment() {
	if(crt_enabled){
		float fy = fract(UV * RESOLUTION).y;
		float scanLine = 0.0;
		float chromaticStrength = abberation_enabled? 1.0 : 0.0;
		if(fy < scanLineWidth || fy > 1.0 - scanLineWidth){
			scanLine = scanLineFac;
		}
		COLOR = vec4(0,0,0,1);
		COLOR.r += texture(viewportLinear, UV - vec2(chromaticStrength * abberationFac, 0.0)).r;
		COLOR.b += texture(viewportLinear, UV + vec2(chromaticStrength * abberationFac, 0.0)).b;
		COLOR.g += texture(viewportLinear, UV).g;
		COLOR = mix(COLOR * linearFac, vec4(0,0,0,1), scanLine);

		COLOR += texture(viewportNearest, UV) * nearestFac;
	}
	else{
		COLOR = texture(viewportNearest,UV);
	}
}
Live Preview
Tags
animal well, CRT, pixel, retro, VHS
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.

More from nitricswight

Related shaders

guest

0 Comments
Oldest
Newest Most Voted