Water Boiler

It was around 23rd June 2002... I suddenly remembered - Flipcode's June coding contest! It was about one week left. "Liquid effects". Aiste suggested "A Semolina Simulator" - that clearly required a fluid/semolina solver. In my pile of papers I quickly found "Deep Water Animation and Rendering" - that was not very suitable. But in the references was mentioned "Stable Fluids" by Jos Stam - that was it!

So, I quickly typed in the basic "framework", then the fluid solver (used FFT for solving - that's absolutely incorrect because of pot boundaries, but who cares?). As semolina turned out to be too hard, I decided to make just the water boiler (with lots o' bubbles and rippling surface). So I modeled the pot, drew the textures, made lots of tuning, added the bubbles... And here it is: (tadadam!) The Water Boiler.

Requirements for running: Windows OS; DirectX 8.1; (relatively) fast CPU (700MHz or so); known to work on GPUs: TNT2 M64, TNT2 Vanta, GeForce2MX200, GeForce2Ti (so something along lines of those).


Binary release (executable, data files) here (401 KB). (Excuse me for programmer's art)

Source release (only sources, MSVC 6.0 project and workspace) here (527 KB). Warning: by no means it should be taken as an example of good design, coding style or efficiency. These things can't be found here :)

Things I found

  • Jos Stam's paper rocks!
  • For the first time I have faced the "instability" of the calculations. That occured before I implemented Stam's solver - I quickly coded a naive solver. Fluid velocities sometimes went crazy (or even to infinity). While instable calculations are acceptable in many cases, they are not suitable in the others...
  • (again) Direct3D 8 rocks! Especially when you're writing small demos/techdemos - just take "common" classes from D3D examples and type in your stuff. And with D3DX it's really "the best rendering engine ever" :)
  • Semolina is a very funny word. I didn't know it before I looked up in a dictionary. Moreover, the thing semolina is made of is called farina! English language is so funny sometimes :)

Things that are missing

  • Correct heating. Now the heating only heats one circle of bottom water elements. It should heat whole pot bottom almost uniformly, and also heat pot sides.
  • Solver with correct boundaries. Currently the velocities that go out of the pot appear on it's other side (that's because of FFT). Conjugate Gradient or similar solver should be used, with correct (cylinder) boundaries. That would be also slightly incorrect because the water surface is (in reality) not flat, but that's fairly negligible.
  • The bubbles movement/spawning was implemented "out of the top of my head", it's not even close to the correct movement.
  • Water refraction. I planned to do this (sort of: render "from-above" view into texture; then draw water surface as non-transparent grid, using that texture). But there were no time left, and this already exists in DX examples, right?
  • Water caustics (same as above, especially the "this already exists" part).

Boiler in action

These show the initial pot, nearly-boiling pot, and wireframe/velocities/temperatures view. Everything is on Duron700 / nVidia TNT2 M64, so don't pay big attention to the FPS number :) But the real fun of watching the bubbles can't be expressed in the shots...