Render.ru

Boolean union множество (несколько) объектов за ра

3rr0r

Знаток
Рейтинг
71
#1
Есть грязная геометрия (много пересекающихся объектов). Нужно их всех сбулить юнионом, чтобы получился один объект с замысловатым рельефом.
Написал скрипт, который работает на тестовых наборах произвольных объектов-примитивов. Но если наделать множество кубов, например, сдвинутых только по одной оси (то есть у некоторых кубов грани совпадают или находятся очень близко), то скрипт валится и говорит, что не может произвести операцию булина.
Скрипт после каждой булевой операции делает триангуляцию и квадрангуляцию для чистой топологии.
И на примере в прикрепленной картинке валится.
Как решить эту задачу?
Вот скрипт на всякий случай

Код:
string $obj_list[]=`ls -sl`;
string $first_obj=$obj_list[0];

for($i = 1; $i < size($obj_list); $i++)
{
    $next_obj=$obj_list[$i];
    polyBoolOp -op 1 -ch 1 -useThresholds 1 -preserveColor 0 $first_obj $next_obj;
    string $objects[]=`ls -sl`;
    $first_obj=$objects[0];
    polyTriangulate -ch 1 $first_obj;
    polyQuad  -a 30 -kgb 0 -ktb 0 -khe 0 -ws 0 -ch 1 $first_obj;
    DeleteHistory;
    refresh;
}
 

Вложения

Покатигорошек

Активный участник
Рейтинг
15
#2
Ensure the meshes involved do not have very small faces and edges. Booleans operations do not work on meshes that have zero area (or very small) faces or zero length (or very short) edges.
The boolean feature automatically checks for and removes very small faces and edges via the Use Thresholds option on the polyBoolOp node. This controls two threshold settings that determine whether small faces and edges are checked for and removed automatically during the boolean operation. The default setting is on.
- The Vertex Distance Threshold checks for zero length edges (or very short edges). Any vertices closer than the value specified will automatically be merged into one vertex.
- The Face Area Threshold checks for zero area faces (or very small faces). Any faces with an area smaller than the value specified will automatically be collapsed into one vertex.
Note
The default threshold settings are a good starting point. If the boolean operation fails, you can experiment with the threshold settings to achieve best results. Increasing either the Vertex Distance Threshold or the Face Area Threshold on the polyBoolean node by too large a value will cause portions of the mesh to disappear.
Для начала можно тупо всё в 1000 отскейлить, сбулить и обратно.
 

3rr0r

Знаток
Рейтинг
71
#4
Цитата:Ensure the meshes involved do not have very small faces and edges. Booleans operations do not work on meshes that have zero area (or very small) faces or zero length (or very short) edges.
The boolean feature automatically checks for and removes very small faces and edges via the Use Thresholds option on the polyBoolOp node. This controls two threshold settings that determine whether small faces and edges are checked for and removed automatically during the boolean operation. The default setting is on.
- The Vertex Distance Threshold checks for zero length edges (or very short edges). Any vertices closer than the value specified will automatically be merged into one vertex.
- The Face Area Threshold checks for zero area faces (or very small faces). Any faces with an area smaller than the value specified will automatically be collapsed into one vertex.
Note
The default threshold settings are a good starting point. If the boolean operation fails, you can experiment with the threshold settings to achieve best results. Increasing either the Vertex Distance Threshold or the Face Area Threshold on the polyBoolean node by too large a value will cause portions of the mesh to disappear.

Для начала можно тупо всё в 1000 отскейлить, сбулить и обратно.

А это сработало! Спасибо!
И задача была именно сбулить юнионом, а не скомбайнить.
 

iNOD

Активный участник
Рейтинг
18
#6
Ну это да, но смотря для какой целы еще это нужно, например если потом на нем будет использоваться бленд шейпы, то булит придется всеравно.
 

Владимир Забелин

Активный участник
Рейтинг
17
#7
неужели?
вот за все 15 лет существования майа ни разу ни булил и студентам категорически не советовал. если алгоритм решения поставленной задачи включает в себя буль, то это плохой алгоритм.
лично мне так кажется.
 

3rr0r

Знаток
Рейтинг
71
#8
:) Ладно, скажу зачем мне булить. Сам тоже никогда эту операцию не использовал. Здесь же мне нужно было сделать хаотично расположенную плитку для облицовки дома, который пойдет на 3д печать. Но пересекающиеся объекты тоже годятся, как выяснилось. Так что вопрос решен и снят. Зато у меня теперь есть скрипт, который может кучу объектов в один сбулить. Может где пригодится.
 
Сверху