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-dizzy.phl


  // rotated texture
  // a bit based on Dizzy from Ati Render Monkey
  // Holger Grahn hg . snafu.de 
  float time=0;
  float sampleDist = 1.0f/512.0f;  // distance one pixel in u/v
  
  float rings: register(c1) = 2;
  float speed: register(c2)=5;
  float exponent: register(c3)=1.5;
  
  float2 center = { 0.5, 0.5 };
  float2 scale =  { 2, 2 };
  
  // input
  sampler2D image : register(s0);
  
  float4 main(
          float4 Pos : POSITION,
          float2 texCoord: TEXCOORD0) : COLOR 
  {
  
          texCoord = scale* (texCoord-center);
          
          float radius = length(texCoord);
          
             float ang = atan2(texCoord.x, texCoord.y);
             float rad = pow(dot(texCoord, texCoord), exponent);
             
             ang = ang + rings * sin(time*6.28) * rad + speed * time;
             
             float2 newTexCoord = float2(0.5 * (1 + radius*sin(ang)),0.5 * (1 + radius*cos(ang)));
             
  
          float4 img = tex2D(image, newTexCoord);
          return img;
  
  }
  
  

[] 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.