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
Cull geometry by connected bounds
1490 5 1- lor
- Member
- 292 posts
- Joined: 12月 2007
- Offline
- Konstantin Magnus
- Member
- 682 posts
- Joined: 9月 2013
- Offline
Hi Nick,
you can remove pieces by calculating their volume (or largest bounding box component) first:
Then create a group for deleting small parts:
To gain more performance you could also pack connected pieces before evaluating their size:
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
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
- Len
- Member
- 133 posts
- Joined: 7月 2007
- Offline
- CYTE
- Member
- 708 posts
- Joined: 2月 2017
- Offline
- brendagray
- 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!
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!
- animatrix_
- 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
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