Advertisement
reivendark

Untitled

Sep 28th, 2021
1,417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. precision mediump float;
  2.  
  3. varying vec2 vTextureCoord;
  4. varying vec4 vColor;
  5.  
  6. uniform vec4 filterArea;
  7. uniform sampler2D uSampler;
  8.  
  9. uniform float angle;
  10. uniform float scale;
  11.  
  12. float pattern()
  13. {
  14.    float s = sin(angle), c = cos(angle);
  15.    vec2 tex = vTextureCoord * filterArea.xy;
  16.    vec2 point = vec2(
  17.        c * tex.x - s * tex.y,
  18.        s * tex.x + c * tex.y
  19.    ) * scale;
  20.    return (sin(point.x) * sin(point.y)) * 4.0;
  21. }
  22.  
  23. void main()
  24. {
  25.    vec4 color = texture2D(uSampler, vTextureCoord);
  26.    float average = (color.r + color.g + color.b) / 3.0;
  27.    gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement