r/processing • • Apr 27 '21

[p5.js] Surfing the Simplex.

170 Upvotes

10 comments sorted by

4

u/17448807537963 Apr 27 '21

Sweet! What determines the cells movement? Proximity to adjacent cells, based on size & centered around the middle?

10

u/BennyPendentes Apr 27 '21

There is a small gravity-like force pointing toward the center, proportional to the distance from the center, just to keep things onscreen.

Nodes repel each other, proportional to their masses and the inverse square of their distance.

But their masses change as a function of 3D simplex noise at their current position at the current time. Each frame the nodes update their masses, repel each other, then take a single step. Then the noise field changes underneath them, and they start over again.

3

u/17448807537963 Apr 27 '21

Thanks for your answer! It was pretty much what I expected then, but I've never seen it implemented in this way. I think it's really impressive visually! Are there more channels where you share your coding stuff?

1

u/BennyPendentes Apr 28 '21

On Reddit I try to put a different piece (from the same code) in r/processing, r/creativecoding, and sometimes r/generative. (I sometimes skip the latter because I don't feel like my stuff is on the level of much of what I see there. Same with r/proceduralgeneration and r/visualizedmath.)

Out in the world I'm just on instagram.

3

u/Goober329 Apr 27 '21

I'm guessing a Simplex noise vector field and some logic like you said to keep the cells a certain distance from each other

2

u/LeosFDA Apr 28 '21

Any resources online teaching the fundamentals and concepts of how to create/code this?

3

u/BennyPendentes Apr 28 '21

tl,dr: I read a book and coded along with (rather than just 'watched') ~150 videos made by the guy who wrote the book. Now I spend a couple of hours every day trying new things, often resulting in one or two images or videos worth sharing with others.

I started out from almost zero, not that long ago, so some of this may be too fundamental.

Up to the point where I was coming up with my own ideas, everything I learned came from Dan Shiffman: 'The Nature of Code: Simulating Natural Systems, a book about modelling interesting systems in nature and using them to create interesting images/videos/systems in code, that is online, free, and is accompanied by two big playlists on Youtube: the original Nature of Code series using Processing, and a new revised version using p5.js/JavaScript. Switching to p5.js, I found the Programming with p5.js for Beginners playlist helpful, but if you already know what you are doing many of those videos will be too basic.

2

u/black_seneca Apr 28 '21

> I read a book and coded along with (rather than just 'watched') ~150 videos

Prof. Shiffman is awesome

i plan to do the exact same thing sometime next year :)

thanks for sharing very edifying

4

u/[deleted] Apr 28 '21

Excellent trypophobia trigger.

2

u/[deleted] Apr 27 '21

this is neat