Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

scaling up particles leads to massive performance loss

Discussion in 'General Discussion' started by Mike01923, May 13, 2022.

  1. Mike01923

    Mike01923

    Joined:
    Jun 19, 2015
    Posts:
    190
    I have around ~100 particle systems active in the scene. When set scale to 1, profiler shows 15ms / frame on mobile. When changing the scale to 2x, it's 50-60ms / frame. Doubling the particle systems at 1x scale doesn't lead to such a dramatic performance decrease as scaling up does.

    So what is happening here? Why is increasing the scale of particle systems to 2x + leading to such dramatic performance loss? Should you not be increasing particle scaling that much?
     
  2. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    angrypenguin and Mike01923 like this.
  3. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    1,463
    There are three main factors (like literal multiplicators) that result in the rendering-time required:
    - Draw calls (how many different meshes)
    - Vertices
    - Rendered pixels
    Draw calls for 2D particles are luckily one per particle-system (but otherwise unless you use gpu instancing, it's one per 3D mesh).
    The more vertices (and thus triangles) the more often the GPU has to reset its rendering matrix (think that's what it's called in this context, not sure) which entails VRAM access.
    Finally the larger the triangles on the screen (even if they are covered!), the more pixels have to be actually rasterized.

    Edit: Texture resolution is also a factor.
     
  4. Mike01923

    Mike01923

    Joined:
    Jun 19, 2015
    Posts:
    190
    Thanks for putting me on the right track, I have a lot of glow particles which seems to be the culprit. I changed all the glow particles to just be an animated blurred circle sprite and that significantly improved performance.
     
  5. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,509
    As the others are already getting at, if the particles were already the slowest thing in your scene then ~15ms to 50~60ms is exactly what I'd expect from doubling their scale. That doubles both the width and the height, so it covers four times as many pixels, and 15 x 4 = 60.

    Every GPU has what's known as a "fill rate", which is basically how many simple pixels it can draw each frame. Drawing to pixels multiple times eats up more fill rate, and anything which is transparent requires writing to a pixel more than once. Particles are a common culprit for chewing through oodles of fill rate because it's easy to end up with loads of large, overlapping sprites, thus writing to many pixels many times each.

    A few considerations with particle effects:
    - Have as few particles as you can.
    - Have each particle be as small you can.
    - Have the shader (Material) on your particles be as simple as possible.
     
    Mike01923 likes this.