Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 10th, 2012  |  syntax: C++  |  size: 0.72 KB  |  views: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.      }