Search Unity

VFX questions regarding initial spawning and lifetimes

Discussion in 'Visual Effect Graph' started by TheCelt, Oct 5, 2020.

  1. TheCelt

    TheCelt

    Joined:
    Feb 27, 2013
    Posts:
    742
    Hello

    1) How do you set the particles to have an initial random position in a hemisphere rather than just a sphere?

    2) Is there any way to use a seed for the random generation of positions so you get the same result each time?

    3) Regarding lifetimes, is there anyway to set infinite lifetime, i want my particles to be static and never come to an end.
     
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi @PixelizedPlayer ,

    You can make a hemisphere by controlling the Arc value:


    The VFX Graph is already using a seed, but it's set by default to be random. If that's not what you want, disable the Visual Effect component's Reseed on play checkbox in the inspector and then the randomness of the effect will be the same every time you play it:


    Yes, just don't specify any lifetime in your graph:


    Depending on what you want to do, you can also add lifetime, but then select the Update context and in the inspector disable Age particles (the age attribute won't automatically change) or Reap particles (particles will age, but if their age exceeds their lifetime, they won't be automatically killed).


    If you do any of these, you probably would want to remove any over-lifetime logic in your graph (i.e. size over lifetime) as they will no longer give you the desired result.

    Hope this helps!
     

    Attached Files:

  3. techtonicplates

    techtonicplates

    Joined:
    Jan 1, 2018
    Posts:
    5
    So I have a question on the opposite spectrum. I'm trying NOT to reseed after the lifetime ends. Reseed on play did the trick for play only. Age/Reap particles doesn't let me have a lifetime. But I just want them to regenerate exactly how they are based on their particle ID sampled into perlin noise. I'm assuming when their life ends, the particle id regenerates again from 0-100 if I have capacity set to 100? Or do I have that wrong? I thought it would work with Periodic Burst the same way it does with Single Burst, but it'll sample a different noise so I'm guessing the particle index is somehow changing. The image below is with constant spawn rate to better visualize the issue I'm having (on Unity 2021.2.18).Thanks!
    upload_2022-4-28_11-42-31.png
     
  4. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi, this is not the case, particleID gets continuously incremented when a new particle gets born.

    So if you have this setup:

    You will get different results as the particleID will go beyond 100:


    However, if you add a modulo operator, you will loop the ID number within the specified range:

    Which as a result will give you the same values each time:


    Depending on what you are trying to do, you can also use a different input from the particleID. For example, if the position is the same every time, you can just use that to sample the noise, without having to worry about what the particle ID is.
     

    Attached Files:

  5. techtonicplates

    techtonicplates

    Joined:
    Jan 1, 2018
    Posts:
    5
    Thank you for the explanation, good to confirm the incrementing particle id. The mod definitely did the trick!
     
    VladVNeykov likes this.