Object info/Material index node, when/how to use?

Hi

I was hoping to be able to set faces to specific material index and use the node to separate node flow within the same material, but I can’t find a way to do it. The material index in the solidify modifier works by assigning different material slots, which seems the same as assigning faces to different materials.

Maybe it’s not possible? If not possible, what on earth is it supposed to do then?

My idea was to have anisotropic shading along some faces and turn off anisotropy for other faces, but all in the same material slot. So if my “per face assigned material index” was 0, material sets some anisotropy value, for remaining faces material turns off anisotropy.

I’ve found a way around it by UV location checking (my isotropic faces will be in the top of my UVs), but I’m still interested in knowing what the intended use for the node is.

If you want to use only one material, you can’t use material or object ID because they are both the same for all faces. Use some other method, either UV based or vertex colors etc. UVs are easiest probably, I would add a second UV map and simply put all faces that I want to manipulate differently into one side/corner in UV map and then check UV coords with Math node (greater than). As I understand, you do it the same way now.

Material and object IDs are useful if you have lots of objects and materials in the scene and you need masks for them to do something in compositor. Instead of setting up different render layers you can pull the masks from ID passes.

But why do we have a way to read material index in a material if there is no way to set it?
Yes, I have a workaround for what I want to achieve, but I’m still curious. Under what circumstance would you read out this?

Haven’t used ID code inside material, but one use case would be input to some material node group which is shared among materials and IDs couls randomize some setting or do some other differenciation in a shared group.