Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose you have a nice way to move your 2D particles in order to simulate a fluid (like water). Any ideas on how to render it?

This is for a 2D game, where the perspective is from the side, like this. The water will be contained in boxes that can be broken in order to let it fall down and interact with other objects. The simplest way that comes to my mind is to use a small image for each particle. I am interested in hearing more ways of rendering water.

share|improve this question
up vote 25 down vote accepted

Check out how PixelJunk Shooter did it (including simulation) in this presentation (PDF) at GDC2010.

Sample PixelJunk Shooter Image

share|improve this answer
Didn't know PixelJunk...really a nice pres. Thank you! – luke Mar 28 '12 at 11:51
A link to the trailer :) – David Gouveia Mar 28 '12 at 12:40
2 – Jimmy Mar 28 '12 at 20:16
What are SPU, PPU, SPURS ? – Martijn Courteaux Apr 2 '12 at 15:35
@MartjinCourteaux: they're part of the PS3's Cell CPU. Think of them like GPU shaders, albeit there are some key differences. – Sean Middleditch Apr 3 '12 at 19:13

George Duckett's answer is far more direct and really well presented if you need fully-simulated water in your game. For simulated shallow-water physics with minimal accuracy (less realism, more playful), this image gave me an incredible moment of clarity:

share|improve this answer
Simple and nice! Didn't really think to use such a simple post-processing step...just wonder if a device like iPhone will handle this. It seems to be a good starting point. Thx. – luke Mar 29 '12 at 8:36
I can vouch for this approach. I used it once in a project and it worked beautifully. Add a bevel filter and you can have a nice meniscus on your blobs as well. – scriptocalypse Apr 3 '12 at 21:18

Or, for a quick and easy approach: Use metaballs!

3d metaballs

share|improve this answer

Grant Kot has put some of his fluid simulation code up on Github with implementations in both javascript (canvas) and C++ with OpenFrameworks:

He has a few demos up on his youtube account:

I have no idea how it works, but I know it runs fast and there's all sorts of variations to build with it. A good keyword to search for might be "multigrid particles".

share|improve this answer
I really like how Grant Kot simulates fluids! Even if the rendering is minimal, at least on the applet on that web pages. It as a lot of paremeters to control the simulation. Worth a deeper look at it. Thx. – luke Mar 29 '12 at 20:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.