media @ VU
[] readme course preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthoughts appendix references examples resources _

talk show tell print

phl-laplace.phl


  // laplace filter
  float time=0.5;
  float sampleDist = 1.0f/512.0f;  // distance one pixel in u/v
  
  sampler2D image : register(s0);
  
  static const float2 offsets[4] = {
          -1,  0,
          0,  1,
          1,  0,
          0, -1,
  };
  
  float4 main(
          float4 Pos : POSITION,
          float2 texCoord: TEXCOORD0) : COLOR 
  {
          //float4 img = tex2D(image, texCoord);
          //return img;
  
          //  blur  (4 neigbours average)
          float4 sum = 0;
          float scale = 0.25;
          float offset=0;
  
          
          //laplace filter
          sum  = -4 * tex2D(image, texCoord);        
          scale = 4.0;
          offset = 0.5;
  
          for (int i = 0; i < 4; i++) {
                  sum += tex2D(image, texCoord + sampleDist * offsets[i]);
          }
  
          sum = offset + sum * scale;          
          return sum;
          //return lerp(sum,float4(1,1,1,1)-sum,time);          //-sum
  }
  
  

[] readme course preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthoughts appendix references examples resources _

(C) A. Eliëns 9/8/2006

You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.