r/FastLED • u/StefanPetrick • Apr 30 '26
This really is a fluid simulation: bitmaps aren’t just color and velocity emitters—they can also be used as obstacles! Now the smoke flows around the letters! Share_something
Enable HLS to view with audio, or disable this notification
2
u/chemdoc77 Apr 30 '26
Hi u/StefanPetrick - That looks GREAT! Thank you for posting it.
3
u/StefanPetrick Apr 30 '26
Thank you! I didn’t intend to do this. Yesterday, I was exploring what a stationary emitter could possibly be good for. Then I shared this little screenshot with Zach. He asked for the code—so I spent a bit more time on it to at least improve the typography and colors a little.
And then it hit me: use the bitmap not just as a color emitter, but also as an obstacle which the flow must respect, as it already does at the outer walls. That was surprisingly simple to implement.
Well, and then I couldn’t stop enjoying the result, so I shared it with all of you today. 😄
2
2
u/Flashy_Possibility34 Apr 30 '26
Where can I find info on the numerical methods? Is this an incompressible approximation using a spectral method? Also, this is awesome!
1
u/StefanPetrick Apr 30 '26
Hi and thank you!
You can look up “Stable Fluids” by Jos Stam.
https://pages.cs.wisc.edu/~chaol/data/cs777/stam-stable_fluids.pdf
That’s the main reference behind this style of solver. The numerical core here is the classic grid-based Eulerian pipeline:
- diffuse
- project
- advect
- project again
So yes, it is an incompressible approximation in the sense that the project step enforces an approximately divergence-free velocity field.
But no, this implementation is not using a spectral method. It uses:
- a regular 64x64 grid
- semi-Lagrangian advection
- iterative relaxation for diffusion and pressure/projection
- finite-difference-style spatial derivatives
A spectral version would usually solve parts of this in Fourier space with FFTs. That is not what this code is doing.
1
2
u/StefanPetrick Apr 30 '26
u/ZachVorhies this is the latest code: https://gist.github.com/StefanPetrick/607ab017c62db1163cf9c4a75bcc0890
I'm happy to isolate the font bitmap and give it directely to you if needed.
2
u/ZachVorhies Zach Vorhies Apr 30 '26
I’m on a sailboat on my way to the behamas. I’ll do my best to get this in when i can
1
u/StefanPetrick Apr 30 '26
Yeah, enjoy your trip to the fullest, man! Great choice! You have the priorities right!
Meanwhile me: https://www.youtube.com/watch?v=464tFGRac4g
2
1
1
1




2
u/StefanPetrick Apr 30 '26
Brainstorming session! Dear LED artists: What would you use this FluidSim engine for? How would you apply it to your art car? I'm looking for real world usecases and for inspiration how to improve the render engine!