Polar Coordinates.fx

Ok because someone asked in the shoutbox, and I am a glutton for learning new math I decided to give the polar coordinates shader a shot. I am mostly done, with almost everything working (I need to rotate the whole thing 90 CCW, to mirror photoshops implementation). I will attach the .fx file to the end of the post.

In general it was a lot easier than I thought (the first implementation was a nightmare (and I complained for a while in irc to tonfilm today, I forgot to K.I.S.S). I am having some issues with the coordinates only showing half of the image and mirroring it to the other half. I think it has something to do with gettting the atan2 wrong (wrong signs for the x and the y). Its late now so I will sleep on it, to see if I can figure it out.

here 'tis though! Once I get the bugs worked out I will upload a help file.

polarCoordinates.fx (4.4 kB)

Ok replying to my own post. The effect is now posted in the shaders section. The mirroring was not due to the algorithm but due to setting the sampler state correctly.

sampler Samp = sampler_state
{
Texture = (Image);
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
};

AddressU and AddressV were defaulting to mirror. Explicitly setting them fixed the issue.

 AddressU = WRAP;
 AddressV = WRAP;

enjoy.

thank you very much for this shader! it helped me tremendously when working on an ffgl polar coordinate plugin (available soon at https://www.assembla.com/wiki/show/ffgl/ )
here is my version, ported back to hlsl in order to work with vvvv. the modifications are slight:

  • photoshop magic numbers added
  • conversion from polar to cartesian added
  • interpolation parameter added, for animation purposes

cheers!