kaliber/assets/demo/chromatic_aberration.glsl_f...

28 lines
727 B
Plaintext

#ifdef GL_ES
precision mediump float;
#endif
IN(0) vec2 tex_coord_0;
UNIFORM_BEGIN
UNIFORM_V(vec2 scale)
UNIFORM_V(vec2 offset)
UNIFORM_V(vec2 rotation)
UNIFORM_V(vec2 tex_offset)
UNIFORM_V(vec2 tex_scale)
UNIFORM_F(float aberration_offset)
UNIFORM_V(mat4 projection)
UNIFORM_F(vec4 color)
UNIFORM_END
SAMPLER(0, sampler2D texture_0)
FRAG_COLOR_OUT(frag_color)
void main() {
vec4 r = TEXTURE(texture_0, tex_coord_0 - vec2(PARAM(aberration_offset), 0));
vec4 g = TEXTURE(texture_0, tex_coord_0 - vec2(-PARAM(aberration_offset), 0));
vec4 b = TEXTURE(texture_0, tex_coord_0 - vec2(0, PARAM(aberration_offset)));
FRAG_COLOR(frag_color) = vec4(r.x, g.y, b.z, (r.w + g.w + b.w) / 3.0) * PARAM(color);
}