Chromatic Aberration Vignette

I couldn’t find anything like this anywhere on the internet, so I had to do it myself!

Shader code
// Big thanks to both jecovier and axilirate, who's shaders I built upon

shader_type canvas_item;

uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
uniform vec2 r_displacement = vec2(3.0, 0.0);
uniform vec2 g_displacement = vec2(0.0, 0.0);
uniform vec2 b_displacement = vec2(-3.0, 0.0);

uniform float height: hint_range(0.0, 1.0, 0.1) = 0.7;
uniform float width: hint_range(0.0, 1.0, 0.1) = 0.5;

uniform 	float fade = 0.7;

void fragment()
{
	float shrink_width = 2.0 / width;
	float shrink_height = 2.0 / height;
	float dist = distance(vec2(UV.x * shrink_width, UV.y * shrink_height), vec2(0.5 * shrink_width, 0.5 * shrink_height));
	
	float r = texture(SCREEN_TEXTURE, SCREEN_UV + vec2(SCREEN_PIXEL_SIZE*r_displacement), 0.0).r;
	float g = texture(SCREEN_TEXTURE, SCREEN_UV + vec2(SCREEN_PIXEL_SIZE*g_displacement), 0.0).g;
	float b = texture(SCREEN_TEXTURE, SCREEN_UV + vec2(SCREEN_PIXEL_SIZE*b_displacement), 0.0).b;
	
	COLOR = vec4(r, g, b, dist - fade);
}
Tags
aberration, chromatic, Ellipse, vignette
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

Double Vision w/ chromatic aberration

Just Chromatic Aberration

Aberration Vignette – Phasmophobia effect

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments