SHARE
TWEET

Untitled

a guest Sep 11th, 2014 191 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifdef GL_ES
  2. precision mediump float;
  3. #endif
  4.  
  5. uniform sampler2D u_texture;
  6. uniform vec2 u_resolution;
  7. uniform vec2 u_mouse;
  8. uniform float u_diag;
  9.  
  10.  
  11. varying vec4 v_color;
  12. varying vec2 v_texCoord0;
  13.  
  14.  
  15. void main() {
  16.  
  17.     float glFCx = float(gl_FragCoord.x);
  18.     float glFCy = float(gl_FragCoord.y);
  19.  
  20.     float sigma = 50000;
  21.     vec2 dist2 = vec2(pow(abs(glFCx-u_mouse.x),2), pow(abs(glFCy-u_mouse.y),2));
  22.     float distScalar2 = dist2.x+dist2.y;
  23.     float normDistScalar = sqrt(distScalar2)/u_diag;
  24.     float lightness = exp(-distScalar2/sigma);
  25.  
  26.  
  27.     vec4 baseColor = texture2D(u_texture, v_texCoord0);
  28.  
  29.     float leftness = glFCx / u_resolution.x;
  30.     float downness = glFCy / u_resolution.y;
  31.     gl_FragColor = vec4(min(leftness+(1.0-baseColor.w), 1), min(downness+(1.0-baseColor.w), 1), min(1.0+(1.0-baseColor.w), 1), 1.0)*lightness;
  32.  
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top