Search Unity

Particle Strip based trail has holes/discontinuities for no clear reason.

Discussion in 'Visual Effect Graph' started by lczyzycki7lvls, Jul 1, 2021.

  1. lczyzycki7lvls

    lczyzycki7lvls

    Joined:
    Sep 10, 2018
    Posts:
    8
    Hi,

    I'm trying to utilize VFX Graph to create a simple trail following an object, as a part of an effect.

    For current test purposes, I have an extremely simple setup, with some coloring added for debug visualization.
    upload_2021-7-1_23-11-38.png

    For the most part, it works as expected, with a trail of evenly spaced quads being produced. However, there are discontinuities appearing in the trail, in a stably reproducible manner. The trail is connected to a on object that flies through a game world driven by a simple rigidbody with given starting velocity and the result can be seen on this screenshot:
    upload_2021-7-1_23-18-5.png

    So the mesh looks pretty clean and the color is as expected, but there is a gap of what looks like two quads of size and I struggle to find an explanation, not to mention a solution, for this issue.

    My main work environment is Unity 2020.3.12 with VFX Graph 10.5.1, though I tested it also with 2021.1.13 + 11.0.0 with the same result. I'm using the URP, if it's of any relevance to this problem.

    I tried to uncheck "Fixed Delta Time" on the effect, to no visible change.

    I would appreciate any info about what I'm doing wrong here and what would be the direction to fix it.
     
  2. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    326
    Hi!

    It's probably because some frames issue more than 1 particle, so you've got particles overlapping in the trail which mess up the tangent computation. You can avoid that by toggling "clamp to one" in the Spawn Over Distance block.

    We have plans to improve/ease the way to do smooth trails in the future.
     
    Last edited: Jul 2, 2021
    Vita- likes this.
  3. lczyzycki7lvls

    lczyzycki7lvls

    Joined:
    Sep 10, 2018
    Posts:
    8
    Hi Julien,

    thank you for the quick reply.

    I figured that since the issue is caused by more than one particle spawning in the same place, I can try to space them out retroactively. I ended up with a solution that seems to do the job:
    upload_2021-7-2_13-23-36.png

    What baffles me here is that I expected an index needed in this context to either be spawnIndex (Source) or spawnIndexInStrip (Current), but using either of those resulted in the trail breaking in a different way. Meanwhile, using spawnIndex (Current) seems to do the trick. Can you perhaps give me a bit of context for how those attributes behave and differ from each other? Because unfortunately the documentation seems to be of little help on the subject.
     
    laurentlavigne likes this.
  4. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    wow that's super clean solution, and works in versions of vfx graph that don't have clamp to 1