Jump to content

Delete particles based on ID not Point number


buran13

Recommended Posts

Hey guys,

I'm trying to clean up particle sims coming from RealFlow.

Is there a way to delete a group of particles based on their ID attribute and not the point number?

The amount of particles I need to get rid of is quite big, so it'll be really helpful if there is a way I can just select them in the viewport.

Any help is most appreciated!

Thanks

Link to comment
Share on other sites

Made a quick and dirty example, notes are in the file. Hopefully it helps. :)

kill_by_id.hip

Static, thank you so much!! Exactly what I need. Although it takes a bit of time to cook with the amount of particles that I have.

Is there maybe a way to store the "kill" information in a temp file or something and use that instead of doing a loop for each particle?

Sorry if I'm asking dumb questions. I'm a noob with Houdini.

Lukeiamyourfather, thanks for the help, but I prefer to do it in Houdini. This can be very very useful not just with RealFlow particles but with particles coming from Houdini or Maya.

Thanks again

Link to comment
Share on other sites

Is there maybe a way to store the "kill" information in a temp file or something and use that instead of doing a loop for each particle?

Sorry for the delayed reply... my caches came back at work :P

I made a quick python function that does that, so it only iterates once (when it's constructing the delete expression). Now it should run faster, and only requires a delete sop with a couple spare parameters. The script itself is stored in the hou.session module, accessed by going to the top menu Windows -> Python Source Editor

Keep in mind that you still need to replace the blast node with whichever one gets created, or you could chain them together, where each delete SOP references a different blast SOP.

I'm tempted to clean this up and post an otl on the exchange when I have some time. It seems pretty useful.

kill_by_id_exp.hip

Link to comment
Share on other sites

Sorry for the delayed reply... my caches came back at work :P

I made a quick python function that does that, so it only iterates once (when it's constructing the delete expression). Now it should run faster, and only requires a delete sop with a couple spare parameters. The script itself is stored in the hou.session module, accessed by going to the top menu Windows -> Python Source Editor

Keep in mind that you still need to replace the blast node with whichever one gets created, or you could chain them together, where each delete SOP references a different blast SOP.

I'm tempted to clean this up and post an otl on the exchange when I have some time. It seems pretty useful.

kill_by_id_exp.hip

This way is actually waay slower for me. I'm not sure, but I think it's fast to store the $IDs that need to be deleted, but it takes forever for Houdini to actually delete the points. Each point has do go through this huge Filter Expression that contains all the point IDs conditions. Deleting just a 100 points or so makes it extremely extremely slow. Maybe I'm doing something wrong I'm not sure.

Thanks a lot for helping me out with this!

Link to comment
Share on other sites

what's your point count? Deleting points can take a long time depending on the amount you're working with. If you're deleting thousands, then the expression will take some time to construct as well.

Keep in mind that deleting geometry can be slow because houdini has to delete it for each cook (frame).

Link to comment
Share on other sites

I see what's happening. I'm not sure if there's a way to access points with specific attrib values in python (ie: specific ids) without looping through all points. At that point it may be better to look at the hdk, which I'm unfamiliar with :lol:

Using a python SOP, I think you would still need to loop through all points -> check for id -> delete. I'm not sure what the speed gains would be.

Link to comment
Share on other sites

I see what's happening. I'm not sure if there's a way to access points with specific attrib values in python (ie: specific ids) without looping through all points. At that point it may be better to look at the hdk, which I'm unfamiliar with :lol:

Using a python SOP, I think you would still need to loop through all points -> check for id -> delete. I'm not sure what the speed gains would be.

I ended up using the original setup. Takes a while to cook but very reasonable for the amount of particles I have! (about half a million)

Again, thanks a lot for your help!

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

I just uploaded an asset to the Houdini Exchange that does this. With it, you can either select the points in the viewport and then run it as a tool, or simply lay it down and input the list of ID numbers. You must be in SOPs.

Its much faster that creating a long expression, because it stores the IDs in a hidden geometry.

Hope it helps.

sop_kill_particle_ids.otl

Link to comment
Share on other sites

  • 1 year later...

I just uploaded an asset to the Houdini Exchange that does this. With it, you can either select the points in the viewport and then run it as a tool, or simply lay it down and input the list of ID numbers. You must be in SOPs.

Its much faster that creating a long expression, because it stores the IDs in a hidden geometry.

Hope it helps.

Just wanted to thank Ryan! Pretty fast tool.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...