Geometry Nodes: new Split to Instances node #113083
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
8 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#113083
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "JacquesLucke/blender:split-geometry-groups"
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 node allows splitting up a geometry into groups. A group is defined as all elements with the same group id. The output contains an instance per group. The
Group ID
output can be used for further deterministic processing.The node supports meshes, curves, point clouds and instances. It only works on the top-level geometry, so it does not go into nested instances because it also generates new instances.
I also attached the file that I intend to add as a regression test.
WIP: Geometry Nodes: new Split Geometry Groups nodeto Geometry Nodes: new Split Geometry Groups node@blender-bot package
Package build started. Download here when ready.
@ -0,0 +292,4 @@
Map<int, std::unique_ptr<GeometrySet>> geometry_by_group_id;
if (src_geometry.has_mesh() &&
What do you think about for loop on all supported components, evaluate fields / do common check, and after this pass all data to mesh/curve/... processing functions (as like in join geometry code)?
I think I prefer the more explicit check as it is now . Right now that's easier to read and debug for me.
In my testing, it has performed exceptionally well. The only enhancement I'd consider is perhaps incorporating an additional input. However, upon reflection, this might be best managed by a distinct set of instance-specific nodes.
Typically, I generate instances for animation purposes to optimize performance. It would be great to specify the origin point of the generated instance. Alternatively, having a toggle that situates the origin point at the 'center of mass' of the instance as opposed to the global origin for all instances would be advantageous.
I am just thinking in terms of rotation, or turning instances to points to then do physics calculations on, currently all instances have their origin at the world so all instances when turned to points are at the same location.
You can get around this using the
Bounding Box
and doing some per-instance calculations to then find where their centre of mass is, but having this be part of the initial node that creates the instances would be great.Thanks for testing. Glad it works for you.
Yes, seems like setting the origin should better be done separately. I can't think of a good solution as part of this node that does the complexity of the problem justice. Simply using the average position is only one out of very many options.
It's a great node that was added, pretty interesting how it compares to this setup I was using before the node lol :)
About finding origins: I agree with Jacques here, this should be a separate feature, if at all. There are too many different ways of setting an origin: centroid (center of mass), weighted centroid, median, minimum, bounds center, etc. etc. And the same applies to other attributes one might want to average over each group. The Accumulate Field node is quite useful to find a sum/average per group.
I'm hitting an ASAN error with this file (just open and un-mute the split node).
FWIW i also hit an asan error in #113146, so it may not be caused by this particular patch.
Good catch. It's indeed independent of this patch. I created a separate patch for the fix: #113160.
Very nice, behavior seems to work great!
There is some overlap in functionality with existing nodes, but that seems reasonable to me in this case.
To me the fact that the node splits the geometry into instances is more integral to the behavior imo than the fact that is uses group IDs to do so, so I'd propose the name
Split Geometry into Instances
, or even justSplit into Instances
though it's longer I feel like it's more in line with the naming scheme we have going in general. The fact that group IDs are used is more implied imo. (besides that the output should be calledInstances
)It's not immediately clear to me why the Group ID output is needed, shouldn't with attribute capture it be possible to propagate to the instance domain? Or I'm guessing it would just stay an attribute on the geometry of each instance?
Probably due to the fact that we do not have a statistics node to transfer attributes from the internal geometry to the instance attribute.
The name is fine with me. What do you think @HooglyBoogly?
Yeah, basically what you said already. The group id exists on the geometry that is split. It's not an attribute on the instances on the output.
The fact that the header is green and it's in the geometry category might imply the "Geometry" part of the name anyway, making it redundant. I'd go with "Split to Instances" though, "into" sounds a bit weird to me.
Regarding the "Group ID" output, my only concern is whether a more general solution might be needed. I'd imagine the need to transfer a "per-group" value to instances would be very common, especially for things like changing the origin point later on, or for further instance-domain processing.
Design-wise, I think the node is reasonable. For the example in the PR description though, I wonder if this solution is really better than a "Face Set Boundaries", "Split Edges", and "Set Position" combination though.
Geometry Groups to Instances/
But this would be generally the ability to propagate attribute data from the geometry to the instancer, right? I think that would generally be useful, but it seems separate from this to me. I do agree with Hans that you might need this functionality for other generic attributes just as well, so singling out this data seems a bit strange.
I see why it exists though, so as long as we don't have a generic solution that's fine with me.
What makes the
Group ID
special is that it is the only attribute we know to be the same on every element on the group. All other attributes can have variations, which also means that the user would need to decide how to reduce all the values into a single value (average, max, min, ...). Solving that more generally with a separate node seems totally reasonable.Geometry Nodes: new Split Geometry Groups nodeto Geometry Nodes: new Split to Instances nodeFrom user side this is good to go for me now.
Just want to note that we should invest into methods to propagate attribute data from geometry to instancers.
I'm on my laptop currently so those previous commits weren't so well tested. I'll look into this again when I'm back at my proper workstation.
@blender-bot build
Definitely easy to do crazy terrible things! (terrible for viewport performance anyway :P)
But hopefully people using this node will already know about this sort of thing. I still think we might be able to eventually unify lists, layers, and instances to some extent. But for now this should be quite useful.
Though it would be good to improve the algorithmic complexity of the geometry copying algorithms, that can be done as a separate step.
@ -441,6 +441,7 @@ DefNode(GeometryNode, GEO_NODE_SET_SPLINE_CYCLIC, 0, "SET_SPLINE_CYCLIC", SetSpl
DefNode(GeometryNode, GEO_NODE_SET_SPLINE_RESOLUTION, 0, "SET_SPLINE_RESOLUTION", SetSplineResolution, "Set Spline Resolution", "Control how many evaluated points should be generated on every curve segment")
DefNode(GeometryNode, GEO_NODE_SIMULATION_INPUT, def_geo_simulation_input, "SIMULATION_INPUT", SimulationInput, "Simulation Input", "Input data for the simulation zone")
DefNode(GeometryNode, GEO_NODE_SIMULATION_OUTPUT, def_geo_simulation_output, "SIMULATION_OUTPUT", SimulationOutput, "Simulation Output", " Output data from the simulation zone")
DefNode(GeometryNode, GEO_NODE_SPLIT_TO_INSTANCES, 0, "Split to Instances", SplitToInstances, "Split to Instances", "Create separate geometries where each geometry contains the elements from the same group")
Simplification: "Create separate geometries containing the elements from the same group"
That's still clear IMO, but it could still say "where each contains" if you thought that helped.
@ -0,0 +17,4 @@
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "DNA_pointcloud_types.h"
This is already included by
BKE_pointcloud.h
@ -0,0 +39,4 @@
.description("All geometry groups as separate instances");
b.add_output<decl::Int>("Group ID")
.field_on_all()
.description("The group id of each group instance");
id
->ID
@ -0,0 +229,4 @@
else {
group_curves = bke::curves_copy_curve_selection(src_curves, mask, propagation_info);
}
Curves *group_curves_id = bke::curves_new_nomain(std::move(*group_curves));
Seems to be a missing "empty" check here?
@ -1232,3 +1232,3 @@
dst_curves.remove_attributes_based_on_types();
dst_curves.update_curve_types();
dst_curves.remove_attributes_based_on_types();
Do you mind committing this separately?