Hi!
So, since I have some background in programming, I am very confused with
the logic in Geo Nodes, and I would be very thankful if someone would explain it to me!
Here is very simple setup, one default cube, and I’ve created two self-explanatory materials: red and blue. Blue material is applied on the cube using the “Set material” node.
Then, after the first “Set material”, I insert another one in which I pick red color this time,
which of course overrides the blue material from the previous node, as expected.
Now, if I want to introduce some logic, to apply that red color based on some choice,
I can use simple integer comparison of two integers. In this example, if 2 and 2 are
equal, red color will be applied to the box.
Important thing to notice is that the “Selection” in the “Set material” node is Boolean type.
That means that red color should either be applied to the whole box mesh, or not applied,
based on the input received in the “Selection”.
But!
When I use index, which in this case is representing the index of the faces of the cube,
and when face with the index of 2 is compared to 2, red color will be applied only to the
face with that index.
Why is that?
If “Compare” node sends only boolean result, then the result should be only true or false.
But, obviously, not only boolean value, but also the index value is passed.
So, what bothers me is that I don’t really understand the background of this process and therefore
I’m not sure how to best use it. It seems that “Set material” node doesn’t really apply material to the
whole mesh, but in the background it applies material on the index by index basis, and therefore if
we introduce some kind of index based logic such as in this case, we can reference only certain
indexes?
Thanks!