how do you turn off a particle's display once it's emitted ? (without killing it)

I’d like to spawn permanent meshes with vfx graph and then, dynamically with a render texture, control their scale and turn off their display when the render texture alpha is below a certain value.
Scale off the render texture seems ok as long as the particles/meshes are spawned in sequential order matching the render texture and all of them are spawned but I can’t find a way to just turn off their render without killing them.
How do I do that?

what I’ve got so far


vfx graph doesn’t seem to have conditional nodes to exclude the output
maybe the culling is done within vfxgraph? any optimization?

You can use SetAlive in an Output to toggle the rendering of your particles. Doing so in Output does not kill particles, but just disables their rendering. You can also do this on a per-particle basis if you’d like to only turn some of them off.

6607777--751789--RCwHFBXhoo.gif

1 Like

genius! thanks @VladVNeykov
might want to call it “?Set Active” instead as alive is connected with kill which is connected with lifetime

by the way, I see there is a set alive from map, what’s the texture format for that? and can the heuristic be easily changed so for example alpha=0 to 0.5 alive, otherwise dead
or is this way proper and fast? (use of compare can be slow in shaders under certain conditions… which I never remember)

oh and alive is for the entire particle system or can it be done for just specific particleID?

It’s changing the actual Alive per-particle attribute, so naming it Set Something-else can be confusing, but yes, I agree it is not very discoverable.

Any format really, just check if you are applying any sRGB to the texture import settings which might skew the values. And yes, you can scale and add a bias to control what value will yield true or false.

Per particle.

1 Like

true is >=1 ?

Since I got you, how do you do vfx graph have global properties like shaders?

I tried this and it’s not showing up particle where the alpha is = 1
6629989--755950--upload_2020-12-16_13-46-15.png
6629989--755953--upload_2020-12-16_13-46-44.png
it seem that scaling by 0,0,0,1 would do

I was a little bit confused as I tried to disable some particles too. But setting “Alive” did not work for me as it could not be reset after setting to false once.
Turns out renabling it only works if its done in the render context (like in your image).
In the Update context (which I used first) a dead particle will stay dead forever.

Is this intended behavior?

Yes, update happens as compute shader and works on actual data while output is rendering vertex stage and it’s discarded. Just a bit more info here: https://forum.unity.com/threads/vfx-graph-set-color-over-life.1353839/#post-8545457

1 Like