Loops in Geometry Nodes [Proposal]

I think until the first working example appears, everyone will continue to talk about names …

1 Like

Yes, you can have decimal floats. They are defined in IEEE754-2008.

To make the group more intuitive and more quickly accessible, I would have a Boolean socket named “activate”. This would act as the “for” condition.

To avoid infinite loops, have a “max iterations” input. Using switches and is viewport nodes, one could set a different number of max iterations for the render.

When will loops come to Geometry Nodes?

As far as I understand, they are not allowed to be added yet.

That’s a bit of a strange way to say it. First the design needs to be agreed upon, then it can be created. It’s an extremely tricky node to get right! You can quite easily create maintenance nightmares later on. You preferably don’t want to create a loop node and have to change it again in the next release (like happened with the GN attributes workflow). Also a loop node will probably need a way to interrupt it’s evaluation as it could easily hang your computer. More design work to do.

Most core developers are now quite busy squashing bugs for the 3.1 release. After that is done probably there will be time to discuss the design again.

6 Likes

You misunderstood.
Their concept was not accepted. The node, an example of which is here, is not accepted. The very fact of the group as a loop is rejected

This is why it needs further design like @Baardaap said

1 Like

ah, okay, i didn’t get it

Can a frame be used as loop?
This is from this proposal on RightClickSelect:

I personally don’t really mind the way it’s presented, but the author has a point in that it doesn’t require setting up input names. I like the compacity of node groups better, but I guess this “loop frame” could still be grouped anyway. I think the biggest challenges are how they’re implemented, how many different loop types there are, and what are the protections against potential infinite/expensive loops.

Then, instead of an entire node group as a loop, we can have 2 nodes: Loop Start and Loop Stop. Anything placed in between these nodes will be looped based on an iteration value (the number of times to run the loop) in the Loop Start node. The type of loop (series or parallel) could also be mentioned in the Loop Start node. We can also have a Break node to explicitly exit from the loop when a given condition hits true.
As far I know, Houdini puts the loop nodes in an orange frame:
https://www.sidefx.com/docs/houdini/model/looping.html

A frame is easier to spot at a glance. There could be an overlay option to turn off frames in loop nodes (or not give the frame at all if it seems too distracting).

2 Likes

I like the idea of a frame, it seems to leave more freedom and is easier to spot the content

What if, rather than having a group or a frame, noodles that contain looped data are doubled. This would be an easy way to see if geometry is evaluated more than once.

4 Likes

If you have several “branches” leaving the loop start would all branches have to be plugged into the loop end or would it be enough to plug a single one into the loop end?

I think you don’t need the loop end node. You can simply put two output sockets on the loop start node. One called “while looping” and one called “loop finished”.
Stuff connected to “while looping” gets looped according to the iteration input and when that is finished the loops starts fires whatever is plugged into the “loop finished” socket.

2 Likes

The loops should be connected downwards to make it clear.

Since so far the idea of the loop group has been abandoned
I am thinking about the design of loop domains
The bottom line is to get the field and its modifier (link to the field change function)

  • And getting the value for the first element
  • receive it in the save for the second, after the change, for write…
  • and the 3rd element as the last one will get the 2nd, …
  • and the 4rd element as the last one will get the 3nd, …
  • and the 5rd element as the last one will get the 4nd, …
  • and the 6rd element as the last one will get the 5nd, …
    Options:
  • enter a group to separate primitives into separate thread loops
  • Number in the group (maybe just an index as default) - processing order. To be able to invest. If multiple values have 1 number, only one will be used

Features: sorting, accumulation, statistics, …

Requirement:

  • the ability of the node at the end of the list to change the value of the attribute at the beginning of the list.
    If the input attribute is just a stack of virtual arrays
    then it can be relatively easy
    Just need a link
1 Like

Having a loop start and loop end would be great (and my preference). Perhaps, as a compromise for those who would prefer the frame, there could be a toggle shortcut that adds a frame for the loop and automatically includes the items in that loop and that, if there already is a frame, automatically removes the frame but keeps everything that was in the frame right where it was. That way, a small loop would not require a frame, and if one wanted to easily move all the items in a loop (if, for example, there were lots of items in the loop), one could simply hit the toggle to add the loop frame, grab and move the loop frame, and then hit the toggle again to get rid of it.

1 Like

Would nesting loops be feasible if loops are done with special ‘begin-loop’ // ‘end-loop’ nodes? Would there be a way to stack loops?
Somehow, there needs to be a way to specify which end-loop node belongs to which begin-loop node.

Could this kind of problem be avoided if loops exist in their own context, like group based loops or frame based loops?

Why don’t we just take a little idea from python and use the position of the node itself to determine which loop a node is in? Everyone loves indentation!

EDIT:
Though I doubt any sane human being would think I was being serious, I do not want my humorous statement to fall into the hands of Poe’s law.

That was in fact, a joke.

10 Likes