5

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?

G.H.
  • 331
  • 1
  • 8

4 Answers4

7

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)

Markus von Broady
  • 36,563
  • 3
  • 30
  • 99
  • This looks good... How did you input the list? I can't figure that much out :-/ – G.H. Oct 24 '22 at 11:17
  • @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. – Markus von Broady Oct 24 '22 at 12:56
  • Ahh! I didn't see that tab. Thanks. – G.H. Oct 24 '22 at 22:17
5

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.

quellenform
  • 35,177
  • 10
  • 50
  • 133
  • 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 – Markus von Broady Oct 24 '22 at 12:30
  • Where does that "Lenght" node come from? I can't find it... – G.H. Nov 03 '22 at 04:23
  • @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? – quellenform Nov 03 '22 at 07:44
  • @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. – G.H. Nov 03 '22 at 07:53
  • @G.H. Please be so kind and share your blend file. The error can surely be found easily: https://blend-exchange.com/ – quellenform Nov 03 '22 at 08:00
  • Here you go:

    https://blend-exchange.com/b/jAenxgw5/ - Extrude Edges by String.blend

    – G.H. Nov 03 '22 at 10:48
  • 1
    @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$. – quellenform Nov 03 '22 at 11:35
3

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?

Markus von Broady
  • 36,563
  • 3
  • 30
  • 99
2

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.

Gorgious
  • 30,723
  • 2
  • 44
  • 101
  • Very nice solution! ...but isn't it limited to a maximum of 10 digits? – quellenform Oct 25 '22 at 14:33
  • 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. – Gorgious Oct 25 '22 at 14:55
  • 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... – Markus von Broady Oct 25 '22 at 14:58
  • 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 – Markus von Broady Oct 25 '22 at 15:25
  • Indeed, interesting ! Thanks for doing the computation. – Gorgious Oct 25 '22 at 15:31
  • Another update, by using base 2 you can store up to 24 booleans. – Markus von Broady Oct 25 '22 at 16:03