pouët.net

Raymarching Beginners' Thread

category: code [glöplog]
This a polar repetition with smoothness aka "Smooth Symmetric Polar Mod"
Made a Shadetoy with it https://shadertoy.com/view/NdS3Dh
BB Image
Code://SmoothSymmetricPolarMod aka smoothRot // //s repetitions //m smoothness (0-1) //c correction (0-1) //d object displace from center // vec2 smoothRot(vec2 p,float s,float m,float c,float d){ s*=0.5; float k=length(p); float x=asin(sin(atan(p.x,p.y)*s)*(1.0-m))*k; float ds=k*s; float y=mix(ds,2.0*ds-sqrt(x*x+ds*ds),c); return vec2(x/s,y/s-d); }

login