# Superformula

I've been looking into procedural plant generation recently. One of the aspects I'm interested in are methods for producing leaves, petals and flowers. While doing some digging around that topic, I stumbled upon the so-called superformula - an equation that produces some funky-looking curves.

The superformula was invented by Belgian mathematician Johan Gielis. Incidentally, he also wrote a book called "The Geometrical Beauty of Plants" (title probably alludes to ABOP), so yeah, he is definitely interested in plant synthesis :-)

Anyway, the superformula equation given in 2D polar coordinates is as follows:

r(φ) = (|cos(0.25m1φ)/a|n2+|sin(0.25m2φ)/b|n3)-1n1

...where a, b, m1, m2 n1, n2, n3 are parameters that you can tweak to achieve a different look for the resulting curve.

Let's plug it into Shadertoy and see how it works:

Click to go to Shadertoy and see the source code

Play with the parameters to figure out how each of them affects the result.

I added offset/rotation/scale parameters to the curve function to allow drawing multiple curves at different locations: