Transfer value from Geometry nodes to Shader editor

Hello,
I want to take the float value from Geometry nodes [see picture] and pass it to shader editor.
The most important thing is, that I need to make some math on this value in Geo nodes before I transfer it to shader editor.
I tried attributes but, I suppose, I made it wrong, because nothing works.

In short - I want to control value in my material by tweaking it on my Geo Nodes panel in modifier tab.

I’m newbie to geo nodes, please help me.


ss2

Hello! This is how you transfer attributes from Geometry Nodes to Shader editor:

4 Likes

2 Likes

Alright,
thank you very much silex and silververtex for your help.
I think it didn’t work for me because I had Integer as input.
It works with float tho.

Is there any way to make it work with integer as input?
Also, does it matter if the material is on different object? Not the one with geonodes on?

1 Like

Inside Geometry Nodes open N panel and hit ‘Group’ tab. Inside you will find all sockets with their preferences. Then you can change socket from float to integer or anything else:

If you are piping floats into integer socket this might not work properly.

1 Like

No. It doesn’t matter, because the Attributes node loops through all the values ​​in the blend file

It works for me in a newly created file but it doesn’t in my project.

It doesn’t even work without any math. Just input to output.
Sadly I can’t send you blend. file of this because of non-disclosure agreement.
I have no idea what’s wrong tbh.

Thanks for your fast replying guys!



It doesn’t work for me this way. It only applies to object that has Geometry Nodes modifier.

You can use the transfer of attributes to other objects through the Data Transfer modifier

  1. Create an empty attribute on the cube
  2. Specify this attribute as an output in the Output node
    image
  3. Create a material on the cube with input data from this attribute
  4. Assign a material to Another mesh or create a new one - it doesn’t matter
  5. We assign and transfer vertex attributes from the cube through the Data Transfer modifier and, if we created a new material, then we specify the same attribute in the material as on the cube

The result, I think, will be identical on a copy of the cube, but the more the shape of Another mesh differs, the stronger the differences in color distribution will be, but with the preservation of the “type” of data distribution, which is set in the geometric nodes of the cube

2 Likes

Thanks for all the ideas, I found all of these really helpful guys!

If someone looks for different solution:

  • Add “realize instances” node after instancing
  • it works but UVs of you instances may be destroyed now
  • [in material tab] Add Attribute node and write “UVMap”
  • use this node (Attribute UVMap) instead of Texture coordinates node for your textures

It should work too.

Thanks!

1 Like