curvature.fs 384 B

12345678910111213141516171819202122
  1. #version 150
  2. #define distortion 0.08
  3. uniform sampler2D source[];
  4. uniform vec4 sourceSize[];
  5. in Vertex {
  6. vec2 texCoord;
  7. };
  8. out vec4 fragColor;
  9. vec2 radialDistortion(vec2 coord) {
  10. vec2 cc = coord - vec2(0.5);
  11. float dist = dot(cc, cc) * distortion;
  12. return coord + cc * (1.0 - dist) * dist;
  13. }
  14. void main(void) {
  15. fragColor = texture(source[0], radialDistortion(texCoord));
  16. }