Download

Best approach to create optimized rain?

Hey,
I would like to ask, what’s the best approach to create a rain effect over a huge area?

My requirements are:

  • rain should look like it really takes up space (e.g. drops should be visible in a valley while looking down from a mountain)
  • drops should interact with at least some of the other actors (certain meshes, wind, puddles…)
  • effect should be applicable to huge areas (talking kilometres squared)
  • solution should perform smoothly

I am confused about what’s the best approach here.
The effect can be made as a Niagara particle system, maybe some sort of static animation,…
The interactions can be computed at runtime, prebaked, placed manually,…

I would prefer to make the effect flexible, maintainable and easy to iterate over, so Niagara looks like the best option.

Considering all of the above, is it a best practice to create it as a Niagara effect?
If so, how many particles would you recommend?
Can UE even handle it?

Thank you :slight_smile:

One thing niagara is actually great at (at least before chaos that is) is figuring out particles and collisions.

Simulating rain with droplets and collision is actually not very taxing on any half decent GPU.

With a little work, the droplets can also be told what to do depending on the type of surface they encounter (in water they would just destroy, on hard surface of any kind they’d possibly split/bounce).

Keep the effect constrained to the player’s visible field. Let’s say 10m ?
Test with 1000, 10,000 and 100,000 particles to bench performance.

Above all, do not make the material of the droplets transparent. It’s absolutely fine with just a simple mask. Possibly you can stretch them vertically (towards the z) depending on their speed.

Do not create the particles so up above that the emitter has to spawn for a minute before you see results either. 1 player height above is usually enough.

Last but not least.
Dropping on water surfaces you are better off creating a special shader.
To do this, usually you make a radial gradient so that you can run a sinen function over the image to generate the ripple s at different intervals - surely there’s a tutorial out there on this.
The downside is that it isn’t actually coupled to the hit point of the droplet.

The alternative to that would be more performance taxing - spawn a flat mesh that creates the ripple.
This is very error prone, particularly at the edges of water where the ripple will spawn and be visible onto non water like geometry.
I suppose you could mask it out via distance to nearest surface maybe, if the water sheet doesn’t give a false positive.

The problem becomes performance at that point.
Bench and simplify things as much as possible, always.

And do keep in mind that with chaos, it just may be impossible to do 100k particles Plus whatever other situations the game needs.
(Also note that no dev on here or elsewhere as ever acknowledged the immense performance drop that chaos has brought over phisX so far…)

1 Like