v 0. Pasted by NULL_PTR as cpp at 2008-06-17 02:16:01 MSK and set expiration to never.

Paste will expire never.

  1. sampler2D baseMap;
  2.  
  3. float4 ps_main(float2 tc : TEXCOORD0) : COLOR0
  4. {
  5.    float2 size = float2(512, 512);
  6.    float2 size8 = float2(512/8.0, 512);
  7.    float2 isize = 1.0 / size;
  8.    float2 isize8 = 1.0 / size8;
  9.  
  10.    float2 ssize = frac(tc * size8);
  11.    tc -= ssize*isize8;
  12.    
  13.    ssize *= 0.5;
  14.  
  15.    float4 eq[8];
  16.    for(int i = 0; i < 8; i++)
  17.       eq[i] = tex2D(baseMap, tc+float2(i,0)*isize);
  18.  
  19.    float wind = 0.0;
  20.    for(int i = 0; i < 2; i++)
  21.    {
  22.       float4 ty = ssize.yyyy - eq[2+i*4];
  23.       float4 rel = ty / eq[3+i*4];
  24.       float4 resx = lerp(eq[0+i*4], eq[1+i*4], rel.xyzw);
  25.  
  26.       float4 addf = (0.5).xxxx;
  27.       addf = rel <= 0.0 ? (0.0).xxxx : addf;
  28.       addf = rel > 1.0 ? (0.0).xxxx : addf;
  29.       addf = resx <= ssize.xxxx ? (0.0).xxxx : addf;
  30.  
  31.       wind += dot(addf, 1);
  32.    }
  33.  
  34.    return frac(wind)>0.0?0:1;
  35. }


Editing is locked.