Geometry Nodes: Add float solver to mesh boolean node #119294
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#119294
Loading…
Reference in New Issue
No description provided.
Delete Branch "howardt/blender:exactboolv2_staging"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This adds a "Solver" option to the geo boolean node, with the options Exact and Float.
The current geo boolean node only uses the Exact solver. This adds the ability to use the faster original floating point boolean solver. The float solver has issues with coplanar and other coincident geometry, but is generally much faster than the Exact solver, and users have asked for this option (which is available in the Boolean Modifier and edit mode boolean tool).
Like the modifier, the Float solver needs to convert the Mesh to BMesh, do the operation, and then convert back to Mesh. It also has to do it iteratively if more than two operands are supplied.
This is the first of a planned series of commits that will add a new exact boolean solver, based on the Ember paper, as a solver option. Ember will be much faster than the current exact solver, but may still not be as fast as float, and also will not handle some non-volume-enclosing inputs as well as Float, so it is likely tha the Float solver will always remain. We may eventually retire the old Exact Solver, however.
This commit also prepares for more sensible code in the future by doing two things:
Great! I think it would be good to move the existing
mesh_boolean_convert.cc
(which doesn't seem to be removed here BTW?) to the geometry module first in a separate commit with minimal changes so that git history is preserved. Other than that this PR seems reasonable.@ -0,0 +919,4 @@
BMLoop *(**r_looptris)[3],
int *r_looptris_tot)
{
const int n = meshes.size();
Personally I find this single letter variable name hurts readability below, I had to go check what it was set to, compared to seeing
meshes.size()
ormeshes.index_range()
belowchanged n to meshes_num and used meshes.index_range() in loops.
@ -0,0 +1051,4 @@
const float4x4 &target_transform,
Span<Array<short>> material_remaps,
int boolean_mode,
Vector<int> * /* r_intersecting_edges */)
Could just remove this argument i think
I think I may want to implement the intersecting edges return at some point (if users complain), so would like to leave this as is for now.
@ -0,0 +1090,4 @@
Array<float4x4> two_transforms = {transforms[0], transforms[1]};
Array<Array<short>> two_remaps = {material_remaps[0], material_remaps[1]};
for (int i = 0; i < nmesh - 1; i++) {
BMesh *bm = mesh_bm_concat(two_meshes.as_span(),
.as_span()
should be unnecessary, the conversion fromArray
toSpan
can be done implicitlyYou are right, so I removed the .as_span()'s here. (There is an earlier case of a ? : operation where it was needed).
@ -0,0 +1116,4 @@
/* Except in the first iteration, two_meshes[0] holds the intermediate
* mesh result from the previous iteraiton. */
Mesh *me = const_cast<Mesh*>(two_meshes[0]);
BKE_mesh_eval_delete(me);
What's going on here with the const cast and
BKE_mesh_eval_delete
? That seems potentially problematicI found a better way to do what I needed to do without requiring the const_cast. The strange code before was there because I was using two_meshes for mixed purposes.
@ -0,0 +1140,4 @@
return nullptr;
}
Mesh *GEO_mesh_boolean(Span<const Mesh *> meshes,
The
GEO_
prefix is a relic of C code with no namespaces. Now this can just bemesh_boolean
I guessThanks. I thought I had seen something in the style guide about doing this, but when I looked again, I couldn't find it.
@ -0,0 +1157,4 @@
material_remaps,
op_params.boolean_mode,
r_intersecting_edges);
break;
break
unnecessary afterreturn
removed the break
@ -0,0 +1169,4 @@
r_intersecting_edges);
break;
default:
BLI_assert(false);
BLI_assert_unreachable()
fixed
@ -0,0 +1171,4 @@
default:
BLI_assert(false);
}
return BKE_mesh_new_nomain(0, 0, 0, 0);
Returning null should be okay here IMO
sure, changed.
@ -2660,6 +2660,11 @@ typedef enum GeometryNodeBooleanOperation {
GEO_NODE_BOOLEAN_DIFFERENCE = 2,
} GeometryNodeBooleanOperation;
typedef enum GeometryNodeBooleanSolver {
How about defining this in
GEO_mesh_boolean.hh
in the boolean namespace as:Hmm, somehow I thought everything that was serialized to a .blend file as an enum value needed to be declared in this style in a DNA_.h file. But I guess not. OK, I'll make this change, which I certainly like.
Note that it does require some casts to ints now, but that's OK.
@ -486,3 +481,1 @@
hole_tolerant,
bmd->operation,
nullptr);
const GeometryNodeBooleanOperation op = static_cast<GeometryNodeBooleanOperation>(
Functional style cast (
GeometryNodeBooleanOperation(...)
) is used for enum casts as wellfixed
WIP: Add float solver to geo boolean nodeto Geometry Nodes: Add float solver to mesh boolean node@blender-bot build