Double Vision w/ chromatic aberration

to use this shader, add a colorrect or something as a child of your character controller (not as a child of the camera as we want it to apear infront of everything for the proper double vision effect) this is my first shader btw, please point out any issues! my yt is : https://www.youtube.com/@xXUnhingedDevXx

Shader code
shader_type canvas_item;

uniform lowp sampler2D screen_texture : hint_screen_texture, filter_nearest_mipmap, repeat_enable;
uniform lowp float alpha : hint_range(0.0, 1.0);
uniform lowp float scale : hint_range(0.0, 2.0);

uniform lowp float red_shift;
uniform lowp float blue_shift;
uniform lowp float green_shift;

uniform lowp float red_mult = 1;

void fragment() {
	vec2 uvs = SCREEN_UV * scale;
	vec4 final_texture  = texture(screen_texture, uvs);
	
	float r = texture(screen_texture, uvs + vec2(SCREEN_PIXEL_SIZE*red_shift), 0.0).r * red_mult;
	float g = texture(screen_texture, uvs + vec2(SCREEN_PIXEL_SIZE*green_shift), 0.0).g;
	float b = texture(screen_texture, uvs + vec2(SCREEN_PIXEL_SIZE*blue_shift), 0.0).b;
	
	COLOR = vec4(r, g, b, alpha);
}
Tags
aberration, Color, colour, coolasf, double, effect, FPS, hurt, vision
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 Unhinged Dev

Advanced 7 Texture Albedo Terrain Shader

ScreenSpaceLensFlares

Related shaders

Chromatic Aberration Vignette

Just Chromatic Aberration

Double texture blend 2D

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
GooseStranger
GooseStranger
1 year ago

Whenever I tried to use it, it gave out the error:
error(3): Expected valid type hint after ‘:’
I’m using Godot 3.5 so if this is made for Godot 4, that may be the issue.