SHARE
TWEET

Untitled

a guest Oct 10th, 2012 22 Never
  1. uniform sampler2D normal;
  2. uniform vec2 mouse;
  3. uniform float Za;
  4.      vec4 effect(vec4 color,sampler2D tex,vec2 tc,vec2 pc)
  5.      {
  6.      vec4 img_color = texture2D( tex, tc );
  7.      vec4 normalColor = texture2D( normal, tc );
  8.      float X = (mouse.x - pc.x);
  9.      float Y = (mouse.y - pc.y);
  10.      float Z = Za;
  11.      float dotProduct = X * normalColor.r + Y * normalColor.g + Z * normalColor.b;
  12.      dotProduct /= sqrt(X * X + Y * Y + Z * Z) * sqrt(normalColor.r * normalColor.r + normalColor.g * normalColor.g + normalColor.b * normalColor.b);
  13.      float factor = dotProduct;
  14.      img_color.r = img_color.r + factor;
  15.      img_color.g = img_color.g + factor;
  16.      img_color.b = img_color.b + factor;
  17.      return img_color;
  18.      }
RAW Paste Data
Top