Rain effects

Hi all,

I’m currently trying to do rain effects in Panda. To give people the impression that objects are wet, I want to adjust the materials of all objects to have more specular etc.
How would I do this? Is it possible to assign a material to ‘render’ and will it propagate down, multiplying by the other settings or so (like textures)?
Or, would I need to iterate through render.findAllMaterials() and adjust each material’s values at the moment the rain starts?
Or would the best way to do this be to assign a specular texture to render?

Also, I’m sure one of you guys has rain in their games - how do you handle creating drops where the rain hits the objects? Of course animated drop objects could be precreated but the rain would get through moving objects.
I was thinking of using an orthographic depth render from the rain direction, but then I’d either need a geometry shader to generate the drops, or I’d need to send the texture to RAM every frame, which is slow.
I could also pregenerate drops somewhere in the world and position them in the vertex shader (using VTF to read out said depth buffer) but my concern is then transparency issues and render order.

Thanks in advance for any advice,


I’ve research a lot about rain ( it was the “end of year project” in my master year)

For All I know, nobody can really render rain ( like with particle effect).

Most of the time, three effect work simultaneously:

  • 1 grey filter/fog with ‘random’ grey line to simulate rainfall
  • random splash on puddle/other material.
  • like you said, a change in the material ( more specular and cube_map reflection with blur )

If you look at oblivion for example, it work exactly like that. ( which mean some strange result, like the ‘rain’ passing through bridge,… )

a great article about all these effects:
ati.amd.com/developer/eurographi … stival.pdf

As for panda3d implementation, I don’t think I know enough to help you, but I suppose that depend on the number of time your weather change:
If it’s often, a findAllMaterial will cost too much right ?

Hope it’s helped

Thanks for the link! It’s very helpful information. Cubemap render is not a bad idea, but it does require 6 extra renders every frame.

For the rain itself, I just use the ancient method of placing planes in the scene with a rain texture with animated UV coords, and a shader to offset the depth a bit randomly, but I think I’m going to use some sort of screenspace effect. (But that’s not really my biggest concern.)

I do want the rain to be unable to pass through objects though.

Hi pro-rsoft!
Probably you have already seen this, but just to make sure, here are links to good whitepaper about rain screen-effects: vterrain.org/Atmosphere/rain.html
I know Stalker: Clear Sky uses a kind of top-down map similar to shadowmap to mark surfaces that are supposed to become wet in rain and to display ripples. There is a video showing that effect, I will try to find it.

Thanks, but vTerrain is not really useful about rain. The only good paper it has does not apply to my situation since I want rain that really hits the floor, not just goes through the ground or is rendered in front of everything.

Using a shadow map to control transparency is not a bad idea though. If I use regular old shadow mapping instead of hardware shadow textures I can then keep the depth buffer.
My problem is: how to generate the drops when the rain hits the ground. I thought of doing this screen-space by projecting the shadow map into the scene and putting that in a separate render target but then I still have the same problem how I actually generate the drops efficiently without using geometry shaders.

Plus, I need to dynamically change a lot of materials. Is there a way to adjust all materials or would I need to iterate through all materials?

is depth-offset really neccessary? wont it be enough to paint the raindrops on the texture with slightly different size?
i mean depth for those drops will be only “visible” via the drop-size or when it intersects with geometry (which is rare since rain mostly consists of “nothing”)

You mean on the texture of the objects? Well that might work, but the shader of every object would become heavier.

No ideas for the material changing, would I need to iterate through all the materials to change them?

For changing materials… have you considered a post-processing effect… it sounds crazy until you realise that objects get more shiny because water is on them… i.e. its the same effect for all non-absorbent objects, as long as the rain is heavy enough. In other words given surface normals you could take all the lights and calculate a water derived specular effect from them and add it. That way you could even consider reducing the additive shine where surfaces face downwards, as they are not going to be as wet. For handling absorbent objects (Sand for instance;-) ), and other objects that will be less shiny for whatever reason a flat shaded render pass could be done with object colours set to modulate the strength of the effect.

pro_rsoft I dug the SylHar hint and found an in-deep paper that - if I got it - suit all your needs, check it out here - start from page 26
and here the cool video