WaterBox for Symbian S60v3 was my first mobile phone application – and possibly the world’s first fluid simulator on a mobile phone.

Back in the 2008 I was inspired by one of the early apps for the original iPhone called iWater (or iBeer) – an application that played a pre-recorded video of a glass of water and then utilized the accelerometer of iPhone to create an illusion of the water being poured out of the glass when the phone was tilted. Neat trick, and when I first saw it, I even thought there was more advanced simulation running behind the app.

The idea stuck, and having a fluid simulator that one could wave around and see the liquid bounce around felt like a cool idea. I had recently got a new Nokia N95 8GB and knew it featured a 3-axis accelerometer like the iPhone. I couldn’t find any existing iWater-like apps for the N95 so I downloaded the S60 SDK and started studying the Symbian application development – of which I had heard horror stories of it being very complicated. After some trial and error I had my OpenGL ES equivalent of “Hello World” application ready: a white triangle that was rotating on screen.

As I had the basic framework ready I started studying the topic of fluid simulation and quite quickly ran into papers about smoothed-particle hydrodynamics (SPH). Using particles for fluid simulation seemed like the easiest approach as I had programmed particle-related effects before, e.g. when developing Zircon. Implementing the SPH wasn’t too hard (I might have cut some corners though) but finding good parameters for the SPH equations took some time as I wanted the fluid act like water. Rendering the fluid was a bit more challenging as I had done most of the development by simply rendering the particles as points which obviously wasn’t enough to convey the effect. I found some tutorials on metaballs that I adapted for my purposes, even though the metaball rendering was quite CPU intensive way to draw the 2D water.

I was quite happy with the results so I recorded a (too long) video of myself playing with the application and posted it on YouTube. The version of the application in the video uses 75 particles for the fluid simulation and the rendering is done with the metaball renderer that gives about 25-30 FPS.

Shortly after posting the video online something interesting happened: I was contacted by a site called Symbian Freak, a somewhat popular page dedicated for Nokia and Symbian related news. They wanted to write a news post on WaterBox so I gave them some additional details about the app and some approximation on when I would release the application for download (back in the day there was some application store for Nokia Symbian phones but most of the applications were just distributed as .sis files and installed manually). Original news post on symbian-freak.com.

As the interest grew around WaterBox, I went into crunch mode and pushed the release schedule from “a couple of week” to just four days. Major changes between the version on the original YouTube video and the released 1.0.0 are much more responsive water and new rendering method for the particles. In principle the new renderer worked like this:

  • Assume that the screen resolution is N x M (e.g. 320 x 240 like the N95 8GB had).
  • Create a matrix D that is N/2 x M/2 in size and initialize it with zeroes.
  • For each particle, apply an A x A sized matrix M (e.g. 8 x 8) to the matrix D to the position that corresponds the particle’s position in XY-space
    • The matrix M should have different values in its elements so that it essentially represents a bitmap image of a sphere, e.g. M0,0 could be 0 and M3,3 = 10.
  • Render matrix D on screen by applying a threshold value, e.g. If Di,j > 2 -> draw OpenGL point size 3, else don’t draw anything.
    • Coloring can be based on the threshold as well, e.g. If 2 < Di,j < 5 -> use white color, else use blue color

The release of WaterBox 1.0.0 was also featured on Symbian Freak as a news post, and it received quite warm welcome on the forums. I recall having a download counter on my old homepage with over 10 000 hits, and the app has been featured on many Symbian download sites. At that time these kind of accelerometer apps were new and exiting as most mobile phones didn’t even have an accelerometer. One can still find many videos on YouTube where people show off the amazing WaterBox their phones.

Even though the reception was positive overall, I didn’t continue developing WaterBox further; Symbian development wasn’t that much fun and I felt I had accomplished what I originally wanted; to have a fluid simulator on a mobile phone. Eventually the development environment got lost, along with the WaterBox source codes, so the original WaterBox is long gone – although, I have re-implemented it in the past for Nokia N900 and also on an embedded system project that I’ll later feature on this website.


Leave a Reply

Your email address will not be published. Required fields are marked *