Search Unity

Should I allow fallback to Shuriken particles for lower-end, GPU-bound systems?

Discussion in 'Visual Effect Graph' started by dgoyette, May 17, 2020.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    I've been holding off on implementing VFX Graph in my HDRP project until now, but I'm about to begin the process of "upgrading" most/all of my existing Shuriken particle effects with improved VFX Graph versions. I realize my question is probably hard to answer, as it depends on many factors. But I was hoping that people might have a general intuition.

    In my small amount of VFX Graph use, I have not yet developed an intuition on how expensive these effects are compared to similar Shuriken effects. I was considering keeping all of my existing Shuriken effects, and adding an option in my game to use the "Old" or "New" particle effects. But I would only do this if using the old effects was likely to represent a performance improvement to a reasonable set of users.

    Again, there's no way anyway can tell me whether a given VFX Graph will perform better than a given Shuriken effect. However, in general, the users with the most difficulty running my game are those who are GPU bound. With VFX Graph being GPU heavy, my intuition is that replacing a Shuriken effect with a theoretically more performance VFX Graph could result in performance loss for GPU-Bound users.

    So I wondered what people thought of this. I realize that Shurken effects have to hit the GPU to some degree, so it's not like the GPU isn't working to render Shuriken effects. I just don't have a good way to knowing/predicting whether even modest VFX Graph effects will tax the GPU more.

    So, does my idea of allowing users to fall back on Shuriken particles make any sense?
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    If you're using HDRP there are probably no scenarios where using Shuriken makes sense unless you want better Physx collider integration.

    For mobile and VR, these platforms are definitely interesting choices to go with Shuriken, or perhaps your particle needs are simple.
     
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    I'm using HDRP, targetting PC/Mac, and eventually (probably) XBox and PS4. However, I'm trying to be accommodating to players with fairly old hardware, to make sure the game is reasonably playable even on integrated graphics, by allowing visual quality to be adjusted to improve performance. I wasn't sure if this would be another case where I'd want to keep the old particles available, on the assumption that they might perform better on the low-end hardware. I guess I probably can't avoid trying to do a comparison on low-end hardware, and see whether it matters.
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    I did some basic testing. I never really know if trying to do simple tests is particularly useful, but I wanted to get a baseline of some metrics on VFX Graph vs Shuriken on two different systems, one with a good GPU, and one with a bad GPU. I created a simple test project, just a brand new HDRP 7.3.1 project, without changing anything in the project settings other than disabling VSync.

    I'll see if I do more of these, but the basic idea was to create a test scene that instantiated Shuriken or VFX Graph objects, allowing me to create more and more of them, and increase the Emission of each, to see how things performed as more particles were rendered. The scene also includes an FPS meter to get a rough sense of performance:

    upload_2020-5-17_15-23-48.png

    Both the Shuriken and VFX Graph attempt to do the same thing: A very simple "smoke" effect using a flipbook animation. Basically, just a bit of initial random velocity, some negative gravity, and a Color over Time to fade the smoke on the way in and out. The controls let me instantiate one more Shuriken particle system or one more VFX graph at a time, and other controls let me increase each system's Emission by 50% at a time to effectively increase the total number of particles being rendered.

    Now, given how trivial this kind of a system is, it may be a bad comparison. It's possible that VFX graph really shines as things get more complex, and there isn't a lot of performance to eke out from such a simple setup. But one of my questions was whether it's worth converting some of my simple Shuriken effects over to VFX Graph, even if they already look reasonably good. So it's reasonable to know how things compare with really simple systems.

    I did a few tests to gauge the impact of lots of systems with low emission, and a small number of systems with high emission. Here are the results, using a good GPU (GTX 1070), and a bad GPU (Integrated Graphics):

    upload_2020-5-17_16-1-29.png

    The basic idea is that I took metrics with different numbers of particle systems and with different Emission rates. So, 100@20 here means 100 systems with each having an Emission rate of 20.

    Analysis: Not surprisingly, with a small number of systems and low emission, there's not much difference in performance for the 1070. For the two extreme tests (100 systems @ 20 Emission, and 1 system @ 29000 emission), Shuriken massively outperformed on the 100 system test (240 FPS vs 37 FPS), while VFX graph modestly outperformed on the 29000 emission test (33 FPS vs 22 FPS). The main difference was that, on the whole, the VFX graph version used much less CPU, but more GPU, more or less what I might have expected. FPS-wise, VFX graph usually won, modestly. But that 100 system test was really surprising. I'm not sure what kind of magic Shuriken is doing there.

    Switching to the integrated GPU, Shuriken basically won in all cases. The GPU stayed maxed out at all times, and Shuriken used more CPU than VFX graph, but it maintained better FPS. This makes sense, since VFX Graph's gains come from leveraging the GPU, which was already maxed out just trying to render an HDRP scene on a bad graphics card. So, there basically wasn't any GPU "left over" for VFX to shine. Worth noting is that on the 100 system test, the application would lock up as I increased the system count to 100 VFX graphs. I don't know why, but at a certain number of systems (not always the same) the screen just stopped updating, and I had to kill the app.

    Overall Analysis: This work was done to answer the question of whether it's reasonable to keep my existing Shuriken systems in my project as an optional feature, where players can elect to use them on lower-end systems. It seems that, at least for this particle system, that appears to be a reasonable approach. On integrated graphics, Shuriken significantly outperformed VFX graph. That's fine; VFX Graph wasn't designed for garbage GPUs. But what this tells me is that Shuriken seems like a better choice for people who are already GPU-bound, and it's reasonable to keep these Shuriken systems around as an optional way for certain users to achieve better performance. I'm happy to have my findings critiqued, if this seems like a pointless or misleading test.


    Aside: I'm not sure why my integrated GPU is actually doing a lot of work while I'm running this app on the 1070. But it was always using around 40% of the integrated GPU. Maybe it was being used just to render the rest of Windows? Maybe VFX Graph was using it? Not really sure what to make of that. Usually my integrated GPU is idle.