GLSL shader example
Logarithmic Spiral Arms
Combine log radius with angle to create arms that tighten toward the center; clamp radius to avoid log zero.
Live example
Edit the code and the preview updates as you type.
What to observe
Logarithmic Spiral Arms.
Mechanism
Combine log radius with angle to create arms that tighten toward the center; clamp radius to avoid log zero.
The controlling code
float a=atan(p.y,p.x),r=max(length(p),.01);float spiral=sin(a*4.-log(r)*(3.+u_parameter*8.)+u_time);c=palette(log(r)*.2+spiral*.12)*(0.2+.8*smoothstep(.2,.8,spiral));
Experiment
Change the angular multiplier a*4. to a*6.. Six spiral arms replace four while the log-radius term still determines how tightly they wind inward.
Debugging and cost
The lower bound in r=max(length(p),.01) prevents log from receiving zero. Increase .01 to .08 to enlarge the flattened center region; this reveals the radius clamp rather than adding detail at the singularity.