## [SOLVED] HOW TO MAKE RGB SPLIT EFFECT?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Darlex
Party member
Posts: 114
Joined: Sun Sep 24, 2017 10:02 am
Location: absolutely not Chile
Contact:

### [SOLVED] HOW TO MAKE RGB SPLIT EFFECT?

This is solved!
Last edited by Darlex on Sat Jan 19, 2019 3:33 pm, edited 1 time in total.
culdud uwu

ivan
Party member
Posts: 1423
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

### Re: How i can do this effects on my games?

It's called chromatic abberation and can be achieved using shaders:

Code: Select all

// jangsy5 code
extern number aberration = 2.0;

vec4 effect(vec4 color, Image tx, vec2 tc, vec2 pc)
{
// fake chromatic aberration
float sx = aberration/love_ScreenSize.x;
float sy = aberration/love_ScreenSize.y;
vec4 r = Texel(tx, vec2(tc.x + sx, tc.y - sy));
vec4 g = Texel(tx, vec2(tc.x, tc.y + sy));
vec4 b = Texel(tx, vec2(tc.x - sx, tc.y - sy));
number a = (r.a + g.a + b.a)/3.0;

return vec4(r.r, g.g, b.b, a);
}


Darlex
Party member
Posts: 114
Joined: Sun Sep 24, 2017 10:02 am
Location: absolutely not Chile
Contact:

### Re: How i can do this effects on my games?

ivan wrote:
Sat Jan 19, 2019 5:39 am
It's called chromatic abberation and can be achieved using shaders:

Code: Select all

// jangsy5 code
extern number aberration = 2.0;

vec4 effect(vec4 color, Image tx, vec2 tc, vec2 pc)
{
// fake chromatic aberration
float sx = aberration/love_ScreenSize.x;
float sy = aberration/love_ScreenSize.y;
vec4 r = Texel(tx, vec2(tc.x + sx, tc.y - sy));
vec4 g = Texel(tx, vec2(tc.x, tc.y + sy));
vec4 b = Texel(tx, vec2(tc.x - sx, tc.y - sy));
number a = (r.a + g.a + b.a)/3.0;

return vec4(r.r, g.g, b.b, a);
}

Wow! Thanks!
culdud uwu

### Who is online

Users browsing this forum: No registered users and 6 guests