Kill particle with custom form or object ?

Good morning !

I currently use a particle system where I need to be able to delete certain particles at specific locations with predefined objects or forms!

There are currently only Kill Sphere and AABox to destroy particles which might not be enough.

The best would be to be able to define a mesh, a collider in the VFX graph or directly in the scene with a gameObject, I don’t care. Basically I would like all the particles that are in this form to be removed.

I looked everywhere there is not really any information on this subject and normal there is little use of particle like mine I suppose.

Thank you in advance for your help !

PS: Sorry for my bad English it’s not my native language

Nobody ?

Collide with SDF and let the Lifetime Loss to 1.

1 Like

Hi @Julius_Cornelius ,

As @XieJiJun suggested, you can add a Collide with Signed Distance Field block in your Update context and set the Lifetime Loss value to 1 (meaning particles will lose their full life if they collide with the SDF).

We added a built-in SDF baker in 2021.2 which you can access via Window > Visual Effects > Utilities > SDF Baker.
You can find a bit more info on how to use it in this video (starts around 19:32).

Once you’ve baked your shape, you can position it with the Field Transform value of this block.

Hope this helps!

8424225--1114938--upload_2022-9-8_9-7-35.png

2 Likes

Morning, as stated above if you need “precise” collision, SDF (Signed Distance Field) could be a good fit for what you’re looking for.
To simplify, “sampling” the SDF of a Mesh with your “Particle Position” will return the distance to the Closest Surface.
This distance value can either be “Positive” or “Negative” (signed) if the sample postion is Inside the Outside of the Surface. And a value of 0 would be mean that the Particle is actually on the Surface.

So with this, you can either use the “Sample Distance Field” Block operator , or directly use the “Collide with SDF” Block context.
8424228--1114920--upload_2022-9-8_10-2-13.png8424228--1114929--upload_2022-9-8_10-2-26.png

Both of them would need you to provide an SDF as Input to know Which SDF to sample.
And you will also need to provide a “Transform” of the Mesh you want you’re particles to Collide with.

So the Steps would be:

  1. Create a “3dtexture” exposed property
  2. Create a “Transform” exposed property and set it to “WorldSpace”.
    8424228--1114944--upload_2022-9-8_10-8-31.png
  3. Create and Collide with “SDF” in the “update Context”.
  4. Wire the Distance Field, and Transform Properties.
  5. Set the Lifetime Loss to 1 ( Particles will Lose 100% of their Lifetime when colliding with the Shape)
  6. Make sure the Mode is set to “Solid”

8424228--1114935--upload_2022-9-8_10-7-27.png
8424228--1114935--upload_2022-9-8_10-7-27.png

2 Likes

  1. You need to Bake the “Mesh” to an SDF (will be store in a 3d texture."
  2. Window> Visual Effect >Utilities > SDF Bake Tool
  3. Bake your Mesh and Save the SDF as a 3d Texture.

9.In the Scene, select your VFX and set your SDF properties

  1. Add a VFX Property Binder to your VFX object.
  2. In this VFX property Component , add a Transform Binding.
  3. Select the Target (the Mesh in the Scene you want to get the “Transform” from.
  4. Select your 3d Texture property.

8424252--1114965--Unity_P8mclHicFQ.gif

1 Like

And you should be good to go…

8424264--1114968--Unity_U1Zoo89qUF.gif

Thank you very much for your response! That worked perfectly!

1 Like