[VEX] Group/delete particles by @id

   5931   4   0
User Avatar
Member
19 posts
Joined: June 2019
Offline
I have a POP simulation and I'm trying to write a code in VEX to delete all those particles (From the beginning) that between frame 1-100 have at least once been below the ground (zero).

Every particle has an @id, so I was thinking to group them by @id and then blast them. The problem is that the codes I've been trying didn't work.

What's the best way to do it? Any help would be much appreaciated.
Edited by AlbusNolente - Jan. 6, 2021 06:50:23
User Avatar
Member
5100 posts
Joined: Feb. 2012
Offline
Hi,

You have to do it in a Solver SOP. You can write something like this in Attribute Wrangle (Run Over: Points):

if ( @P.y < 0 )
    removepoint ( 0, @ptnum );
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
19 posts
Joined: June 2019
Offline
animatrix_
Hi,

You have to do it in a Solver SOP. You can write something like this in Attribute Wrangle (Run Over: Points):

if ( @P.y < 0 )
    removepoint ( 0, @ptnum );

Yes this code deletes the particles just when they go below the ground, but in some way I need to store the id of those and completely delete them from frame 1.
User Avatar
Member
680 posts
Joined: Nov. 2013
Offline
You could use Pop Stream or Pop Group with Preserve option to catch particles.
User Avatar
Member
5100 posts
Joined: Feb. 2012
Offline
If you store them you still have to use a Solver SOP to accumulate the values. So you can store an attribute for deletion like this:

if ( @P.y < 0 )
    i@delete = 1;

TimeShift to the last frame and Attribute Copy delete attribute to the time dependent branch.

Then blast them using:

@delete==1

in the Group field, and Group Type set to Points.
Edited by animatrix_ - Jan. 6, 2021 07:59:32
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
  • Quick Links