home *** CD-ROM | disk | FTP | other *** search
/ Bitfellas Bitjam / bitfellasbitjamcdbitfellas2007.iso / Dats / blur.ps < prev    next >
Text File  |  2007-07-30  |  1KB  |  34 lines

  1. sampler2D texture1;
  2. // z: contrast
  3. // w: luminosity
  4. float4 offset;
  5. float4 color;
  6. float weights[] = {
  7.     0.002216, 0.008764, 0.026995, 0.064759,
  8.     0.120985, 0.176033, 0.199471, 0.176033,
  9.     0.120985, 0.064759, 0.026995, 0.008764,
  10.     0.002216
  11. };
  12. float offsets[] = {
  13.     -0.0234, -0.0193, -0.0156, -0.0117,
  14.     -0.0078, -0.0031, 0.0, 0.0031, 0.0078,
  15.     0.0117, 0.0156, 0.0193, 0.0234
  16. };
  17. float4 main(float2 x:texcoord):color {
  18.     float4 col;
  19.     col = tex2D(texture1, x + offset.xy * offsets[0]) * weights[0];
  20.     col -= tex2D(texture1, x + offset.xy * offsets[1]) * weights[1];
  21.     col -= tex2D(texture1, x + offset.xy * offsets[2]) * weights[2];
  22.     col -= tex2D(texture1, x + offset.xy * offsets[3]) * weights[3];
  23.     col -= tex2D(texture1, x + offset.xy * offsets[4]) * weights[4];
  24.     col -= tex2D(texture1, x + offset.xy * offsets[5]) * weights[5];
  25.     col -= tex2D(texture1, x + offset.xy * offsets[6]) * weights[6];
  26.     col -= tex2D(texture1, x + offset.xy * offsets[7]) * weights[7];
  27.     col -= tex2D(texture1, x + offset.xy * offsets[8]) * weights[8];
  28.     col -= tex2D(texture1, x + offset.xy * offsets[9]) * weights[9];
  29.     col -= tex2D(texture1, x + offset.xy * offsets[10]) * weights[10];
  30.     col -= tex2D(texture1, x + offset.xy * offsets[11]) * weights[11];
  31.     col -= tex2D(texture1, x + offset.xy * offsets[12]) * weights[12];
  32.     return((col - offset.w) * color * offset.z);
  33. }
  34.