Adam Ferriss Profile picture
swapping pixels https://t.co/pJJvGVrfSN https://t.co/HJopw4Ct4C

Jan 2, 2022, 7 tweets

I'm gonna try and keep up with #genuary this year by using p5, and hopefully show off some of the lesser known features of the p5 renderer

github.com/aferriss/genua…

Here's my sketch for todays prompt (draw 10,000 of something)

aferriss.github.io/genuary/1-1/

This one uses an undocumented feature of the webGL renderer, that allows you to create custom geo on the fly.

Also, you can create your own per-vertex attribute buffers by creating p5.RenderBuffer and pushing it into renderer.retainedMode.buffers.fill.

In this case I use it to give each particle a unique id

The great part about making geo this way is that it's almost entirely on the GPU (after the initial creation) so it's super fast.

10k particles is nothing, we can easily do 100k or more using this method.

Color is just coming from noise here but you can get wild with it. Here's a couple more palettes...

You can test this one out on the p5 web editor too.

editor.p5js.org/aferriss/sketc…

Some of the attribute names have changed in the main branch of p5, so there's some slight changes between here and the version on gh

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling