Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. precision highp float;
  2.  
  3. uniform sampler2D uTexture;
  4.  
  5. varying vec2 vPUv;
  6. varying vec2 vUv;
  7.  
  8. void main() {
  9. vec4 color = vec4(0.0);
  10. vec2 uv = vUv;
  11. vec2 puv = vPUv;
  12.  
  13. // pixel color
  14. vec4 colA = texture2D(uTexture, puv);
  15.  
  16. // greyscale
  17. float grey = colA.r * 0.21 + colA.g * 0.71 + colA.b * 0.07;
  18. vec4 colB = vec4(grey, grey, grey, 1.0);
  19.  
  20. // circle
  21. float border = 0.3;
  22. float radius = 0.4;
  23. float dist = radius - distance(uv, vec2(0.5));
  24. float t = smoothstep(0.0, border, dist);
  25.  
  26. // final color
  27. color = colB;
  28. color.a = t;
  29.  
  30. gl_FragColor = color;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement