My question is to have an alternative way if it exists. So my problem is the following: As you can see from this image, I have 2 materials, the first in the top row, uses vertex paint, so white and black decide how to mix green and red, so everything is ok here. In the row below, there is a material practically the same, but which uses a mask (Always black and white) for vertex paint which is absolutely more detailed, as it does not need to have a high subdivision of polygons (As in vertex paint) .
But there is a problem in Texture paint, unlike vertex paint, that is, the possibility of painting the same material on many objects, without these being modified all together, let me explain better,
The vertex paint refers to the colors of the vertices of the object, but is very limited on the final results, due to the triangulation that is very visible, but remains independent (If the object is not an instance)
The texture paint is very nice, but it does not remain independent, so if I paint an object, the other object with the same material will suffer the same fate, therefore I will have 2 objects with the same mask.
I'm trying to approach this to understand which way to go, without having to create a new material, but probably my knowledge stops here.
Basically, I would like to have only one material, with the possibility that it can be masked independently on objects.
I would also like a vertex paint solution, if this were not so "Squared". I have a lot of confusion right now and I would like to know an answer on this, which will guide me to a "Logical" but intelligent choice, always keeping the single material
Post Bounty Note:
Based on Splize's answer , however, I thought that this method could contrast with the real use of Index pass? but actually it seems a very useful answer, and it works very well. At this point I would like to understand if there are further way that can be taken. Taking into account also a hypothetical more detailed vertex paint, because the vertex paint is much more "comfortable" as it does not require an additional Mask and "Smart Projection" to make the correct mask mapping