rgb offset shader v2

i decided to go back and fix the offset system by adding xy support to the shader


remember, you must credit me for using this shader

Shader code
shader_type canvas_item;
render_mode unshaded;

uniform sampler2D displace : hint_albedo;
uniform float dispAmt: hint_range(0,0.1);
uniform vec2 abberationAmtXR = vec2(0,0);
uniform vec2 abberationAmtXG =  vec2(0,0);
uniform vec2 abberationAmtXB =  vec2(0,0);

uniform float dispSize: hint_range(0.1, 2.0);
uniform float maxAlpha : hint_range(0.1,1.0);

void fragment()
    //displace effect
    vec4 disp = texture(displace, SCREEN_UV * dispSize);
    vec2 newUV = SCREEN_UV + disp.xy * dispAmt;
    COLOR.r = texture(SCREEN_TEXTURE, newUV - abberationAmtXR).r; 
    COLOR.g = texture(SCREEN_TEXTURE, newUV + abberationAmtXG).g; 
    COLOR.b = texture(SCREEN_TEXTURE, newUV + abberationAmtXB).b;
    COLOR.a = texture(SCREEN_TEXTURE, newUV).a * maxAlpha;
The shader code and all code snippets in this post are under GNU GPL v.3 license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from snesmocha

Reupload of outline shader

Undertale Animation Skew

Samuel Wolffang based rgb shift shader

Related shaders

Samuel Wolffang based rgb shift shader

2D Hologram Shader

Half-Tone Comic Shader

Inline Feedbacks
View all comments