Skip to content

Instantly share code, notes, and snippets.

@jimmyjonezz
Created June 16, 2019 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmyjonezz/7c77563afd5e2c9d32e6525fd4f4dd58 to your computer and use it in GitHub Desktop.
Save jimmyjonezz/7c77563afd5e2c9d32e6525fd4f4dd58 to your computer and use it in GitHub Desktop.
shader_type canvas_item;
uniform float size_x=0.005;
uniform float size_y=0.005;
uniform float r_offset_x = -0.2;
uniform float r_offset_y = 0;
uniform float g_offset_x = 0;
uniform float g_offset_y = 0;
uniform float b_offset_x = 0.2;
uniform float b_offset_y = 0;
void fragment() {
vec2 uv = SCREEN_UV;
uv-=mod(uv,vec2(size_x,size_y));
vec2 PixelSize = TEXTURE_PIXEL_SIZE;
vec4 r_val = texture(SCREEN_TEXTURE, uv + vec2(r_offset_x, r_offset_y) * PixelSize);
vec4 g_val = texture(SCREEN_TEXTURE, uv + vec2(g_offset_x, g_offset_y) * PixelSize);
vec4 b_val = texture(SCREEN_TEXTURE, uv + vec2(b_offset_x, b_offset_y) * PixelSize);
vec3 Chromatic_Aberration = vec3(r_val.r, g_val.g, b_val.b);
COLOR.rgb = Chromatic_Aberration;
//COLOR.rgb= textureLod(SCREEN_TEXTURE,uv,0.0).rgb;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment