Some help with Vfx Graph, managing alive between trail and particle

Hi everyone,

I have been trying for a while to do something with vfx graph which I though would not be that difficult so I believe I am utterly not seeing an obvious solution here and very much like to ask for some help.

I want to spawn a particle, have it follow the emitter transform / a specific transform position.
From the particle’s position create a trail / ribbon.
Have the particle die in order to stop the trail from growing further (preferably through an event, otherwise a bool property works too I already figured out)
Then NOT have the trail age and destroy from oldest vertex but instead use a dissolve shader to remove the entire trail at once and then after that is done kill the trail particles.

This sounds like I want to to use the main particles alive state to determine if I should subtract delta time from a per strip attribute (which I can use as alpha in the shader).
But no method I tried so far gives me a per strip attribute NOR getting alive from the main particle works at all.

Help is much appreciated, thanks so much in advance of any input

Hi!

I’m not sure I got it right, but I’ll send something that might help? I’m assuming you want one single trail, which makes it easy to start at least.

This might not be the best way to do this, but it’s late and I’m wondering if this is even what you wanted to achieve. I also don’t know how much experience you have with VFX Graph so I’ll just explain everything.

I’ve added 3 parameters, one to control the trail’s dissolve amount, and two to control the alive state of the head and trail. This can be done in lots of other ways (like killing the trail when dissolve eaches 1 etcetc).

image

So you have your main ‘head’ particle, this follows the gameobject with the Visual Effect component on it (that’s why it’s using the Local space).
Lifetime isn’t set, meaning that particle doesn’t die unless we kill it.
Alive state is set on update because we want to continuously update that state in case it changes. You’d want to set it to false to stop creating the trail.
That particle triggers a GPU event over time to spawn the trail.

Trail is using the World space, because I’m moving the gameobject with the Visual Effect component around and want the trail to stay in place.
Trails position is set to the source’s (head) position.

Alive state same as head, updated continuously, you’d set that to false to kill the trail after it was dissolved.
Lifetime isn’t set, meaning that particle doesn’t die unless we kill it.
The output uses a custom shader graph, it’s just a simple step to have some kind of dissolve to show.

I’m killing the main head first, it doesn’t spawn the trail, then dissolve the trail, then kill trail

vfxgraphhelp

3 Likes

@Rensei

Oh hey, I am sooo sorry for not replying for so long. Apparently I spent the last two months lurking in the forum without being logged in…

Your proposed solution already does go a long way. Thank you very much.
However I ended up doing it a bit differently because of course I needed more than one trail :sweat_smile:. By now I figured out there are probably even more (and better) ways to pull that off but I haven’t gotten around testing those.

What I did was to use an exposed alive ID integer property which I increment each time I need to start a new trail. Leading / Head particles which don’t have the same ID get killed. In particle strip initialize I write that particle id to a custom attribute on that strip (in order to get a reliable strip index), the strip particles are only aged if the activeId is no longer equal to that stored customId. Therefore the entire strip stays alive until the head particle is gone :slight_smile:

1 Like