I have been meaning to write about this for months now but it feels too trivial and I put it off. Well, here’s how I stumbled upon the spongebob shader: I was playing around with the equation of a squircle

when I factored out the x and y raised to the powers of 4 as a square of squares.
It helps to think of each squared term like as energy or intensity from a physics perspective.
We can make the corners wavy if we turn one of the intensities sinusoidal.
These can still be thought of as intensities since and is a strength between 0 and 1.
Which gives us … yet another squircle with many islands around it. The waves essentially shunt off in the gaps between these islands.

To make the waves more frequent, we simply make the sine go radians or two full rotations every 1 unit step in the x or y direction.
The is an artistic choice, using one full rotation of radians would make the edges less wavy.
Now to get rid of the we can constrain the range of and to and .
You’ll have to mess around to find the upper bound like if you used a different wave frequency.
That’s it, behold the spongebob shader!
