← All ideas

Cycles: Recursive/Iterative Node Groups

I love the freedom Cycles node groups give me, but every so often, I run across a problem that can't be solved without a loop or recursion. Here's an example:

Suppose you want to create a procedural brick wall texture that gives a unique look to each brick, in a herringbone pattern. You can create a brick with six Gradient textures, some math, and some mapping nodes. Each brick would be a fixed length and width, so you could use simple math and a mapping node to work out how to rotate each brick and where the next one would be. You'd then have to combine the bricks by adding the output of each one to the last.

This is all simple and easy enough, and I was able to do a simpler version of it (for the sake of this proposal) in around ten minutes. But: for each brick, I need a separate node group, a separate mapping node, and a separate math node to create, move, and add them together. It's tedious and it takes away one of the biggest advantages of procedural materials: letting the computer do the work for you.

So here's my proposal: create node or node groups that do all of the repetitive adding 1 for us. It would take an input and create Iterative inputs or Constant inputs. Each iterative input would have an Iteration Rule, which could be made up of math nodes, vector math nodes, etc. Constant inputs would act just like normal group inputs. Then you wold have an Iteration Loop, which contains the nodes to be iterated over. It would act just like duplicating the node group and using a different input for each one. Then there would be a Combination Rule, which would take the current iteration and the previous iteration (the user could set the iteration access), and combine them using math, vector math, color mix nodes, etc. .

I imagine this would be hard to implement. I could create a Python script that creates the node trees for me, but not as iterative nodes. And of course, I could use OSL, but that isn't doable on the GPU or in EEVEE (which is what I really care about! I'm trying to create an ultimate NPR node tree but I need loops for some of my ideas).

Thanks for reading my proposal.

rightClickSelect_IterativeNodeGroup_Proposal_00.PNG

100%

Development Status: Open

Upvote 12 Downvote 0
Josephbburg
7 Jan 2019

2 Comments

bukebeyond

I still can't stand most of nodes. They are ok for an artist to rewire simple things like textures, but drawing a line of a math formula with a pageful of spaghetti is like a cruel joke for a shader programmer. There really should be like a GLSL code insertion node. Can't Cycles run them on the GPU as well (Compute Shaders)? At least a formula node would help immensely. It seems to me, you would really love a proper text language when implementing loops and conditionals. They are far less pain than trying to do it with nodes.

Josephbburg Author

In the top of my image, you see my proposal mock-up, and in the bottom, you see the actual nodes required right now. On the right, you see the result. Each iteration would add another brick.

Also, I hope I didn't come across like I was complaining! But I hope this feature is a possibilty