I’m currently testing the VFX Graph system for the first time, trying to create some particle fireworks like for example in Brackeys nice Youtube tutorial.
I can successfully spawn fireworks explosions at the end of the lifetime of the main “rocket” particles using GPUEvents (trigger event on die).
Now I would love to instantiate a point light at the exact moment and position of the explosion. I would guess that I have to create an Output Event to trigger some C# script to create the light. Unfortunately I can’t find any way to create this Output Event from my GPU Event, because the Output event node only takes input from a Spawn Event, which I do not have at this time. And at spawn time of the original rocket particle I do not know the end position when it actually dies.
Q: Is there any way to pass the position of a dying particle back to the CPU?
I have the exact same issue. Funny, I am also working an a fireworks system and I would like to play a detonation sound as soon as the fireworks explodes.
Same here, I also have a Trigger Event on Die which is connected to a GPUEvent to spawn a new particle, but I cannot get this GPUEvent to connect to the OutputEvent. Did you figure out a solution?
Hi !
After searching for months, i’m now sure that this is just not possible at all, for now
I find that it is really misleading to call that a “GPUEvent” because it does not do what we think it is supposed to
It’s just a way to have an event started at the same time than the spawning, so it’s useful in only a handful of cases
I think i have heard that they are working on a real vfxevent, i’m really waiting for it !
I managed a workaround using a custom node that writes the alive states to a graphics buffer that I then read back to CPU and check for changes. I couldn’t make it work using async gpu readback though, perhaps because of simultaneous read/write.
VFXGraph Setup:
Create a custom node in the VFXGraph and paste in this method:
int WriteToBufferFunction( in RWStructuredBuffer<float> buffer, in int id, in bool alive, in int countPassthrough )
{
buffer[ id ] = alive ? 1.0 : 0.0;
return countPassthrough;
}
Connect the inlets:
GraphicsBuffer property to “Buffer”
GetParticleId to “Id”
GetAlive to “Alive”
The count to pass through to “CountPassthrough”
Connect the custom node outlet to a Trigger Event set to “OnCollision”.