Search Unity

Spawn rate vs Capacity suggested settings and relationship

Discussion in 'VFX Toolbox' started by eco_bach, Aug 18, 2019.

  1. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,352
    Any VFX Graph experts care to share their feedback. Is there a 'best practice' or general guideline when setting the Capacity vs Spawn Rate when creating a VFX graph?
    ie
    Should your Capacity always be larger than the Spawn rate and if so, by how much?
     
  2. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    548
    From what I understand this is how it is - also no expert

    Spawn Rate - How many particles should I spawn (From set functionality) eg Constant Spawn - constantly spawing that amount of particles

    Capacity - How many of these spawned particles I'll hold or can hold before they die and I spawn more

    So yea, Capacity will be higher but that amount depends on what you want and not a set value to recommend.
     
  3. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,352
    Thanks. Yes in the sample files this is explained in detail in the sticky notes. The goal is maximum compute efficiency.

    Capacity = Spawn rate X max Lifetime

    but should be lower when spawning very large numbers of particles.

    From the Unity Logo demo

    To enable maximum performance, Capacity is fixed. Also, the capacity needs to fit the actual count of living particles to maximize compute efficiency (alive count/capacity)

    Here we spawn 250k particles per second, with an expected lifetime between 2.5s and 3.5s

    The maximum expected count would be 250k*3.5 = 875k but it's not likely at this amounts of particles.

    Here, we took the median lifetime as a reference (2.5+3.5)/2 = 3.0 so we ended up using a capacity of 750k

    In some rare cases some particles could not be spawned but for these amounts it's barely noticeable, and the compute efficiency is nearly perfect.
     
    Last edited: Aug 20, 2019