← All ideas
  • Published 11 May 2022

Variables in nodetrees

Currently in blender, if i have a large node tree and want a value to connect to various locations (start middle and end of my graph), i need to have long connections that stretch across my entire graph. In applications like Unreal, Unity, Gaea. They allow you to create and call variables for reuse through your graph. (greatly increasing readability/reducing visual clutter)

Houdini is similar in the sense that you can have nodes accessing values from other nodes without seeing the connection visually. They do it with copyParameter -> Paste Relative reference. which is a bit more gritty to look at, but i think allows for more control.

I think this reduction in visual clutter, and ease of control will encourage and support the creation of bigger, more refined, and more complex graphs with all node systems

63.6%

Development Status: Open

Upvote 7 Downvote 4
kylejennings
11 May 2022

4 Comments

arthurbourquin

Yes!

What about declaring variables in a new tab under "Tool", "View" and "Group", in the right pannel.

And type directely the variable in any value field?

We have # for adding driver, why not having an @ or something to refer to the variables?

Would be awesome.

1
Shimoon

You can already doing that with drivers.

Mouse hover any value > right click > "Copy As New Driver" > mouse hover any other value > right click > "Paste Driver".

This way, the first value will drive the second one.

1
andrej730

I don't understand why people downvoting this.

Drivers method can help reusing some constant value indeed but it doesn't allow you to save any data that was calculated during the graph - geometry / vectors / etc. Which is the main thing you'd want variables for.

Other downside for the drivers method - it's decreasing the readibility, you need to open the driver to see the variable it's connected to - i.imgur.com/b9qyTFp.png .

For constant values you can just create group input and reuse them everywhere, it's very neat and readable. No need to create one big group input and drag them through the entire graph. i.imgur.com/clmjieI.png

In Geometry Nodes there is currently no way to organize graph to avoid long unreadable connection.

The best (and only) approach I've found for now is to make those long connections outside of the graph and add some name at reroute at the end of the connection, so it will be easier recognize what's the data you're trying to move across the graph.

mindinsomnia

In addition to drivers you could also achieve this by creating a group with a value in it that connects to the group output, then inserting the group anywhere you want to use it's values. This has the advantage of being able to reuse the variable across multiple geometry nodes too.

Drivers are also a good way to do it as Shimoon said. A good way to store them globally for a whole scene is to store them under the 'Custom Properties' panel of the 'Scene' properties, and then to use the 'right click > Copy as New Driver, right click > Paste Driver' trick Shimoon mentioned to use that property anywhere in a geometry nodes setup, material shader, or anywhere else.