Jump to content
eko

A fast way to remove point in HDK

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!

Share this post


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

Share this post


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

Share this post


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

 

Share this post


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

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

×