8
u/arachnic Sep 27 '21
Hey, that's lovely ! Do you mind explaining the avoidance logic ? And is a flow-field involved at any point ? Thanks
11
u/j2rgb Sep 27 '21
> Do you mind explaining the avoidance logic ?
Particle trails are written to a color buffer which get sampled by another shader running the simulation in order to detect intersections.> And is a flow-field involved at any point
Yes, some particles are influenced by a noise field.
1
1
3
u/Glitchhikers_Guide Sep 27 '21
What do you use to record/save these animations?
9
u/j2rgb Sep 27 '21
I run an express server that saves images to disk. The client code uses canvas.toDataURL to convert the webgl framebuffer to a png, which I then POST to the server running on localhost. I manually run ffmpeg on the resulting pngs to create gifs and mp4 at various resolutions.
7
u/Glitchhikers_Guide Sep 27 '21
Clever and over engineered. A programmer after my own heart lol. Thanks for the explanation.
12
u/iAccel Sep 27 '21
This is great. I really like the colors as well.
6
9
u/DeepExhale Sep 27 '21
I don't know what the fuck this is but I could watch it like I watched the Windows XP pipe screensaver as a kid for hours.
12
2
2
2
2
2
2
u/MrSplike Sep 27 '21
This is so cool! Have you tried it with the colors being associated with a specific movement logic? That could produce interesting results.
2
2
2
1
1
u/MildlySerious Sep 28 '21
If I wasn't already following you, I would now lol
Great job. Beautiful outcome and impressive work doing it all with shaders.
1
1
0
77
u/j2rgb Sep 27 '21 edited Sep 27 '21
Running in real-time in WebGL with a handful of GLSL shaders.
- Generate random positions and directions for each particle.
- Particles travel in a direction until they hit the trail of any other particle, including their own, at which point generate a new direction.
- Edit: Some subset of the particles are influenced by an underlying noise field.
Also on twitter.com/j2rgb and instagram.com/j2rgb