4
$\begingroup$

I generate some instances using geometry nodes, each instance has an id attribute.

Here is a spreadsheet snapshot showing generated instances :

Spreadsheet showing generated instances

My geometry nodes are seen below :

Geometry nodes generating instances

I'd like to use this id from the Cycles material applied to the instances.

So far, I've tried using the Attribute node, Object Info / Object Index, and Particle Info / Index - without success.

My current attempt of shader nodes looks like this :

My current attempt of shader nodes

Is there a way to access the id value from the material shaders nodes ?

I'm aware that using the "Realize Instances" nodes I could create a mesh with custom attributes - but I need to preserve the actual instancing for complex geometry.

$\endgroup$
1
  • $\begingroup$ AFAIK this is not possible with complex geometries and without realize instances right now. $\endgroup$
    – Chris
    Commented Jan 3, 2022 at 12:18

1 Answer 1

5
$\begingroup$

you can use this node setup:

enter image description here

spreadsheet:

enter image description here

shader:

enter image description here

result:

enter image description here

$\endgroup$
13
  • 1
    $\begingroup$ I'll edit my question to be more specific, but I want to preserve my instances - as I need to have many of them, with complex geometries - so "Realize Instances" is too memory hungry for my needs. $\endgroup$
    – rotoglup
    Commented Jan 3, 2022 at 12:15
  • $\begingroup$ AFAIK this is not possible at the moment without realize instances and with complex geometries. If you would have simple spheres....there are some mathematical workarounds... $\endgroup$
    – Chris
    Commented Jan 3, 2022 at 12:19
  • $\begingroup$ I've created the same setup here, now I'm a bit confused... when I use the Set Material node on the original geometry of the cube, the 8 vertices show values 0.000 to 7.000 for myID - and the cube is colored according to the vertex indices. But when I try to do it with the realized instances, the column myID reads 0.000 for all vertices and so the cylinders (or in my case icospheres) get the color for 0. I switched from the Index node I used originally in my setup to ID like you, but nothing changes. The results are exactly the same, the cylinders stay at the color for 0. $\endgroup$ Commented Jan 3, 2022 at 12:26
  • $\begingroup$ what version r u using? If you provide your blend file, i will check it out ;) $\endgroup$
    – Chris
    Commented Jan 3, 2022 at 12:27
  • 1
    $\begingroup$ @Chris I wish this bloody chat would sent notifications that someone posted something ;) $\endgroup$ Commented Jan 5, 2022 at 7:02

You must log in to answer this question.

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