0
$\begingroup$

enter image description here

In the above node setup:

  • There is a meshline with 2 point count
  • A plane is added as instance to the line
  • There is a Set Material Index node which gets its input from index node.
  • The plane has 2 materials of 2 different colors.

So I am expecting the 2 instances to have 2 colors (material index 0 and 1). However, as can be seen in the screnshot both instances have the same color. Am I missing anything?

Edit: Just to add to the answer from Lutzi, apart from realizing the instances we also need to divide the index with face count. Since the realized instances are actually faces, we need to assign the material for all faces of every instance. In case of plane, it works without the division by face count for the obvious reason :)

enter image description here

$\endgroup$
5
  • $\begingroup$ A Realize Instances before Set Material Index solves your issue. You can't have instances but with different materials, instances share the same data. $\endgroup$
    – Lutzi
    Commented Aug 3 at 12:09
  • $\begingroup$ Thanks, could you put that as answer. $\endgroup$ Commented Aug 3 at 12:20
  • $\begingroup$ I have a slight doubt about "instances must share the same material", but alright and worst case scenario my answer will be downvoted. $\endgroup$
    – Lutzi
    Commented Aug 3 at 12:30
  • $\begingroup$ @Lutzi Also, I thought realize instances would convert the resulting geometry into instances.. so each vertex will have a separate index (like we do set position after realizing to change individual vertex positions).. But realizing seems to work in this particular case. Would be interesting to see other points of view. $\endgroup$ Commented Aug 3 at 12:35
  • $\begingroup$ Not exactly, materials are defined on the face domain, not vertex. And the node Index behave differently depending on the domain you are using. So under the hood, you'll get face index because you are acting on material-related stuff. That's my guess, 80% sure ahah. $\endgroup$
    – Lutzi
    Commented Aug 3 at 12:40

1 Answer 1

0
$\begingroup$

If you don't need to keep them as instances

You can realize your instances, to be able to give them different materials :

enter image description here

If you need to keep them as instances

Then you have to build a material that behaves differently per instance. A complete answer is available here. It can be a bit trickier because you need to build a kind-of-procedural material that behaves as multiple materials.

$\endgroup$
1
  • $\begingroup$ Thank you. Please see my edit. $\endgroup$ Commented Aug 3 at 13:16

You must log in to answer this question.

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