3
$\begingroup$

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

enter image description here

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

$\endgroup$
  • $\begingroup$ Unfortunately, Vertex paint requires geometry subdivision to work well with smoothing the paint. You only get the detail you are willing to have geometry for, as the Subdivision Surface and Multiresolution modifiers do not allow you to paint after the result of the smoothing. You could however look into combining the texture paint solution and UDIM paint schemes for allowing multiple textures to be used in the same material. $\endgroup$ – Craig D Jones Jul 6 at 15:52
  • $\begingroup$ Indeed there seems to be no alternative solution, as vertex paint, as the word itself says, refers to the color of the vertices. It is a pity that there is no trick to overcome this problem of resolution. But I understand the limitation and it also makes logical sense. I don't understand what you mean by: quote "You could however look into combining the texture paint solution and UDIM paint schemes for allowing multiple textures to be used in the same material." $\endgroup$ – Noob Cat Jul 6 at 22:22
  • $\begingroup$ Can you be more specific what is the reason to keep it in a single material? To better understand what alternative can fit to your needs. Thank you $\endgroup$ – vklidu Jul 6 at 23:30
  • 1
    $\begingroup$ UDIM allows one to have multiple UV map positions and it could be possible to use UV Warp Modifier to change the position of the UV across multiple UDIM mapped image, though I am not skilled enough to fully realize it given the unknowns in your project use case. $\endgroup$ – Craig D Jones Jul 6 at 23:59
  • 1
    $\begingroup$ Complex material stored in Group is possible (in general), but if you want to keep listed only one material ... OK. BTW If you want to attract more visitors I would suggest to revised the Q description, that is unnecessarily long and a bit confusing. $\endgroup$ – vklidu Jul 7 at 7:31
2
+100
$\begingroup$

You could use the "Object Info" node for that purpose. It has an output slot called "Object Index", which actually refers to the render pass index found under "Object Properties" -> "Relations":

enter image description here

You can give each object an unique "Pass Index" and then identify it in the node editor with a math compare node that will output "1", if the input "Object Index" (same as "Pass Index") matches the value specified underneath and "0", if this is not the case:

enter image description here

These outputs can then be used in a "MixRGB" node to attach the appropriate mask textures to the objects.

| improve this answer | |
$\endgroup$
  • $\begingroup$ This technique looks very very interesting! I have to delve into this example to better understand how to manage it $\endgroup$ – Noob Cat Jul 4 at 23:28
  • $\begingroup$ I gave the bounties to your answer, as it is the most faithful to my question, as there is no need to create further materials. Although it would be nice for peter to access a custom property instead of object index. But it seems that this is not possible $\endgroup$ – Noob Cat Jul 13 at 19:46
5
$\begingroup$

You will have to specify some kind of "mask" at some point of process for any object. So I'm not sure if the shared material is key for you.

If you want just be able to change node-tree shared by multiple objects from one place you can use Node Groups. Place all material node-tree into a group (Ctrl+G) only "mask" node and Material Output place out of this group.

enter image description here

Once created, the node group can be placed (Shift+A > Group) everywhere and managed from any of its copies. This way you can completely change node tree into totally different look without touching material with mask specific to object.

| improve this answer | |
$\endgroup$
  • $\begingroup$ I find this very interesting, but I would like to keep the same material (as in my question), although I think this is a good alternative $\endgroup$ – Noob Cat Jul 6 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.