Search Unity

What is the most efficient way to spawn a large number of particle effects, such as a bullet impact

Discussion in 'Visual Effect Graph' started by BigRookGames, Oct 21, 2020.

  1. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    330
    I have messed around with particle effects, VFX graph, ECS implementations, and am trying to figure out the most efficient way to spawn a large number of particle effects that contain transparent particles. Something like a bullet impact effect, 1000 times a second.

    The standard particle system doesn't seem to be viable because of the large number of batches it creates.

    With VFX graph, I noticed that once there are 100+ instances of the effect as different objects it noticeably affects CPU usage. I was wondering if it could be set up to have a single VFX graph instance, and when a new bullet impact is needed, manually set the position of the VFX graph and spawn 1 instance. This way it would only be using one VFX graph and the overhead of all the rendering of the transparent objects would be handled at once.

    Are there any technical hurdles of why this wouldn't be a viable solution?
     
  2. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    330
    I tried and compared performance between:
    Standard Particle System
    VFX Graph
    ECS custom animation setup

    I did not try to implement what I mentioned before, but I did not know that VFX graph converted to ECS, so I tried that and it actually works really well. I can spawn 100 or so bullet impacts in the same frame without dragging performance, so for now I think I will convert some more of my effects from the particle system to VFX Graph and continue on that path.

    I still am not certain why it is so expensive to run simple standard particle effects that are transparent. I understand what it's doing, just don't understand why the same effects can't be batched together.

    But for not the effects are working well!