Geometry Nodes: Edges to Face Groups Node #104428

Merged
Hans Goudey merged 7 commits from HooglyBoogly/blender:geometry-nodes-edges-to-face-groups-node into main 2023-02-09 16:27:23 +01:00
Member

Add a new node that groups faces inside of boundary edge regions.
This is the opposite action as the existing "Face Group Boundaries" node1.
It's also the same as some of the "Initialize Face Sets" options in sculpt mode 2.

Discussion in #102962 has favored "Group" for a name for these
sockets rather than "Set", so that is used here.

image
image

Add a new node that groups faces inside of boundary edge regions. This is the opposite action as the existing "Face Group Boundaries" node[1]. It's also the same as some of the "Initialize Face Sets" options in sculpt mode [2]. Discussion in #102962 has favored "Group" for a name for these sockets rather than "Set", so that is used here. [1]: https://docs.blender.org/manual/en/3.4/modeling/geometry_nodes/mesh/face_set_boundaries.html [2]: https://docs.blender.org/manual/en/3.5/sculpt_paint/sculpting/editing/face_sets.html#initialize-face-sets ![image](/attachments/f5661c6b-cbc5-4ca2-b534-e122b22b2b1c) ![image](/attachments/1eb48ec5-7a6f-48b6-8b5f-57f8a7352c3e)
Hans Goudey added 1 commit 2023-02-07 19:52:48 +01:00
9fa1069eb4 Geometry Nodes: Edges to Face Groups Node
Add a new node that groups faces inside of boundary edge regions.
This is the opposite action as the existing "Face Group Boundaries" node[1].
It's also the same as some of the "Initialize Face Sets" options in sculpt mode [2].

Discussion in T102962 has favored "Group" for a name for these
sockets rather than "Set", so that is used here.

[1]: https://docs.blender.org/manual/en/3.4/modeling/geometry_nodes/mesh/face_set_boundaries.html
[2]: https://docs.blender.org/manual/en/3.5/sculpt_paint/sculpting/editing/face_sets.html#initialize-face-sets
Hans Goudey requested review from Jacques Lucke 2023-02-07 19:52:58 +01:00
Jacques Lucke requested changes 2023-02-08 18:47:32 +01:00
@ -53,6 +53,7 @@ void register_geometry_nodes()
register_node_type_geo_edge_paths_to_curves();
register_node_type_geo_edge_paths_to_selection();
register_node_type_geo_edge_split();
register_node_type_geoedges_to_face_groups();
Member

typo

typo
HooglyBoogly marked this conversation as resolved
@ -0,0 +45,4 @@
const Span<MPoly> polys = mesh.polys();
const Span<MLoop> loops = mesh.loops();
/* Create Edge/Face Lookup */
Member

Comment style.

Comment style.
HooglyBoogly marked this conversation as resolved
@ -0,0 +50,4 @@
polys, loops, mesh.totedge);
/* Join faces based on edge values */
DisjointSet<int> islands(polys.size());
Member

Should be possible to parallelize this now.

Should be possible to parallelize this now.
HooglyBoogly marked this conversation as resolved
@ -0,0 +53,4 @@
DisjointSet<int> islands(polys.size());
for (const int edge_i : non_boundary_edges) {
for (const int a : edge_to_face_map[edge_i]) {
for (const int b : edge_to_face_map[edge_i]) {
Member

It looks like these two nested loop call join more often than necessary.

It looks like these two nested loop call `join` more often than necessary.
HooglyBoogly marked this conversation as resolved
@ -0,0 +61,4 @@
/* Output faces final assigned groups */
Array<int> output(domain == ATTR_DOMAIN_FACE ? mask.min_array_size() : polys.size());
VectorSet<int> ordered_roots;
Member

Can probably use AtomicDisjointSet::calc_reduced_ids?

Can probably use `AtomicDisjointSet::calc_reduced_ids`?
HooglyBoogly marked this conversation as resolved
@ -0,0 +65,4 @@
const IndexMask poly_mask = domain == ATTR_DOMAIN_FACE ? mask : polys.index_range();
for (const int poly_i : poly_mask) {
const int64_t root = islands.find_root(poly_i);
output[poly_i] = ordered_roots.index_of_or_add(root);
Member

That doesn't really work when mask.min_array_size() is used as the size of output.

That doesn't really work when `mask.min_array_size()` is used as the size of `output`.
HooglyBoogly marked this conversation as resolved
Hans Goudey added 4 commits 2023-02-09 03:48:44 +01:00
Jacques Lucke reviewed 2023-02-09 12:50:55 +01:00
@ -0,0 +26,4 @@
{
for (const int i : indices.index_range()) {
for (int j = i + 1; j < indices.size(); j++) {
set.join(i, j);
Member

indices[i], indices[j]

`indices[i], indices[j]`
Author
Member

I wonder how it worked in my tests without this, yikes. I'll commit some regression tests after this to make sure it doesn't happen again.

I wonder how it worked in my tests without this, yikes. I'll commit some regression tests after this to make sure it doesn't happen again.

Not so long ago I found the same in the Index of Nearest node. It seems like it would be better to add some specifics to the names (including iterators and array indexes) to agreement? (like when cleanup/fix the Select Material node).

Not so long ago I found the same in the `Index of Nearest` node. It seems like it would be better to add some specifics to the names (including iterators and array indexes) to agreement? (like when cleanup/fix the `Select Material` node).
Hans Goudey added 2 commits 2023-02-09 16:15:55 +01:00
Jacques Lucke approved these changes 2023-02-09 16:23:12 +01:00
Hans Goudey merged commit 50dfd5f501 into main 2023-02-09 16:27:23 +01:00
Hans Goudey deleted branch geometry-nodes-edges-to-face-groups-node 2023-02-09 16:27:23 +01:00
Sign in to join this conversation.
No reviewers
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
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#104428
No description provided.