Cull geometry by connected bounds

   1490   5   1
User Avatar
Member
292 posts
Joined: 12月 2007
Offline
Good day. I have a massively complex object with many thousands of parts modeled that are too small to render. I would like to check the bbox size of each connected set of prims and then delete below a certain bbox size threshold. I am not a coder, but know some python. I have a little (very little) experience with vex, although I am learning.

Can anyone suggest an approach to this problem? I have tried a foreach loop with python inside, tried a vex wrangle and a vex vop, but I don't know enough to get it to work.

Any help is greatly appreciated.

Nick
User Avatar
Member
682 posts
Joined: 9月 2013
Offline
Hi Nick,

you can remove pieces by calculating their volume (or largest bounding box component) first:

string grp = "@class==" + itoa(i@class);
vector size = getbbox_size(0, grp);
float vol = size.x * size.y * size.z;
// float vol = max(size);

f@vol = vol;

Then create a group for deleting small parts:

f@vol<=chf('volume');


To gain more performance you could also pack connected pieces before evaluating their size:

float b[] = primintrinsic(0, 'packedbounds', i@primnum);
vector size = set(b[1] - b[0], b[3] - b[2], b[5] - b[4]);

f@vol = max(size);
Edited by Konstantin Magnus - 2023年6月23日 15:24:16

Attachments:
remove_by_size.hip (151.8 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
133 posts
Joined: 7月 2007
Offline
Much less vexxy and (probably) less performant than Konstantin's solution:
- Your mesh into a Connectivity sop (defaults)
- Into Measure sop, Measure set to Volume and Accumulate to Per Piece.
- Into Blast sop, set to Primitives, with @volume<SOME_VALUE in the Group field.
User Avatar
Member
708 posts
Joined: 2月 2017
Offline
Or use labs
"delete small parts" node.

Cheers
CYTE
Edited by CYTE - 2023年6月24日 08:43:35
User Avatar
Member
1 posts
Joined: 6月 2023
Offline
Hello Nick,

It sounds like you have a challenging task at hand. While I'm not an expert in 3D modeling or Houdini specifically, I can provide you with a general approach that you can consider for your problem.

One possible approach is to use a loop to iterate through each connected set of prims and check the bounding box (bbox) size. If the size falls below your specified threshold, you can delete those prims. Here's a general outline of how you could approach this using Python in Houdini:

Use a Python script to get the connected sets of prims. You can utilize the hou.primGroups() function or any other relevant functions provided by the Houdini Python API.

Iterate through each connected set of prims using a loop. For each set, calculate the bounding box size. You can use the boundingBox() function or similar methods available in Houdini's API to get the bounding box.

Compare the calculated bounding box size with your specified threshold. If the size is below the threshold, delete the connected set of prims. You can use the delete() function or any other relevant functions in Houdini's API to remove the prims.

Keep in mind that this is a general outline, and you may need to adapt it to fit your specific needs and the tools available in Houdini. It's always a good idea to consult the Houdini documentation, tutorials, or seek assistance from the Houdini community forums for more specific guidance and code examples.

I hope this gives you a starting point to tackle your problem. Best of luck, and I hope you find a solution that works for your complex object!
User Avatar
Member
4685 posts
Joined: 2月 2012
Offline
brendagray
Hello Nick,

It sounds like you have a challenging task at hand. While I'm not an expert in 3D modeling or Houdini specifically, I can provide you with a general approach that you can consider for your problem.

One possible approach is to use a loop to iterate through each connected set of prims and check the bounding box (bbox) size. If the size falls below your specified threshold, you can delete those prims. Here's a general outline of how you could approach this using Python in Houdini:

Use a Python script to get the connected sets of prims. You can utilize the hou.primGroups() function or any other relevant functions provided by the Houdini Python API.

Iterate through each connected set of prims using a loop. For each set, calculate the bounding box size. You can use the boundingBox() function or similar methods available in Houdini's API to get the bounding box.

Compare the calculated bounding box size with your specified threshold. If the size is below the threshold, delete the connected set of prims. You can use the delete() function or any other relevant functions in Houdini's API to remove the prims.

Keep in mind that this is a general outline, and you may need to adapt it to fit your specific needs and the tools available in Houdini. It's always a good idea to consult the Houdini documentation, tutorials, or seek assistance from the Houdini community forums for more specific guidance and code examples.

I hope this gives you a starting point to tackle your problem. Best of luck, and I hope you find a solution that works for your complex object!

Chat GPT? :P
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
  • Quick Links