Search Unity

Are mesh particles less performant than 2D particles?

Discussion in 'General Graphics' started by Cileb, Feb 19, 2019.

  1. Cileb

    Cileb

    Joined:
    Feb 20, 2018
    Posts:
    6
    I've been experimenting with low-poly meshes (3D shapes) in the shuriken particle system. Here's a breakdown of what I've been doing:
    • I'm working on some basic "fireball" projectiles. They each use a system that spawns around 5 icospheres per second, each sphere around 30 tris. Each particle has a lifetime of about a second.
    • Each system has a rigidbody, capsule collider, and a script. The script applies a force, handles collision logic, and destroys the game object after a few seconds if it hasn't collided (I'm hoping to set up object pooling later).
    • I tested it in play mode and kept spawning them to see if anything started chugging. I think it worked really well but honestly I don't know what to look for when it comes to performance metrics.
    • My scene is 140k tris and there's not much action going on at the moment--no NPCs nor enemies spawning their own projectiles.
    I like the stylized 3D look. But I think I can reproduce similar effects using 2D camera-facing billboards instead. If I do use 2D, that's less polygons to worry about which is a plus. My dilemma is, I've got me some sweet functional particle effects that I'm not sure I should (1) keep and use or (2) scrap and try the 2D approach.

    I have a couple questions. I know that geometry on things like player characters and environment pieces can impact performance. Is the same true for particles? Will performance noticeably suffer from particle poly count, given the poly count is reasonable? Are 2D sprites always more performant than 3D meshes? I'm worried that I'll pick one, make a whole bunch, and end up having to start over when I find that performance is poor or it just doesn't look right.
     
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    2D billboard particles are indeed faster than mesh particles.

    However, there are 2 ways of using mesh particles, one is REALLY slow, and the other, newer method, is much faster (only a bit slower than billboards, unless the mesh is complex)

    Option 1: Mesh particles using GPU Instancing. This is strongly recommended. To do it, use the built-in Standard/Particle Surface or Particle Unlit shaders, and ensure GPU Instancing is enabled in the Particle System Renderer Component. It requires Unity 2018.1. If you need a custom shader with instancing support, head here: https://docs.unity3d.com/Manual/PartSysInstancing.html

    Option 2: If you don't meet the criteria for option 1, you get a fully CPU-instancing approach, which is crazy slow by comparison.

    The "Saved by Batching" stat will tell you quite quickly which method you are using. It will be much higher if using Option 1.

    As always, profile everything and compare :)
     
    Cileb and karl_jones like this.
  3. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,300
    You could always have both options. The mesh version for close up and then switch to a lower quality version when further away. The LODGroup can help you with this https://docs.unity3d.com/ScriptReference/LODGroup.html

    An alternative would be to switch the render mode between mesh and billboard when crossing the LOD boundary. You could use a CullingGroup to get notifications from the LOD system
     
    Last edited: Feb 19, 2019
    Cileb likes this.