Der Schmale – David Lenaerts’s blog

Flash Platform Experiments

Experimenting with Alchemy: of Smoke, Milk, and Ink

Tags: , , , , , ,

Smoke and Milk simulationThanks to Ralph Hauwert’s blogpost pushing a baffling >300.000 particles using Alchemy, I finally got the much needed motivation to try out Alchemy myself. To be able to get started asap, I decided to return to something I’ve done before: fluid and smoke dynamics, but with a different algorithm (see Mike West’s article on Gamedev). It took me a while to figure it out, but it’s up an running! It’s a faster algorithm, but less physically correct.

While I typically would do most of these kinds of calculations in Pixel Bender, for the examples below, I decided to try it all in C and see how far Alchemy can be pushed. The grid is bigger than before, while the framerate is steady around 20 on my machine. Ralph has suggested some improvements for the rendering step already (thx! ;) ), so I’ll have some more experimenting to do :D

It was great to return to C, especially since it’s been 8 years since I’ve written my last line in that language. Quite a rush of nostalgia!

Source is included with the demos, tho it’s not the most reusable I’ve ever written :)

The HiRes FPS counter is done by Mr. Doob.

Share and Enjoy:
  • Digg
  • TwitThis
  • del.icio.us
  • Facebook
  • Reddit
  • Netvibes
  • Technorati
  • Google

Tags: , , , , , ,

18 Responses to “Experimenting with Alchemy: of Smoke, Milk, and Ink”


  1. Peter Nitsch
    on Mar 23rd, 2009
    @ 8:10 pm

    Nicely done. I did hit a range error at cmodule.FluidSolver::FSM_advectBackward$/start() after some time, but I know first hand how tricky Alchemy can be to debug. :) Inspiring stuff!


  2. subblue
    on Mar 23rd, 2009
    @ 8:12 pm

    Very nice. I’m going to have to give Alchemy a spin too I think!


  3. David
    on Mar 24th, 2009
    @ 9:21 am

    Peter: Ah yes, I’ve come across that as well. It happens when air velocities grow much to large, since there’s no real relaxation step. After some tweaking it didn’t seem to occur anymore, but it seems it is. Capping the timestep at a lower maximum should be a quick fix, I think.

    Subblue: Thx, it’s definately worth checking out! :)


  4. Michael
    on Mar 25th, 2009
    @ 3:34 pm

    Very nice effects, well done! :-)


  5. sakri
    on Mar 31st, 2009
    @ 10:10 am

    holy crap, you’ve been out done again : http://www.flashandjam.com/?p=173


  6. David
    on Apr 1st, 2009
    @ 9:07 am

    Michael: cheers :)

    Sakri: Ow man, there’s just no competing with the power of AS2 and timeline tweening!


  7. foreground
    on Apr 2nd, 2009
    @ 10:00 pm

    This smoke air is good whell for me! But spread of smoke from source is not so good. But it so cool David, because u use alchemy with this experience! I have a small bug when try to view source by right-clicking on swf window. My browser become inactive. I think it show signs of threads lack.


  8. nicoptere
    on Apr 3rd, 2009
    @ 5:56 pm

    impressive
    +congrats for your work it’s just amazing ! (=> netvibed :) )


  9. More play with Alchemy : Lookup table effects. | UnitZeroOne
    on Apr 6th, 2009
    @ 10:11 am

    [...] David Lenaerts – Smoke, Milk and Ink [...]


  10. David
    on Apr 14th, 2009
    @ 9:37 am

    Foreground: Thanks! The context menu is often a bit unresponsive when the cpu is taxed, I’m not sure if anything can be done about that.

    Nicoptere: Cheers. I’m liking your blog a lot, just subsribed (and pushed a link on twitter ;) )


  11. Smoke effects using Alchemy Particle System - peter nitsch.net
    on Apr 16th, 2009
    @ 8:22 pm

    [...] the potential of the particle emitter. I plan on moving those operations to C++, perhaps using David Lenaerts Alchemy displacement map technique, once I figure out how I want to architect the effects layer for release (yes, I am planning on [...]


  12. kris
    on Apr 17th, 2009
    @ 10:39 pm

    oh how very neat!
    glad you put a stormy cursor in there this time, really adds some realism to the whole thing and makes it fun to play with.


  13. More play with Alchemy : Lookup table effects. - unitzeroone(beta)
    on May 7th, 2009
    @ 4:25 pm

    [...] David Lenaerts – Smoke, Milk and Ink [...]


  14. Hello World « Flash Toys
    on Sep 5th, 2009
    @ 4:28 pm

    [...] Experimenting with Alchemy of smoke, milk, and ink [...]


  15. Wor
    on Oct 4th, 2009
    @ 1:28 am

    Very nice, i would like use the smoke simulation in flash cs4 (.fla) but i don t know how implement your source in it. Can you explain me? tank you a lot


  16. David
    on Oct 6th, 2009
    @ 12:46 pm

    Wor: You’ll need to include the FluidSolver.swc to your CS4 project, and copy most of the code to your timeline or document class. Since it’s using Alchemy, I don’t recommend using it in a real project tho.


  17. Wor
    on Oct 7th, 2009
    @ 3:43 pm

    thx for instructions ;)


  18. Smoke #1 • Blog Archive • Visual Gratis
    on Dec 8th, 2009
    @ 11:09 am

    [...] Perlin Noise applied as Displacement Map. Got a little intrigued after seeing this experiment and this. While mine has no real physics behind it, it does render a rather pleasing effect. Simply made a [...]

Leave a Reply

© 2009 Der Schmale – David Lenaerts’s blog. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.