5
$\begingroup$

I want to be able to extrude edges of a mesh by ID number - e.g. extrude edge 2 and 3. Is this possible? I see the selection input socket of the node requires a boolean input, and I saw the post linked below where they create a 'mask' to feed into the socket. How would I build this mask using integers? Presumably, a list containing boolean values like 0,1,1,0 would work. But I can't see a way to build this list.

How can i extrude specific edges in geometry nodes?

Any suggestions?

$\endgroup$

4 Answers 4

8
$\begingroup$

I figured out a way to parse a string into a list of booleans:

Custom Group (hidden text settings don't matter, as long as they're in sync)

$\endgroup$
3
  • $\begingroup$ This looks good... How did you input the list? I can't figure that much out :-/ $\endgroup$
    – G.H.
    Commented Oct 24, 2022 at 11:17
  • $\begingroup$ @G.H. when you press N key to open numbers panel in the geonodes tree editor, you will see a tab to specify inputs, you can add a string input here. Alternatively, if you connect an "empty" Group Input socket to a socket of type string, a new input will automatically be created of that type. $\endgroup$ Commented Oct 24, 2022 at 12:56
  • $\begingroup$ Ahh! I didn't see that tab. Thanks. $\endgroup$
    – G.H.
    Commented Oct 24, 2022 at 22:17
5
$\begingroup$

The concept of using a string to control the individual edges is strictly speaking an abuse of Geometry Nodes, but I'll let it stand anyway ;-)

Anyway, the idea can be refined and improved a bit:

enter image description here

Here I simply replace the number $0$ with a space (Note: Unfortunately you can't see it on the screenshot, but here it is important that you insert a space () in the Replace field!).

The node String to Curves creates an instance, but the output Pivot Point has then the value $(0,0,0)$. After that it is easy to derive a boolean value from it, which can be used directly as a selection.

$\endgroup$
7
  • $\begingroup$ I was thinking about optimizing my setup for booleans... You probably noticed I set txt box width because it's a simplification of multi-digit numbers $\endgroup$ Commented Oct 24, 2022 at 12:30
  • $\begingroup$ Where does that "Lenght" node come from? I can't find it... $\endgroup$
    – G.H.
    Commented Nov 3, 2022 at 4:23
  • $\begingroup$ @G.H. This is a vector math node. Here you can find more information if you are looking for a specific node: Can't find the node! Which node is available in which Blender version? $\endgroup$
    – quellenform
    Commented Nov 3, 2022 at 7:44
  • $\begingroup$ @quellenform, Thanks - the colour threw me off. In that case, this doesn't work for me. I've tried the same setup, but I find that if ANY value of the string is a 1, then ALL edges are extruded. If ALL values are 0, then no edges are extruded - but there is no individual control. I'm using Blender 3.3.0. $\endgroup$
    – G.H.
    Commented Nov 3, 2022 at 7:53
  • 1
    $\begingroup$ @G.H. You did everything right, but unfortunately it was not clear in the screenshot (I added a note to the answer): You would have to enter a space in the Replace field for the second Replace String node. This will replace the number $0$ with a character that has no geometry and thus has the length $0$. $\endgroup$
    – quellenform
    Commented Nov 3, 2022 at 11:35
3
$\begingroup$

You need to pass this list of integers to the geometry nodes setup somehow… You can combine simple comparisons with Boolean ORs:

You can more easily control more points (up to 31) using a ColorRamp node like in these answers:

How can I rotate individual curve points in geometry nodes?

Cycling /looping through a set of index values using geometry nodes to create animation

However, in your case it seems you want to input a list from outside… You can take a look here:

How to instantiate objects on individual/selected points in geometry nodes?

$\endgroup$
2
$\begingroup$

Here's a solution using a binary bitflag integer input.

enter image description here

enter image description here

It can be extended to an arbitrary number of indices up to 10, since it's elevated to 10^input it produces very high numbers. Higher values will produce negative numbers and fail.

enter image description here

Note if there would exist a "String to Value" node and if "Slice String" were to accept a field, this limitation could be lifted and a string input could be used.

$\endgroup$
6
  • $\begingroup$ Very nice solution! ...but isn't it limited to a maximum of 10 digits? $\endgroup$
    – quellenform
    Commented Oct 25, 2022 at 14:33
  • $\begingroup$ Yup, it is, unfortunately ! :) If we could slice a string into a field and have a "String to Value" field node I think we could get past this limit, since strings are (theoretically) not limited in size. $\endgroup$
    – Gorgious
    Commented Oct 25, 2022 at 14:55
  • $\begingroup$ This is what I'm doing here except you're smart enough to do it the easier way, you calculate the power and compare, rather than doing a logarithm. BTW, like I mention under the link, you can't start with a 0... $\endgroup$ Commented Oct 25, 2022 at 14:58
  • $\begingroup$ I updated that answer and argue there the maximum number of booleans stored in an integer is actually $7$, not 10! At least unless you're willing to make the first zeroes invisible, in such case it would be 8. np.float32(111111111) == 111111110.0 $\endgroup$ Commented Oct 25, 2022 at 15:25
  • $\begingroup$ Indeed, interesting ! Thanks for doing the computation. $\endgroup$
    – Gorgious
    Commented Oct 25, 2022 at 15:31

You must log in to answer this question.

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