The third pass at smoke/fluids simulation again looks quite different from the previous two attempts, but this time it’s stable both when keeping still as while moving. Not surprisingly, as the current approach is more like Stam‘s fluid solver. The downside is that it’s much less processor-friendly: every new step (adding forces, diffusion, advection, updating boundaries, …) needs the previous step to be completed over the entire velocity or pressure field. As a result, this simulation is using 9 different Pixel Bender kernels. In total, 49 pixel bender filters are executed per frame, some more intense as others, along with some BitmapData methods. Consequently, the grid size needs to be scaled down a lot (64×128 in the example). All in all, I’m still surprised that it doesn’t slow down to a crawl!
The FluidBitmap class has some properties such as timeStep, buoyancy and viscosity, which can influence the look and tempo of the fluid, but can affect the stability of the solver due to precision errors using BitmapData. There is support for forces, encoded in a BitmapData, similar to the velocity field (red = x, green = y). Maybe some day, I’ll make working with these forces a bit easier, but for now I’ll focus on other things than fluids ;)
The demo – A smoke simulation using positive buoyancy. Click to show the red and green channels representing the velocity field.
Oh, and a happy new year! :)
It is interested smoke. It visually more beautiful. But my computer had braked with mouse moving. In Process Explorer FF shows ~30% CPU. I don’t know why slow down had been 8-)
Amazing work… but CPU is a lil high
Wow David, beautiful looking smoke.
Thanks all!
Foreground: only 30%? That’s quite a surprise, mine is pretty much maxing out!
Taha: Yeah it’s rather intensive. Tuning down the grid size wouldn’t be a bad idea :)
this is really impressive!
Excellent work – the view all channels mode is visually very interesting.
I wanted to check again. . but your server got me this:
response-head: HTTP/1.1 404 Not Found
Date: Sat, 10 Jan 2009 08:20:48 GMT
Server: Apache
X-Powered-By: PHP/5.2.8
X-Pingback: https://www.derschmale.com/blog/xmlrpc.php
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Last-Modified: Sat, 10 Jan 2009 08:20:48 GMT
kevin: thanks! (and thanks for PB in general ;))
Subblue: Thx, I thought it’d be interesting to show what’s under the hood; it turned out rather trippy :)
Foreground: Hmm, guess it was something temporary, it seems to work again.
Great, and feeling like i realy have to dive in pixel bender. CPU of firefox/flash always takes it all
David,
I can get the demo to work in FireFox. All I get is the “Der Schmale” logo. Works fine in Internet Explorer (6.0)
I’m using FireFox 3.05 on Windows XP. Flash version 10.0.12.36. I suspect its something to do with the Flash detection you’re using.
Still once I got it working its a really impressive demo. Well done.
Cheers
Joe
Joe: Hmm that’s strange, I have the exact same configuration here. The version detection is straight from what Flex Builder 4.0 builds (tho I have had issues with the Flex 3’s version detection before) :/
David,
Hmm, works now in FireFox. It prompted me to update my flash player and then updated it again to 10.0.12.36 and now works. I don’t know if you changed anything but many thanks :)
J
Hi Joe,
Great news! I made a small change, but I didn’t know whether it would fix anything :D
hi there,
nice way of using pb. have you thought about a addition displacement-like map so the cursor creates turbulences as well?
just thought of that because that was a damn cool effect in a snow simulation of mine years ago ;D
cheerio
Hi Kris, instead of using a displacement map you could manipulate the force bitmapdata to create windflow caused by your cursor. It could take some effort, but it should have a more realistic impact on the smoke flow tho :)
Anyone know if this could be converted to work in After Effects?
James: I’m not sure about exactly what you can do using Pixel Bender in After Effects, but seeing as there’s quite a bit of Actionscript logic behind the simulation, I fear that a conversion could be quite difficult.
Pingback: Experimenting with Alchemy: of Smoke, Milk, and Ink | Der Schmale - David Lenaerts's blog
I recently used your PB fluid implementation for a little smoke effect on a friends blog: http://www.colingrist.com/