From 8401f8bcf0c24f47047a36a80271303f3325180d Mon Sep 17 00:00:00 2001 From: Valerie Date: Sun, 5 May 2024 14:48:27 -0400 Subject: [PATCH] retuned chromatic aberration --- shaders/final.fsh | 2 +- shaders/module/aberration.frag | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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); }