Search Unity

Particles strips from mesh - order issue

Discussion in 'Visual Effect Graph' started by cAyouMontreal, Feb 25, 2020.

  1. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    Hey VFXGraph community!
    I would like to spawn for each vertex in my mesh a particle, and use particle strips mode to create a strip from it. The big issue I have is the order of the particle, and it makes me crazy haha :D
    So, in Blender I made a Bezier curve, using an extrude I was able to have a mesh with vertex in the correct order.

    nobueno_01.png

    Then I created a point cache with this mesh, in vertex mode with sequential order selected. I would assume at this point that the point cache is the same order as are the vertex on blender.

    After that I spawn a particle strip using "Set Position From Map" node, set with sequential order as well.

    The amount of particle spawned are the same as the number of vertex (386).
    nobueno_02.png

    And the result is random:
    nobueno_03.png
    nobueno_04.png

    I tried to remove mesh compression and optimization, but it didn't change anything. The fact that the result is random makes me think that it's not an issue from the mesh but when the id is read by vfxgraph.

    Any idea? Thank you!

    Edit: looks like not totally random, at least the index where the line breaks are most of the time the same, they just connect to another one each time.
     
  2. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    240
    Hi,

    particleId is used with sequential sampling mode and it is not deterministic with the index in strip. (See this post for more details)

    What you need is to use sampling mode per index in the Set Attribute From Map block and plug the spawnIndexInStrip attribute into the index port.

    We're aware that this non deterministic behaviour is confusing, and this is something we're going to work on in the future. Strip feature is still being built and experimental.
     
  3. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    I also tried to use the spawnIndexInStrip in Index mode for the Set Position From Map, no luck.
     
  4. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    240
    Hmm in that case this is a bug. Which version are you using?
     
  5. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    Thanks for your reaaaallly quick answer! The real node name is: "Get Attribute: particleIndexInStrip" with the set position from map set to index sample mode.

    It bothered my for hours...Thank you again!
     
  6. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    quick side note: spawnIndex exists, but not spawnIndexInStrip.
     
  7. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    240
    Oh right spawnIndexInStrip will come in the next version. particleIndexInStrip works as well and is actually the correct one to use (and equivalent when you spawn particles in an empty strip)
     
    cAyouMontreal likes this.
unityunity