Igor Churakov

maxpayne

About Me

専門知識
VFX Artist
INDUSTRY
Film/TV

Connect

LOCATION
Canada
ウェブサイト

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Multithreading over point groups(one thread - one group) 2026年7月6日13:27

Hi everyone. I've got some logic running over points. That logic involves accessing neighbor points and setting some attributes. If I use GA_SplittableRange that causes race condition in this situation so my idea is to split point cloud to n-groups(~threads count), run them in parallel and then do some logic as a final step.

I came across UT_TaskGroup(). Is that one way of doing it ?

Thank you.

HDK (find neighbours) optimization 2026年6月30日9:17

johnmather
That looks more or less correct. You can also use bvh.sortResultsto sort based on distance.

Yep. That worked. Thank you for helping me again.

HDK (find neighbours) optimization 2026年6月29日10:00

Umang_Raj
i haven't tried doing this, but im sure you have to run the init function first, to build the bvh representation, and then as you said there is no good documentation but, i think the first bvh stack input is for all the bounding boxes the function pops, i don't think you have to put anything in there, if you had, it would be a const parameter.
the output queue is just an array of the of all of the found leaf boxes in nearest first order (since it is a "ordered stack") i think, since you can also see the same parameters from the base class of pointbvh, after getting the output queue, you should get the stack entrys, and in the stack entry there is a myNode property, i think it is the index, there is also the pointOffset function the base class of point bvh (BVHBase), i think you use the index in there to get the point offset.
i haven't tried this as i said, im making guesses from documentation, you should try and see if it works.

Hey Umang_Raj. Thank you for the tip. That actually works. So the code would be like this:

UT_IntArray temp_array;
GEO::PointBVHT<3> bvh;

bvh.init(*gdp, P_handle);

UT_Array<UT::BVHOrderedStackEntry> bhv_stack;
UT_Array<UT::BVHOrderedStackEntry> bhv_output;

bvh.findClosestPoints(gdp->getPos3(ptoff), bhv_stack, bhv_output, max_pt, radius);

for (int i=0; i< bhv_output.entries(); ++i)
{
temp_array.append(gdp->pointIndex(bvh.pointOffset(bhv_output.myNode)));
}

And temp_array now holds indices of nearpoints for the current pointOffset;