Serial Loops [Proposal]

Then what is wrong with serial loop & parallel loop as names?

6 Likes

In this context it makes more sense (it was not mentioned in the task), but still… I thought looping over individual elements like vertices is already implicit with fields. As in if you have set position node it loops over every point in the field and sets its position from the source field.

So if this is a serial loop and there will be parallel loops, what will be the use cases where I would want to use parallel loop? Or rather what would be the uses cases where I want to use serial loop?

Just thought of a case when Index might be useful. Suppose you want to procedurally generate 10 tufts of grass to scatter across your scene with Instance On Points. You want every tuft to be different, so you make a serial loop that generates tufts randomly–and you use the Index to seed the random number generator.

Basically, you want to use serial loops when the iterations depend on each other. And you want to use parallel loops when they don’t.

A good use case for a serial loop is physics. E.g. you want to resolve collisions between particles. In one iteration you push them apart a little, but then you need to iteratively repeat the process to actually get rid of all the intersections.

@SiriusBizdness Just gave a great example of when you use a parallel loop. Instancing stuff on points and doing something with each element. That can be done in parallel and it’s precisely why a serial loop should not be used.

3 Likes

Sure fields are already executed for each element in a domain. But then you’re limited to what the node that the field is executed in can do.

A parallel loop allows you to build your own, just as performant, Set Position node, but with all the control.

1 Like

Personally, I am waiting for loops because it’ll allow for way more procedural stuff than is possible right now, not just physics. For generating ivy or any other plants it is super-handy to have a block to get rid of intersections, and loops are ideal for that!

1 Like

Thanks for the clarification!

This post and the quoted one should be included in the documentation of serial loops (repeat) and parallel loops IMHO.

Or at least a very similar explanation on what type of loop to pick, with a bunch of related examples like the ones you guys mentioned!

Super excited about this new feature by the way! Can’t wait!

1 Like

I was talking about generating the source instances via loop–the ones that go into Instance On Points, not the ones that come out.

Parallel loops would be appropriate for modifying already scattered instances, though.

1 Like

Right, but even in this case, a serial loop is not what you want. Those instances should be created in parallel.

I’ve been thinking about it, and I think it still makes a lot more sense to have “Serial Loop” and “Parallel Loop” instead of “Repeat” and “Loop”.

One of the most important usability factors is how much can user figure out from the way user interface is presented before they need to resort to external source (documentation or tutorial).

It’s quite more likely user who is new to GN (without any history of lurking on development forums) will be asking a confused question “What is the difference between Repeats and Loops?” than asking “What is the difference between Serial Loops and Parallel Loops?”

The former pair of “Repeat” and “Loop” is a pair of synonyms:

The latter pair of “Serial Loop” and “Parallel Loop” describes the difference between the two right in the very names of the nodes, so the user is less likely to resort to a google search, tutorial or documentation dive to figure out when is it appropriate to use which.

One pair clearly communicates the difference, and therefore implies the suggested use case, while the other pair doesn’t. So the naming which describes the purpose even before one has to resort to documentation or google search is the better one.

7 Likes

I think ‘Repeat’ is fine.
After thinking about it again since a year or something I think using ‘Loop’ for the parallel loops is confusing.

Maybe we should call the parallel loop just ‘Parallel’.

3 Likes

@jacqueslucke I’m having real trouble understanding Serial Loops without a Parallel Loops proposal to compare against. How soon can we expect that?

What about being more descriptive like ‘Loop Over Elements’ for parallel loop and ‘Loop Nodes’ or ‘Loop Node Group’ for repeat?

Repeat doesn’t necessarily imply that an incremental step is being taken, but a loop does.

1 Like

In programming, serial usually means you are guaranteed everything is processed one step after another in the provided order. Parallel means, you provide a bunch of of elements (like vertices or indices to vertices) that need to be processed somehow (like offsetting e.g. based on a normal map) and you don’t get a guarantee about the execution order, but you have to make sure it works properly, no matter what the execution order is. The parallel case can now be implemented to be executed a lot faster (if there are enough elements), because there is no requirement to go one step after the other.
In the case of offsetting each vertex according to a normal map, it doesn’t matter when each vertex is processed, so this can easily be parallelized.
On the other hand when you process a curve and the position of a handle is based on the position of the previous handle, you can’t parallelize it because the position of the previous handle has to be set first.

1 Like

Please use serial loop and parallel loop.
It’s just confusing otherwise, most people work with different software and programming languages and they search for loop not for parallel/repeat.

There is also a tooltip to explain the difference between serial/parallel.

7 Likes

I agree with the preference to use parallel loops AND serial loops for names. Using repeat seems unnecessary and more confusing. Having serial loops and parallel loops immediately suggests to the user that they are related to each other, but have difference and similarity, prompting the user who might not know what those are to know that he needs to search for an answer. Having serial loops and parallel loops together as names both highlights the relatedness of the two and suggests to the user his need to remove his ignorance to know which one to choose.

24 Likes

I’m not sure that’s an advantage :stuck_out_tongue: (just kidding)

Now that’s a good argument .

  • Serial Loop/ Parallel Loop
  • Repeat / Parallel

0 voters

2 Likes

Isnt it supposed to be Repeat / Loop?

1 Like

For what it’s worth, “parallel loop” sounds weird to me. “Loop” sounds like it’s going to operate many times on data, but instead it’s something that’s done only once, on many elements. Geometry nodes aren’t like any scripting language, with fields we’re already always in a loop, in a sense.