0
\$\begingroup\$

I'm using a rain particle system and using cone a radius to scale it.

My question is what is the best way to make the rain particle covering the entire map?

And does increasing the rate over time affect performance? And is it necessary to increase it when increasing the radius?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Recommended reading: RPS article How Did They Do... Satellite Reign's Rain?. That aside, it's hard to give answers about performance without knowing more & most of those details will be discovered more effectively by you trying stuff & profiling your game than asking devs who've never seen your project. If you run into something more specific, someone might be able to help, but as is, there's not much to go off of here. \$\endgroup\$
    – Pikalek
    Commented Jul 24, 2023 at 3:56

1 Answer 1

1
\$\begingroup\$

The larger the area of your particle system, the more particles you'll need to have alive in that volume at any given time for it to look appropriately dense/full.

Every one of those particles has a cost.

Each raindrop costs processing time to animate it each frame, bandwidth to upload its vertices for rendering, vertex shading time to transform it to the screen (even the ones off-screen need to be transformed to find out whether they could be on-screen), and rasterization, shading, and blending costs for the few that actually end up visible on screen.

You'll also pay a lot of overdraw this way. If you want to render a heavy sleet with dense sheets of rain out into the distance, drawing it one raindrop at a time means you end up drawing over the same pixels again and again, adding very little visible difference with each pass, and devouring your GPU's fill rate budget.

Instead, it's helpful to use a camera-centric approach. The player only sees raindrops near the camera, so let's only spend time simulating and drawing those ones

Have a small-ish particle system positioned nearby in front of the camera, and co-moving with it, so that it always fills the field of view. Simulate the particles in world space, so that you can still walk past them as they fall, rather than the rain seeming to stay glued to you as you move.

If your movement speed is fast, you may need to teleport trailing particles from behind you back in front of you to keep the density consistent - otherwise you can outrun the rain: the emitter hasn't had enough time to drop rain in the new region you've moved into. I had to do this to simulate space dust for a fast-moving spaceship, poking into the particle system's particle buffer to reposition them manually. Your raindrop shader can fade drops to transparent just before this repositioning distance, so the player never sees rain just pop in/out of existence this way.

You can render more distant rain with a second particle system farther out with a simpler shader, or a full-screen quad that uses an animated shader effect to imitate dense, distant rain with a single shading and blending pass, instead of transforming and layering thousands of individual raindrop meshes. This makes it easier to dial the weather all the way up to hurricane intensity where visibility drops off, without murdering your framerate. Instead it acts more like a textured screenspace fog, with roughly constant rendering cost regardless of droplet density or draw distance. It won't parallax exactly correctly, but that's what the nearby particle rain is for, to sell the illusion where the player can see it best.

Games will often use a similar screen-space effect to render very close raindrops / ones splashing on the camera itself (if having a "physical" camera is part of your game's aesthetic). Rendering close, medium, and far rain effects separately like this helps you focus each layer's effects on what looks best at that distance, so you don't pay for beautiful refractions that are only visible up-close when you're rendering "filler" sleet a city block away.

You can see in this Reddit post that Starfield uses this layered local particles trick: there's a sparse rain within a span of a few meters of the player, and a dense rain just around their head (where the game camera usually sits):

Reddit post from r/gaming showing Starfield uses this trick

\$\endgroup\$

You must log in to answer this question.