home *** CD-ROM | disk | FTP | other *** search
/ BitJam / bitjam1-1.iso / interface / sign_of_life / blur.ps < prev    next >
Text File  |  2007-09-05  |  2KB  |  34 lines

  1. sampler2D texture1;
  2. // z: contrast
  3. // w: luminosity
  4. float4 offset:register(c0);
  5. float4 color:register(c1);
  6. float4 main(float2 x:texcoord):color {
  7.     float4 col;
  8.     float weights[] = {
  9.         0.002216, 0.008764, 0.026995, 0.064759,
  10.         0.120985, 0.176033, 0.199471, 0.176033,
  11.         0.120985, 0.064759, 0.026995, 0.008764,
  12.         0.002216
  13.     };
  14.     float offsets[] = {
  15.         -0.0234, -0.0193, -0.0156, -0.0117,
  16.         -0.0078, -0.0031, 0.0, 0.0031, 0.0078,
  17.         0.0117, 0.0156, 0.0193, 0.0234
  18.     };
  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.