Frame as for loop in geometry nodes
I wish we had a loop function in geometry nodes that could be used to iterate a function to create fractal effects. It would be useful in cases like procedural generation of tree branches.
Here's the fractal effect that I want a more effective way to get to:
This is the node tree with manual iteration:
My suggestion is a frame with one geometry input and output and an iteration value input. It takes the output data and plugs it into the input i times before moving on.
It would probably be useful to be able to access the i value as an index somehow in the function.
This could potentially also be a while loop that iterates until a certain condition is met.
7 Comments
I always imagined loop functionality sort of as a special node group rather than just a frame. Then the Group Input could have a built-in
ivalue, or maybe even better, a dedicated Loop Index node only available in this special group. But either way, can't wait for loops!I was thinking a frame would be nice so that you could choose if you wanted to place a group inside it or not. Just to have the option to avoid the tabbing in and out of groups and naming of inputs for simple functions. But it's not super important. I'd be very happy with a node group loop too.
Loop functions are great. But with fixed iterations we can only save some time instead of implement some new thoughts.
With a conditional break input we can do more things. Such as generate the cube fractal infinitely until the cubes are smaller than one pixel on screen.
Also, it could became a real "loop". And together with switch, we will access the ability to implenment more complex algorithms with geometry nodes.
Maybe some "manul refresh" would be necessary to deal with node tress that are to heavy.
I definitely think it would be extremely useful to have the ability to loop in GN and/or Shader Nodes (not sure if there's some technical limitation preventing that?) but I think whatever approach is used is going to need some way of feeding back parameters so you can repeatedly update a value, as well as providing information like 'current iteration number' and 'total number of iterations' or whatever. This currently doesn't seem to do that, although I think there could be some ways of adding it?
Looping is pretty difficult to design nicely in node based symptoms - personally, I prefer Houdini's approach where you have a Loop Group Start and a Loop Group End node and it automatically draws a frame around the stuff within the loop sidefx.com/docs/houdini/model/looping.html . Animation Nodes' loop system is very effective and powerful, but I found it annoying to have to create separate subgroups for every loop, even if I only wanted the loop to be in one specific place - it meant a lot of extra clutter and was rather unclear to read imho.
This seems like a good start, would like to see it developed further!
For me, a frame doesn't fit, but I'd like to see a fields approach where an "iterate node" is added. where a node group can receive input from this iterate node as a field to repeat the process and feed the interaction count. The node could probably also prefix attribute names to allow storage per itteration.
always dream of a loop function node in blender
I wonder if we could solve this by a loop modifier - like a vertical bracket in the modifier stack, where you would grab and move start- and/or end-bracket up or down in the stack. The start-bracket would ask you how often to loop.