1
$\begingroup$

I have an integer value I have created from nodes I want to use in multiple places in my project. My thought was to calculate it once then make it available as an integer to the other areas that need it.

I cannot figure out how to do this. I can put it in a node group and reuse that, but this surely means it will need to be evaluated from scratch every time it is used.

Is there a way to do this. I only want to store 1 integer (at this point) for the whole of the node tree.

$\endgroup$

1 Answer 1

1
$\begingroup$

Create an mesh object, set its visibility options so it's convenient (for enable axes visibility, so that even if it contains just one point, it can still be easily selectable):

Perhaps add it to some collection to ensure it won't be rendered and to easily hide it together with similar objects:

Consider also moving such objects to one place where they are easily selectable and don't distract when working on real geometry…

Then add a geonodes modifier like so:

I'm using Set ID to store the integer, so that I don't waste memory on adding a new attribute. If you want to store more integers, rather than increasing the Count of the Points node (which could be useful if you calculate the integer values based on index in a field), consider just adding multiple Points nodes and joining them like I did here:

Above I was actually storing floats as radii of the points, and similarly you could store vectors as their positions. This saves a little bit of memory, but those are completely insignificant savings in 99.999% of cases… On the other hand, both radius and position affect the bounding box of the object, which can be very distracting, so consider using Store Named Attribute instead.

Once you have your object, you can access your data in any other geonodes tree:

If you used Store Named Attribute, then here instead of ID use Named Attribute.

If you want to access the data outside of geometry nodes, see:

Passing GeoNodes attribute to Shader frame offset

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .