Geometry Nodes: Rewrite mesh delete geometry node #108435

Merged
Hans Goudey merged 24 commits from HooglyBoogly/blender:delete-mesh-rewrite into main 2023-06-01 14:55:27 +02:00
Member

Replace the implementation of the separate and delete geometry nodes
for meshes. The new code makes more use of the IndexMask class, which
was recently optimized. The main goal is to make more of the work scale
with the size of the result mesh rather than the input. For example,
instead of keeping a map from input to output elements, the maps used
to copy attributes go from output to input elements.

The new implementation is generally 2-4x faster, depending on the mode
and the number of elements selected. The new code is also able to skip
more work when nothing is removed.

This also allows using more existing attribute interpolation code,
allowing the overall removal of over 300 lines. Some of the attribute
utilities from a similar change for curves (f63cfd8e28) are
directly reused.

The indices of the result changes, so the test file needs to be updated.

Replace the implementation of the separate and delete geometry nodes for meshes. The new code makes more use of the `IndexMask` class, which was recently optimized. The main goal is to make more of the work scale with the size of the result mesh rather than the input. For example, instead of keeping a map from input to output elements, the maps used to copy attributes go from output to input elements. The new implementation is generally 2-4x faster, depending on the mode and the number of elements selected. The new code is also able to skip more work when nothing is removed. This also allows using more existing attribute interpolation code, allowing the overall removal of over 300 lines. Some of the attribute utilities from a similar change for curves (f63cfd8e289da0078266) are directly reused. The indices of the result changes, so the test file needs to be updated.
Hans Goudey added 1 commit 2023-05-30 20:03:50 +02:00
Hans Goudey added 1 commit 2023-05-30 20:13:39 +02:00
Hans Goudey added 4 commits 2023-05-31 15:56:39 +02:00
Hans Goudey added 8 commits 2023-05-31 19:40:29 +02:00
Hans Goudey requested review from Jacques Lucke 2023-05-31 20:25:43 +02:00
Hans Goudey changed title from WIP: Geometry Nodes: Rewrite mesh delete geometry node to Geometry Nodes: Rewrite mesh delete geometry node 2023-05-31 20:25:56 +02:00
Hans Goudey added this to the Nodes & Physics project 2023-05-31 20:26:04 +02:00
Hans Goudey added 1 commit 2023-05-31 20:26:04 +02:00
Hans Goudey added 1 commit 2023-05-31 20:28:30 +02:00
Hans Goudey added the
Interest
Geometry Nodes
label 2023-05-31 22:49:20 +02:00
Member

Seems to work in my simple tests. I can see a few visual differences in the delete_geometry.blend test file:
image

Maybe that's just fixing a bug, but would be good to investigate why there are differences.

Seems to work in my simple tests. I can see a few visual differences in the `delete_geometry.blend` test file: ![image](/attachments/98f1945e-251e-4655-bc17-34dfd25a449c) Maybe that's just fixing a bug, but would be good to investigate why there are differences.
Hans Goudey added 2 commits 2023-06-01 13:45:41 +02:00
Hans Goudey added 1 commit 2023-06-01 13:53:18 +02:00
Author
Member

Thanks for noticing that! I found the operation needs to be skipped when the selection domain is empty (when there are no faces for example).

Thanks for noticing that! I found the operation needs to be skipped when the selection domain is empty (when there are no faces for example).
Jacques Lucke approved these changes 2023-06-01 14:11:23 +02:00
Jacques Lucke left a comment
Member

Assuming the before and after look in the test file look the same now. It still has fairly good coverage (checked earlier today).

Assuming the before and after look in the test file look the same now. It still has fairly good coverage (checked earlier today).
@ -928,6 +929,15 @@ void gather_attributes(AttributeAccessor src_attributes,
const IndexMask &selection,
MutableAttributeAccessor dst_attributes);
void gather_attributes_group_to_group(AttributeAccessor src_attributes,
Member

Add comment.

Add comment.
HooglyBoogly marked this conversation as resolved
@ -146,6 +146,9 @@ void copy_group_sizes(OffsetIndices<int> offsets, const IndexMask &mask, Mutable
/** Gather the number of indices in each indexed group to sizes. */
void gather_group_sizes(OffsetIndices<int> offsets, const IndexMask &mask, MutableSpan<int> sizes);
OffsetIndices<int> gather_selected_offsets(OffsetIndices<int> src_offsets,
Member

Add comment.

Add comment.
HooglyBoogly marked this conversation as resolved
@ -41,0 +46,4 @@
return {};
}
BLI_assert(selection.size() == (dst_offsets.size() - 1));
offset_indices::gather_group_sizes(src_offsets, selection, dst_offsets);
Member

The offset_indices:: is not necessary here.

The `offset_indices::` is not necessary here.
HooglyBoogly marked this conversation as resolved
@ -0,0 +17,4 @@
r_map.fill(-1);
#endif
mask.foreach_index_optimized<int>(
GrainSize(4049), [&](const int src_i, const int dst_i) { r_map[src_i] = dst_i; });
Member

typo (4049)

typo (4049)
HooglyBoogly marked this conversation as resolved
Hans Goudey added 5 commits 2023-06-01 14:50:40 +02:00
Hans Goudey merged commit 50bfe1dfe3 into main 2023-06-01 14:55:27 +02:00
Hans Goudey deleted branch delete-mesh-rewrite 2023-06-01 14:55:28 +02: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 Assignees
2 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#108435
No description provided.