0
$\begingroup$

I have a mesh object without faces, that is transformed into a curve in geo nodes. The edges of the mesh have custom attribute assigned (let's say integer value). After transforming to curve, the attribute is stored inside control points. The behavior of Mesh to Curve node, I think, is that it first moves attribute values from edges to connected vertices and blures/means the value from connecting edges, then converts vertices to control points by splitting mesh in vertices that have more than 2 edges connected.

What I want to achieve, is having the attribute value stored inside curve domain. So all connecting edges that have the same value, to be transformed into a singular curve that will have this value assigned (not inside the control points but inside the curve). So I think this breaks into 2 parts:

  1. Splitting mesh into 2 parts in vertices where the connecting edges have different attribute values (places with more than 2 edges do this automatically)
  2. Transferring attribute from control points domain into curve domain

enter image description here

enter image description here

enter image description here

enter image description here

The reason for the need to have attribute stored in splines is already existing geometry nodes setup that requires it to work. The reason for working with mesh and not spline at the beginning is similar.

Also some requirements for the solution would be that it works on single edge that has 2 neighbors with different value:

enter image description here

Plus, connected edges that have same value should be connected into one curve (except if there is a vertex with more than 2 neighbors connecting them). The mesh should be always split in the vertex with neighbor count higher than 2.

enter image description here

My idea for second step was to use endpoint_selection node and just sample value in the first control point of each curve, but I don't know how to sample from selection instead of indices. I also think that Split Edges is going to be important but I don't know how to set selection since it (I think) works on edge domain, and I want to be splitting in vertex domain based on attribute value in neighboring edges.

Any hints, ways to achieve the endgoal are welcome, my geo nodes understanding is lacking for this issue.

$\endgroup$
1
  • $\begingroup$ I think I have solved it. Will create an answer if I don't find some edge case by tomorrow $\endgroup$
    – Poncaada
    Commented May 5 at 22:53

1 Answer 1

1
$\begingroup$

(Using Blender 3.6.8)

First proposal

The proposed approach is to duplicate the original mesh to delete in every copy edges with attribute different from Duplicate Index. Then the resulting sets of edges are converted to splines, and the attribute value is transferred in the Spline domain by sampling each spline at its first point, characterized by a null Factor.

GN Graph

Resources:


Second proposal

The original approach is generalized for attribute types that might be signed integer, float or vector (top part of the following GN graph). It also deals with splitting curves where more than two edges are connected to the same vertex (bottom part of the following GN graph). Eventually the attribute transfer from Point to Spline domain is simplified.

GN Graph

Resources:

$\endgroup$
5
  • $\begingroup$ Although I was originally looking for a general solution for any/most datatype, the values in my situation are indeed positive integers greater than 0 and usually less than 10. So for this case it would be a good solution. I will do some testing asap and mark your respons as solution if it holds. Thank you for your response $\endgroup$
    – Poncaada
    Commented May 4 at 15:31
  • $\begingroup$ The issue I have found so far is that when the mesh is first split based on the attributes value and then transformed into curve, the vertices that have had multiple edge neighbors now can have just 2 and therefore the curve stays connected in that place. So I either have to be able to disconnect curve into multiple based on control points attribute "has_multiple_neighbors" calculated in mesh beforehand, or find approach that operates on the whole mesh not on a subset $\endgroup$
    – Poncaada
    Commented May 5 at 15:51
  • $\begingroup$ My bad. Since splitting mesh in the vertices that have more than 2 neighbors seems to be default behaviour of "mesh to curve" node, I didn't consider it. I will update the question and the blender file $\endgroup$
    – Poncaada
    Commented May 5 at 16:24
  • 1
    $\begingroup$ For "Test 3", you are expecting 3 splines, one with my_attribute=3 et two with my_attribute=1 ? $\endgroup$ Commented May 5 at 17:12
  • $\begingroup$ Yes, that is what should be the result $\endgroup$
    – Poncaada
    Commented May 5 at 17:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .