Jump to content
buran13

Delete particles based on ID not Point number

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

Share this post


Link to post
Share on other sites

The plugin should be able to import the ID if you are using a current plugin. The first few versions used $PT as the ID but that was later changed to use the RealFlow ID instead. In a delete SOP they can be deleted with the same expressions as any other particle (like $ID % 10).

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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!

Share this post


Link to post
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).

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×