1.shadertoy
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
// Normalized pixel coordinates (from 0 to 1)
vec2 uv = fragCoord/iResolution.xy;
uv -= 0.5;
//将uv的x坐标进行放大
uv.x *= iResolution.x / iResolution.y;
//将角度归一化到0-1
vec2 v = vec2(atan(uv.x,uv.y) / 6.28318530718 + 0.5,length(uv));
vec3 col = vec3(v.x);
fragColor = vec4(col,1.0);
}
2.算距离
将上述代码改为 vec3 col = vec3(v.y);