diff --git a/shaders/final.fsh b/shaders/final.fsh index da7dc28..9e148d9 100644 --- a/shaders/final.fsh +++ b/shaders/final.fsh @@ -39,7 +39,7 @@ void main() { // physical post-processing effects #ifdef aberration - color.rb = aberrate(color).rb; + color.rb = aberrate().rb; #endif diff --git a/shaders/module/aberration.frag b/shaders/module/aberration.frag index 49a1f9e..d7efcf0 100644 --- a/shaders/module/aberration.frag +++ b/shaders/module/aberration.frag @@ -1,10 +1,10 @@ vec2 caOffset = vec2(2 * pixelSize / viewWidth, 0); -vec3 aberrate(vec3 color) { - vec2 offset = caOffset * abs(cos(texcoord * 3.14)); - float red = color.r; - float blue = color.b; +vec3 aberrate() { + vec2 offset = caOffset * cos(texcoord * 3.14); + float red = texture2D(gcolor, texcoord - offset).r; + float blue = texture2D(gcolor, texcoord + offset).b; return vec3(red, 0, blue); }