Search Unity

Generating multiple (separate) particle strips each frame

Discussion in 'Visual Effect Graph' started by andybak, Jan 2, 2021.

  1. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    I've been stuck on this for nearly two days now.

    The docs manage to be overly detailed in some places but missing huge chunks. I get the feeling they were never properly updated when particle strips were added.

    A simplified version of what I want to achieve is something like the following.

    1. On each frame I generate several lists of positions. Each one represents a single strip
    2. The graph creates a separate strip for each list of positions.

    Whatever happens I can't seem to get more than one strip to generate on a single frame. I always end up with a single joined strip - rather than separate strips.

    I've rather lost track of everything I've tried. I've used the heads and tails approach that is one of the example systems. I've used an approach similar to the screenshot on this page: https://docs.unity3d.com/Packages/c.../manual/Block-IncrementStripIndexOnStart.html

    One particular thing I'm unclear on - when you trigger an "Initialize Particle Strip" context - does it generate a strip with n particles or a single particle? If I send in a single burst with a count of 3 is that 3 strips or 3 particles?

    When you have a single burst spawn feeding into a second single burst spawn do the counts multiply? i.e. a spawn of 3 feeding into a spawn of 4 feeding into an "initialize particle strip" context - does that give me 12 strips? Or 12 particles? How do I ensure each particle is assigned the correct strip index?

    And finally - it's been asked elsewhere - what's the difference between spawnIndexInStrip and particleIndexInStrip?
     
    Last edited: Jan 5, 2021
  2. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    Hi,

    I thought I'd simplify my main question in the hope of getting a response.

    Has anyone managed to generate more than one separate ribbon in a single frame?

    • I can emit multiple connected particles on the same frame. (all particles belong to the same strip)
    • I can emit multiple unconnected particles on the same frame. (not using strips)
    • But I can't emit multiple particles on the same frame where some are on one strip and some are on another strip.
     
  3. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hey @andybak ,

    You can increment the Strip Index in Initialize to get separate strips. You can do something like this:


    Hope this helps!
     

    Attached Files:

    florianhanke likes this.
  4. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    Yeah. That was one of the first things I tried. I'll post a graph when I get back to my desk. I might be doing something weird to mess it up.

    Are there any working examples you're aware of?
     
  5. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Here's the example I shared before, maybe it can help.

    If it's not working, the only other thing I can think of is you might be on an earlier version, as strips had some improvements/bugfixes done to them.
     
  6. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    Thanks Vlad. That was really helpful. It was enough to convince me that it was me that was doing something wrong. Lo and behold part of my problem was an off by one error (I'm drawing closed quadilaterals and I was counting gaps instead of fence-posts)

    I've got a bit further now. Thanks again.
     
    VladVNeykov likes this.