I’ve been using InstaMAT for nearly a year, and I’ve been facing a similar issue.
At the moment, when I want to mask merged objects individually, I handle it before exporting the 3D model by either assigning separate Vertex Colors to each part in advance or separating them into different UV islands.
This is a good workaround, but I would like to keep the vertex colors untouched. My model is for the Godot game engine, where I need the vertex colors for shader FX.
However, I found a workaround by using “Mesh Normal Mask” layers in InstaMAT. Handling multiple elements is a bit tedious, but in my case, it’s great for masking submeshes.
Yes, you can generate unique vertex colors for all parts of a combined mesh using Submesh Adjacency with the Mesh Unique Colors node. You can then assign those vertex colors to the mesh with the Mesh Set Vertex Colors node. You can then bake those vertex colors to create ID maps as needed. You could export the new mesh with those vertex colors assigned, or use the Mesh Bake node directly in the graph to generate the ID maps.
If you have any questions, feel free to reach out!