[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.
Post Reply
Darlex
Party member
Posts: 128
Joined: Sun Sep 24, 2017 10:02 am
Location: Chile
Contact:

[SOLVED] HOW TO MAKE RGB SPLIT EFFECT?

Post by Darlex »

Image
This is solved!
Last edited by Darlex on Sat Jan 19, 2019 3:33 pm, edited 1 time in total.
Hi! I wish you have an amazing day!
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

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

Post by ivan »

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: 128
Joined: Sun Sep 24, 2017 10:02 am
Location: Chile
Contact:

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

Post by Darlex »

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!
Hi! I wish you have an amazing day!
Post Reply

Who is online

Users browsing this forum: coolCatfish, Google [Bot] and 80 guests