Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Polar coordinates shader by Ben Hickling
- #define PI 3.14159265359
- uniform float texture_offset = 0.0;
- uniform float rotation = 0.0;
- uniform float scale = 1.0;
- float4 mainImage(VertData v_in) : TARGET
- {
- float2 tex_coord = v_in.uv;
- float2 uv = v_in.uv - float2(0.5, 0.5);
- float ang = atan2(uv.y, uv.x);
- float len = length(uv);
- tex_coord.x = len;
- tex_coord.y = ang * 0.5 / PI + 0.5 + rotation;
- return image.Sample(textureSampler, frac((tex_coord + float2(texture_offset,0)) * scale));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement