Syncing VFXgraph playback with Alembic animation

I’m working on a project where I am using an Alembic cached animation and VFX graph effects with a timeline to sequence the animation. Is there a way to update vfx graph particles to be controlled by the game time/timeline time control instead of just being activated by OnPlay events. Or, to put it another way, to control the exact frame the vfx graph is at relative to a start time, like an animation clip? I understand that’s not really how VFXgraph works with the timeline, but is there a way to control the vfx graph update loop? I have only been using VFXgraph for so long, and I’m not aware of a way to control the update loops synchronization with game time.

Hi @Mindtoast451 ,
I’m not sure how your effect is structured, so the following might or might not work.
In some cases you can make your own “custom time” (really, just an exposed float which you can then animate in timeline) and use it to drive the changes in your graph: modify values, lerp between colors, etc. This approach works fairly well for changed you are making in the Output (modifying positions, sizes, setting particles as alive/not alive, etc.), but will not work well for changes in Update (modifying positions, working with collisions, triggers/GPU events, etc.).

Since Outputs receive their particle attribute values from Update each frame, you are only modifying them for that frame, which means you can do things in Outputs like toggle them off (set alive to false) and later turn them back on (set alive to true) without actually killing the particles like you would if you do the same in Update.

In this example, I have particles spawned in a shape in Initialize and am adding noise to the position in Output, which is connected to an exposed float (which can be animated in timeline outside of your graph):

Alternatively, you can do something similar, but with the Update loop by exposing a float which will be your custom deltaTime. For this to work, you need to first disable the automatic updating of position and/or rotation in your Update:

Particle positions in Update change based on:
position += velocity * deltaTime;
And their rotations change based on:

angleY += angularVelocityY * deltaTime;
angleZ += angularVelocityZ * deltaTime;```
So you can do this manually like this:
![](https://forum.unity.com/attachments/upload_2021-9-14_11-32-17-png.922777/?temp_hash=663d9d517007b646db3e7237cc5766a9)

Then all you have to do is feed your own deltaTime to the exposed float to update at your own desired rate (i.e. from timeline).

Hope some of this might help :)

![7494248--922763--3WvAyy9Nun.gif|949x523](upload://evd0DLJMdsCNkq7g0h7sJfcr5nH.gif)
![7494248--922772--upload_2021-9-14_11-27-1.png|598x187](upload://kP14hHRML7asPdsAaiWAIZR48oC.png)
![7494248--922777--upload_2021-9-14_11-32-17.png|1216x391](upload://htaPLADMmPhEAk8Xd0fY7cbE4ay.png)
1 Like

It’s gonna be cumbersome, but a timeline integration would be in the lines of:
1)Make a VFXGraph with a custom double for time.
2) Make a custom timeline track that binds to the VisualEffect that takes the timeline time and pushes in the custom time parameter.

1 Like

Thanks, I’m going to give that a try. That sounds like it will do what I want it to do. The effect I’m working on is a planetary collision. I have the planet geometry cached as an alembic animation and I’m trying to get an impact shockwave VFX effect to sync with the impact of the planetoid bodies. The VFX were lagging behind while the alembic animation keeps playing at a fixed frame rate.