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

How do I simulate water droplets realistically falling, gathering, and flowing down a window? For example, see In particular, I want to simulate how smaller droplets merge together to form larger droplets that have enough weight to oppose the surface tension and flow downward, leaving a trail of water.

I'm aware of fluid simulation, but how would it be applied in this situation?

share|improve this question
up vote 3 down vote accepted

There was a good rain-on-glass simulation in the ATI Toy Shop demo from a few years ago. See the video starting at 1:30; and here are detailed slides on how all the rain effects work.

share|improve this answer
Could be cool if those links were fixed. – Maxim Kamalov Jun 16 '15 at 0:02
@MaximKamalov Done. (Until the next time AMD decides to reorganize their website...) – Nathan Reed Jun 17 '15 at 0:52
Might be a good idea to describe the gist of the technique in the answer, so the usefulness of this Q&A page isn't dependent on AMD's whims. ;) – DMGregory Jun 17 '15 at 1:50

Unless rain is especially important in your game I'd go with a fairly simple simulation like the one described at

share|improve this answer

Metaballs in 2D. A great raindrop example (3D) here, while this shows how metaballs look in motion. You can write this as a shader, if you want to use the GPU.

Alternatively, in late 80's / early 90's demos they sometimes just use transparent sprites and move them down the screen irrespective of one another. It doesn't look too bad, but it's not very realistic. However kudos to those guys back in the day for keeping things simple. I think there are some blendmodes on some platforms that do not add to each other's effect, i.e. they will just merge. This would look somewhat better, using the same approach.

share|improve this answer
That seems useful, but how do I simulate the streaks that droplets leave when they flow down, and how do I simulate the droplets merging into larger droplets that have enough mass to resist the surface tension and flow down? – skyuzo Nov 17 '11 at 21:51
Streaks are just smaller droplets, aren't they? Just as in real life, the streak is left behind, as erstwhile parts of the original droplet volume. If you need more volume than that, you can have each metaball growing in volume even as it is losing volume to smaller metaballs it is trailing behind itself. Presumably your mass is a function of the current metaball's diameter, and you do conditional logic based on that, to resist merges? Seems straightforward to me. You're not going to know anything for sure until you get stuck into the code. That's a fact of life! – Arcane Engineer Nov 17 '11 at 22:28
First link is dead. – Byte56 Jun 16 '15 at 3:53

I found a good paper related to this topic: "Realistic real-time rain rendering" by Rousseau, et. al. They survey several current techniques (with references) and describe a new algorithm and their GPU based implementation

share|improve this answer
Perhaps you could add a link to it for easy access. :) – Richard Marskell - Drackir Nov 17 '11 at 13:57
Google turns up a number of hits, including:… – amb Nov 17 '11 at 14:29
Sorry, maybe my question was unclear. I'm specifically looking for simulating water sitting on a window due to surface tension and interactions related to surface tension and merging. I've edited my question. – skyuzo Nov 17 '11 at 21:56

Just maybe, you already spelled out your solution, it will just be your job to implement it.

Looking at what you've mentioned, you have the following things to implement:

  1. Metaballs in 2D
  2. Estimated mass from size of Metaball
  3. Estimated surface tension (a constant)
  4. Whether F=mg is enough to overcome the surface tension.

This will give you the desired effect; a more advanced implementation may then introduce metaballs which are "left behind" when the source metaball has a non-zero velocity. Then just apply a function that randomly generates impacting raindrops by throwing metaballs at your surface from a specified vector.

As for the performance of this, your on your own :P.

share|improve this answer

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.