Jump to content

A fast way to remove point in HDK


eko

Recommended Posts

Hi, all
I am trying to delete points in HDK using the

Code:
gdp->destroyPointOffsets(GA_Range(*delgroup));

There are about 30000000 points in delgroup. It works fine but it seems "gdp->destroyPointOffsets" method is very slow.
I found if I use the "Blast" Sopnode in houdini and select the delgroup. It works much faster(about 50 times) than "destroyPointOffsets" function in hdk.
I wonder that is there any ways to makes delete points faster in HDK.
Thanks!

Link to comment
Share on other sites

How many points total? The Blast SOP needs to make a copy of the geometry anyhow, so in certain cases, it will *copy* the points you want to keep instead (via mergePoints()). It might also be faster if you convert the point group to a primitive group first and then delete by primitives. However, it depends on the actual geometry that you have.

Link to comment
Share on other sites

Hi,thanks for reply!

There are about 70,000,000 points total! There are all points and no primitive. I take your advises and use gdp->appendPointBlock() for adding points and used multi thread For setting Postion of these points. But There are some points that I don't want.

I try these:

gdp->destroyUnusedPoints(pointgroup);
gdp->deletePoints(*pointgroup);
gdp->destroyPointOffsets(GA_Range(*pointgroup));

But they are not fast as the Blast Sop.

Link to comment
Share on other sites

No, I mean to try copying the points you want to keep instead of deleting the points.

const GU_Detail &input_geo = *inputGeo(/*input_index*/0, context);
pointgroup->toggleEntries(); // pointgroup is now the points to keep
gdp->stashAll();
gdp->mergePoints(input_geo, pointgroup, /*keepgrps*/true, /*internal*/false);
gdp->destroyStashed();

Or if you don't have an input gdp to copy from, then perhaps something like this (but likely slow):

pointgroup->toggleEntries(); // pointgroup is now the points to keep
GU_Detail geo;
geo.mergePoints(*gdp, pointgroup, /*keepgrps*/ true, /*internal*/ false);
gdp->duplicate(geo, /*unused*/0, GA_DATA_ID_CLONE);

 

Link to comment
Share on other sites

Hi, Edward. It's almost the same number between keep and deleting the points.

Thanks for your help. I got it. It' works very well.

I use

pointgroup->toggleEntries(); // pointgroup is now the points to keep
GU_Detail geo;
geo.mergePoints(*gdp, pointgroup, /*keepgrps*/ true, /*internal*/ false);
gdp->duplicate(geo, /*unused*/0, GA_DATA_ID_CLONE);
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...