4 ms·
Simulating blobs of fluid
- dekhn 8y agovery clear read; wish I had this when I was learning molecular dynamics. However, I suggest using bouncing term on the walls rather than sticking.
- peeke 8y agoThanks, I'll try that, I'm not really happy with the behaviour at the edges yet. In hindsight it proved to be one of the most difficult things of the whole simulation!
- amelius 8y ago> wish I had this when I was learning molecular dynamics Keep in mind, though, that the article only outlines a way to make fluid drops look realistic, and doesn't actually guarantee anything about whether the behavior is realistic.
- caf 8y agoYes, the wall should probably exert a repelling force just like very close fluid particles do (except that the entire displacement is applied to the fluid particle, because the wall doesn't move).
- learnstats2 8y agoDid I miss a demo? I would have got more from this explanation if it also showed what it was talking about.
- rhema 8y agoYep, you missed it. It's at the top of the page / header.
- learnstats2 8y agoAh, thank you. It doesn't display in my browser.
- Varcht 8y agoI didn't miss it but I was skeptical at the performance, I thought to myself "be cool if mouse wheel scrolling agitated it, OMG it does!" Nice work, am a big fan of fluid sims too. Who says the internet is not fun anymore?
- thanatos_dem 8y agoOn mobile it’s also responding to the accelerometer data. At least on my iPhone X. Very cool demo.
- teunispeters 8y agoaccelerometer also works on chrome on ubuntu on my laptop (which also has an accelerometer) win!
- robin_reala 8y agoAside, but as peeke’s here: your articles are great. Any chance you could add an RSS feed so I can follow easily?
- buildlove 8y agoSuper interesting article -- it broke down the steps of the simulation algorithm very clearly and the code samples supplemented the theoretical explanation well. I've been learning D3.js recently (working with force-directed graph simulations) and this reinforces a lot of the concepts I've encountered in learning graph simulations with D3.
- Marioheld 8y agoVery nice demo but it seems that the gyroscope data from my phone is interpreted wrong. When I hold my phone with a left tilt the fluid flows to the right. Using iPhone XS with iOS 12.1.3
- jastanton 8y agoThis was really satisfying to demo on the bus. I held my phone up as still as I could and when the bus lurched forward or made an abrupt stop the fluid responded accordingly. Something about it was just beautiful. Tech imitating nature. The illusion held pretty well too. Good job Google/Apple for making good sensor data and this algorithm uses it well. Great job!
- alexfringes 8y agoFantastic read! Not to diminish the original contribution here, but I got curious and started looking for similar projects on the native (in my case iOS / Metal) side that aren't part of the usual suspects like game engines. These two are kind of fun to play with: https://github.com/andreipitis/FluidDynamicsMetal https://github.com/andreipitis/FluidDynamicsMetal https://github.com/hagmas/MobileFluidSimulation https://github.com/hagmas/MobileFluidSimulation Both based on this approach, detailed here by Nvidia: http://developer.download.nvidia.com/books/HTML/gpugems/gpugems_ch38.html http://developer.download.nvidia.com/books/HTML/gpugems/gpug... The technique this is based on doesn't create those satisfying tension effects but is more similar to paint flowing on a surface of water, so from a tangibility perspective I'd still love to find something closer to this post's work that runs natively.
- slavik81 8y agoThere are two difficulties you'd encounter adapting those techniques to this simulation: 1. The curved boundary is somewhat annoying to handle when your simulation is done using square grid cells. 2. Empty space introduces some really annoying boundary conditions. You'll notice that those two examples fill the entire region with fluid. It's entirely doable, but the boundary conditions probably triple the implementation effort when compared to a square box entirely full of fluid. As a wise man once said, "90% of the work in fluid simulations is dealing with boundary conditions."
- peeke 8y agoYou might find this post by Jamie Wong interesting: http://jamie-wong.com/2016/08/05/webgl-fluid-simulation/ http://jamie-wong.com/2016/08/05/webgl-fluid-simulation/ Doesn't seem to work on mobile though
- mmaldacker 8y agohttps://github.com/mmaldacker/Vortex2D https://github.com/mmaldacker/Vortex2D It should work on macOS/iOS via MoltenVK, but I haven't tested it extensively. It's a hybrid simulation with particles for the advection and a grid to ensure incompressibility.
- tastyfreeze 8y agoI was pleasantly surprised that scrolling made the fluid react to the motion. Very nice work both in writing and demonstration.
- huebomont 8y agoThe scroll response is backward, but otherwise very cool! When I scroll down, the ball goes up the screen, but the liquid goes up as well, whereas in real life it would be compressed towards the bottom of the ball.
- gdubs 8y agoMeta point but I really like the design, typography, and color of the whole post. Nice work!