Search Unity

Rain particles and flying through it

Discussion in 'General Graphics' started by VacaMarron, Apr 14, 2020.

  1. VacaMarron

    VacaMarron

    Joined:
    Apr 14, 2017
    Posts:
    5
    Hi there! Nice to meet you all :D

    Well, i have a "little" problem, currently i'm working on a flying game where the player has complete liberty of movement at really high velocity, and i'm trying to create a raining system for it using particles.

    The main problem is obviously that the map is just too big to just create a big cloud over everything and make the particles drop, it kills the performance. So, the logical approach is to create a small cloud that follows the player so it looks like it's raining, and this is where i get lost.

    If this following particle system spawns the particles in local space, the rain looks awfull because it is obvious it is following the player, BUT if i make it in world space, the player can go SO FAST that the particles just can catch up with him (It leaves the spawned particles behind and the new ones stay behind, and if i increase the spawn ratio/number of particles then the perfomance can be killed again and when the player stops there would be too much on the screen).

    If been trying to make a script which modifies the Simulatio Speed and also the Velocity Over Time trying to simulate all this, but i cant find a good way to do it so maybe this is not the correct approach neither.

    So, any ideas?
    Thanks in advance to anyone answering ^-^

    PS: Sorry for making a thread, i didn't notice the difference between Post and Thread until it was too late :S
     
    Last edited: Apr 14, 2020
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    The most common trick I know of to do this is by having a box around the top/front of the camera. Spawn falling particles in world space in the box. If a particle leaves the box due to camera movement, or falls below the bottom of the box, teleport it to the opposite side of the box.

    If you're in 2018.4, this would be achieved by using Get/SetParticles in a script. But it might be slower than you're hoping for, performance-wise.
    If you're in 2019.3, you can write a Burst C# job to do it. Which would be very efficient. (See https://forum.unity.com/threads/particle-system-c-job-system-support.529284/ and https://docs.unity3d.com/Manual/particle-system-job-system-integration.html)
     
    Last edited: Apr 15, 2020
    Peter77 likes this.
  3. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    @VacaMarron
    Check out the advice that Richard told you above.

    Another idea, is to make an animated texture with an animation of rain falling, and plaster it onto the camera object. If you do it correctly, it'll look like you're flying through an area filled with rain, and rain falling behind you too. Or you could use, both particles and an animated rain texture, to accomplish this effect.
     
    Last edited: May 27, 2020