Rain -> Help with approach

Hi everybody

It’s probably best to put a little introduction before I start to pick your brains. My name is Elvar Orn Unnthorsson and I am a Bsc student in Reykjavik University here in Iceland. I am currently working on a project where I’m trying to create rain in a virtual environment. I tampered a little bit with Panda last semester where I created a simple world that had clouds, fog and miasma, created with the built in particle system and fog, and the user could change colors and position of those phenomenons in runtime.

This time I’m aiming a little bit higher.
My goal this time around is to create rain which includes numerous raindrops that can vary in size, shape, position etc. and on top of that be affected by things like wind (that would affect raindrops that it collides with). I would like this to be designed so (hopefully in the future) that this could be used by more engines that Panda3D.

What I looking for are suggestions of approaches I can use to accomplish my goals. I’m quite certain I need to use shaders which as of now I do not have any experience with but am interested in learning and using.

How should I create this rain? Should I use c++ or Python? Are there any tutorials or information that may be helpful? ect…

Hopefully I’ve explained this well enough for you to help me out.

Cheers from Iceland,
Elvar ‘ellioman’


Im not sure how much I can help out with your project but I’ll see what I can do. For what language you should use I recommend Python. I thought that C++ was a bit to complicated and found that Python was easy to use easy to learn. Also the manual says:

I am not sure how you would create the rain but but for how the rain works I think I can give some advice for things that would be needed.

-I would recommend looking through Panda’s physics engine documentation:http://www.panda3d.org/manual/index.php/Physics

-An understanding of Kinematics, Trig and vectors (i,j,k) so that the rain moves accurately with the wind that will be generated :http://en.wikipedia.org/wiki/Kinematics

Thats all I can think of for now. I hope that this was a little helpful in your quest to make rain. I hope that this project works out for you and I would like to see how you create this sytem.

Best of luck.

welcome elioman
have you already seen this thread?

Hey hobbit. Thanks for the info!
I’m wondering if it is wise to connect all the drops to the physics engine. Wouldn’t that be far to heavy to process when the raindrops reach some thousands?

Hey astelix.
I had not seen that, thanks!

Right now I’m basically stuck on what way it is best to create and maintain all the drops in my scene. Should I use a simple .egg file for each drop, attach a shader to it and keep 'em in a list? Should the drops be created in shaders (if so how?) ?

What do you guys consider the cheapest and (hopefully) most flexible way to create all the raindrops needed for my scene?

Wow, if you want to simulate rain by creating each rain drop individually, you’re up to a challenge.

If you are going to do that in a way that will be alterable, it would be best to use a geometry shader for that, I think - this gives you full control over how the rain moves.

If you are not going to use geometry shaders, though, you could create a vertex cloud consisting of point sprites. Or you could use separate models, but you’ll need to use the rigid boxy combiner then.

Usually, however, rain is done using large planes in front of the camera. Like this (dont mind how ugly this is, I made this many many moons ago):

How about just one plane?
Try putting this just in front of the camera:

Another way would be to place some cylinders (3 or 4) around the camera and putting the rain texture on them.

If I remember there was something about animating UVs somewhere around the forum that might be better (cheaper one the texture memory) then an actual animated texture.

But remember that my signature might be right.

Hopefully I’m not setting some unrealistic goals for this project hehe :wink:

Geometry shaders seem to be what I’m looking for although I’m having trouble finding info/articles/examples/tutorials on how to use and abuse them.

I found a great article about rain that published in may of this year. In it they defined a rain zone that specifies where is should be raining and then a container which includes the raindrops. (Picture)
In that article they used vertex, geometry and pixel shaders in two passes (Picture)

This looks a very interesting approach I’m willing to explore further but that obviosly requires that I can get my hands on some info about geometry shaders.

Do you know where I can find info that can help me? I’ve tried googling and looked on the Nvidia site but was unsuccessful (maybe I’m just a bad at searching)

The rain in your screenshots look quite interesting. Is there any chance I could see the source for it?

The problem with this approach is that I unable to control the drops.
This could however be helpful for add more subtle rain to the scene.
I will hang on to this, thanks.

Sure, email me if you’re interested and I’ll send you the source. It’s just a texture that uv-scrolls over some planes in front of the camera, though.