views:

175

answers:

5

What is the principle behind creating rain effect or water drops regardless of using any particular language. I've seen a few impressive rain and water effects done in Flash, but how does it actually work?

Rain Effect Example

Rain Drop Water Effect Example

+1  A: 

They probably use particle effects mostly.

samoz
a particle system would be overkill in this situation, especially if you wanted a large visible field of rain. much simpler solutions exist, as suggested below.
tenpn
+3  A: 

Here's a paper by Mandelbrot and Lovejoy which is one of the most cited works on developing fractal models to represent rain.

Jory
Can't get the link to work :( Saying something about a session cookie :)
cwap
Should be fixed now.
Jory
Page not found :(
Mark
+1  A: 

An old school way that is dirt cheap is to use palette cycling. Basically, you setup a ramp of colors and move one color into the next in fixed intervals. The moving colors give the illusion of motion. I've worked on games where rain, wind, snow, waterfalls, fire, etc. have all been animated using palette cycling. It's a dying art, but it still works. :)

Michael Dorgan
+1  A: 

The second one (Rain Drop Water Effect Example) is probably done with a wave equation simulator

andand
+1  A: 

You are asking a question as if the two examples were related, but you actually have

1) simulating drops of rain as seen in air (drop trails; simple but the realism depends on lighting very much)

for this you to simulate following events:

for each time step:
    create new drops
    move existing drops vertically down
    remove (or/and animate) the drops hitting the ground

as pointed in other answers new drops (size and position) can be created with various algorithms. as for speed they move with constant speed. finally to show your trails you need to look at simple projections

2) simulating splash waves (water simulation, and in the example a reflective surface is shown)

For this you only need to know where the drops fall and how big they are, the rest is wave propagation. However that's only really visible if there is a reflection and that can be a bit tricky.

NOTES: There are many things that determines realism, but mostly it boils down to detail. For example rain is usually seen clearly only in strange lighting conditions - close to lamps or on high contrast background. Otherwise it is quite bleak.

Also the details in interaction - splashing on surfaces that it hits, which can leave bubbles (if close enough to notice), or create waves.

Another example - if you look at this tutorial, which is not really realistic, but it does illustrate one point, you will see that even though the rain looks more like a snow it exposes the 'flatness' of your first example (which has absolutely no depth).

So, it is all about detail.

Try to model what you have in terms of events that you have to simulate and then solve simulating each one separately - for example using fractals for seeding rain might be an overkill, but if you nicely model your work you start with random seeding and latter substitute with more accurate/complex methods.

Unreason